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

API Call woodwork application Python (WW4I)

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
Tags (1)
Labels (1)
Michael.Navara
in reply to: cavallerin

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.

 

cavallerin
in reply to: cavallerin

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?
 
 
 
Michael.Navara
in reply to: cavallerin

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
in reply to: Michael.Navara

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

 

Michael.Navara
in reply to: cavallerin

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