Python and Autodesk Inventor

901 views
Skip to first unread message

Ben Rousch

unread,
Apr 27, 2011, 11:02:05 AM4/27/11
to GRPUG: Grand Rapids Python Users Group, MichiPUG
Before I dive head-first into my next little project, has anyone used
Python to work with COM on Windows?

I'll be attempting to use Python 2.7 and the Python Windows Extensions
to extract data from Autodesk Inventor. In theory it works, and
there's even some half-finished help pages on the Autodesk wiki.

Any tips or sanity checks?

I'm sure a nice presentation for GRPUG will come out of this no matter
how it ends up.

P.S. My fallback is to use the VBA embedded in Inventor, so I'm pretty
motivated to make Python work here.

--
 Ben Rousch
    bro...@gmail.com
    http://clusterbleep.net/

Mike English

unread,
Apr 27, 2011, 11:10:20 AM4/27/11
to gr...@googlegroups.com, MichiPUG
At one point I considered using Python to script things in Excel, but eventually decided the cost to my sanity outweighed the benefits.

Here's one of the best resources I did find though:

-Mike


--
You received this message because you are subscribed to the Google Groups "GRPUG: Grand Rapids Python Users Group" group.
To post to this group, send email to gr...@googlegroups.com.
To unsubscribe from this group, send email to grpug+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/grpug?hl=en.




--
Mike English
+1 (616) 723-0277
http://mikeenglish.net

Ben Rousch

unread,
Apr 27, 2011, 11:18:27 AM4/27/11
to gr...@googlegroups.com
Reading and writing Excel files is actually pretty easy with the
xlrd/xlrw modules. http://www.python-excel.org/

I actually have that book, but my concern is that it's now more than
10 years old.

Ben DeMott

unread,
Apr 27, 2011, 8:26:46 PM4/27/11
to GRPUG: Grand Rapids Python Users Group
Hey Ben - We actually have done this quite a lot... my first
recommendation is to get an OLE browser - Windows has an old school
tool that does this called "OLE Explorer" - the tool built into pywin
is less than great.

I have a fair amount of examples from API's we've had to interact with
- I'll try to send you some from work tomorrow.
>     brou...@gmail.com
>     http://clusterbleep.net/

Ben Rousch

unread,
Apr 29, 2011, 10:54:12 AM4/29/11
to gr...@googlegroups.com
Awesome, hook me up!

> --
> You received this message because you are subscribed to the Google Groups "GRPUG: Grand Rapids Python Users Group" group.
> To post to this group, send email to gr...@googlegroups.com.
> To unsubscribe from this group, send email to grpug+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/grpug?hl=en.
>
>

--

Jeff Quast

unread,
May 1, 2011, 3:03:45 PM5/1/11
to mich...@googlegroups.com, GRPUG: Grand Rapids Python Users Group
On Wed, Apr 27, 2011 at 11:02 AM, Ben Rousch <bro...@gmail.com> wrote:
> Before I dive head-first into my next little project, has anyone used
> Python to work with COM on Windows?
>
> I'll be attempting to use Python 2.7 and the Python Windows Extensions
> to extract data from Autodesk Inventor. In theory it works, and
> there's even some half-finished help pages on the Autodesk wiki.
>
> Any tips or sanity checks?
>
> I'm sure a nice presentation for GRPUG will come out of this no matter
> how it ends up.
>
> P.S. My fallback is to use the VBA embedded in Inventor, so I'm pretty
> motivated to make Python work here.

I worked with win32 COM a lot many years ago to for lotus notes,
excel, and a few miscellaneous things -- It worked great, with
pywin32, the instructions for COM activities are the same as any other
language, so any documentation will do at that point.

If I had to do COM again I'd still prefer python, it brings a lot of
sanity, and having an interactive session and using dir() to inspect
com objects returned is very valuable. Seemed COM activities are very
limited, though, when I had to get more aggressive in automation in
windows I ended up using WMI, MFC, CBT hooks, or just win32 api in C.
I always tried to avoid the then-upcoming visual C++ and .NET
interfaces, so COM is usually the 2nd place I look.

CBT hooks were the strangest, only available in C though, but very
helpful for prodding and poking remote win32 applications:
http://msdn.microsoft.com/en-us/library/ms644977(v=vs.85).aspx

Reply all
Reply to author
Forward
0 new messages