Python and Autodesk Inventor

32 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/

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