Access CATIA V5 with win32com (LONG)

G

goermezer

Hello,

I got it ! There was an example (for Office I think) in the test-directory of
Pywin32, where I have the first lines from. But this is dynamic binding. Can
anybody explain this for early binding ?

And it would be fine when the pulldown-menu in Pythonwin works to see the
exposed Methods of the Type Libraries.
-----------------------------------------------------------

import win32com.client

dispatch = win32com.client.dynamic._GetGoodDispatch("CATIA.Application")
typeinfo = dispatch.GetTypeInfo()
attr = typeinfo.GetTypeAttr()
olerepr = win32com.client.build.DispatchItem(typeinfo, attr, None, 0)
catia = win32com.client.dynamic.CDispatch(dispatch, olerepr)
dispatch = typeinfo = attr = olerepr = None

doc = catia.ActiveDocument.Product
print "------------------"
print "Number : Partname:"
print "------------------"
count = catia.ActiveDocument.Product.Products.Count
for partnum in range(count):
print "Part", partnum + 1, ":",
catia.ActiveDocument.Product.Products.Item(partnum+1).Name
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top