Exportparameter for JT in Pyton

Exportparameter for JT in Pyton

Anonymous
Not applicable
631 Views
2 Replies
Message 1 of 3

Exportparameter for JT in Pyton

Anonymous
Not applicable

Hello.

I've coded a Python script to export a list of assemblies as JT files. It works fine.

The export command is, after defining the outputfilename

 

oDoc.SaveAs(OUTPUT_PATH, True)

 

The problem is that it create a JT file in version 7.0 and only monolitic.

From the VBA Version I found the possibility to pass options to the SaveCopyAs command.

oContext = invApp.TransientObjects.CreateTranslationContext()
oOptions = invApp.TransientObjects.CreateNameValueMap()
oOptions = oDoc.SaveCopyAs(oDoc, oContext, oOptions, OUTPUT_PATH)

 

My problem are first the SaveCopyAs command seems not working through win32com.

Second I didn't figure out how to pass the options (as list, as dictionary). That's probably the reason why it doesn't work.

 

0 Likes
Accepted solutions (1)
632 Views
2 Replies
Replies (2)
Message 2 of 3

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@Anonymous,

 

Hoping that solution in below forum discussion would be helpful.

 

https://forums.autodesk.com/t5/inventor-customization/converting-vba-script-into-python-comtypes-script/m-p/7518372

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 3 of 3

Anonymous
Not applicable

Thank you @chandra.shekar.g

I found the discussion before I've posted my question. It didn't help. If I copy&paste the script it doesn't work. It can't create the options value map. So when printing it I get the error.

 
Exception has occurred: AttributeError
CreateNameValueMap.Set
File "X:\programmier\python\inventor\step.py", line 43, in <module> print(Options.Set)
 

That's why I asked this question.

 

0 Likes