Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

API Call woodwork application Python (WW4I)

cavallerin
Explorer

API Call woodwork application Python (WW4I)

cavallerin
Explorer
Explorer

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
0 Likes
Reply
Accepted solutions (1)
223 Views
5 Replies
Replies (5)

Michael.Navara
Advisor
Advisor
Accepted solution

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.

 

0 Likes

cavallerin
Explorer
Explorer

Ok thx a lot it worked, but to get the WW4I object I use this calling:

 

 

 

ww = inv.ApplicationAddIns.Item(49).Automation

 

 

 
where 49 is the progressive number of the addin in my system.
Maybe I'm wrong, but does Inventor use internal Id(s) to identify this objects? Is there a way to get it?
 
 
 
0 Likes

Michael.Navara
Advisor
Advisor

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.

cavallerin
Explorer
Explorer

{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?

 

0 Likes

Michael.Navara
Advisor
Advisor

It means this ClientId is the same for all versions of WW. It should be stable for future versions.