- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How can I create an instance for woodwork 4 inventor addin inside a python script?
import win32com.client as wc
# istanzio l'applicazione di inventor
try:
inv = wc.GetActiveObject('Inventor.Application')
ww = inv.woodworkApplication
except:
inv = wc.Dispatch('Inventor.Application')
inv.Visible = True
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @cavallerin
Woodwork is an add-in for Inventor, not built-in component.
All you can try is to get its Automation property and look, if it provides any API functions. Unfortunately this property usually returns NULL or some unknown object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Ok thx a lot it worked, but to get the WW4I object I use this calling:
ww = inv.ApplicationAddIns.Item(49).Automation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
If number 49 works now, you can obtain its ClientId and use it instead of this index. This Client id is persistent for whole lifecycle of the addin.
ww4iClientId=inv.ApplicationAddins.Item(49).ClientId
ww = inv.ApplicationAddIns.ItemById(ww4iClientId).Automation
# Or
ww = inv.ApplicationAddIns.ItemById('WW4I-CLIENTID-GUID-HERE').Automation
Sorry I'm not familiar with python. Excuse me if there are some syntax error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
{FEF38B5F-CACF-4647-8EE5-1F642F03C610}
got it!
But what do you mean by "This Client id is persistent for whole lifecycle of the addin." ?
A colleague of mine can set the same UUID?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
It means this ClientId is the same for all versions of WW. It should be stable for future versions.