Using Python with Design Assistant

Using Python with Design Assistant

Anonymous
Not applicable
1,023 Views
4 Replies
Message 1 of 5

Using Python with Design Assistant

Anonymous
Not applicable

I've written an application for my department with python and I've got a problem. The application is supposed to copy and save files, but without Inventor's native copy methods the links between the ipt and idw are being broken. Does anyone know if it is possible to access the design assistant with python code so this copy/save is handled automatically --depending on some user input, of course?

 

Thanks,

Brandon

0 Likes
1,024 Views
4 Replies
Replies (4)
Message 2 of 5

MechMachineMan
Advisor
Advisor
Hmmm. You're aware that inventors file referencing system works fully on the filenames of any referenced document, and thus, when you use design assistant to change the file name, it is actually just changing the file that that document is being referenced in, right?

Furthermore, it only really works in the active project.

To make a copy and save work properly, you need to go through with your program, save the file names that are referenced, and replace them with your new file names after the newly named document is created/renamed from the original.

Everything inventor does natively to save copies of documents and retains links involves something behind the scenes like I just explained.

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 5

Anonymous
Not applicable
Thank you for your response. My program saves a copy of an ipt/idw in a separate location, then renames each file (same name with a different extension). When the files are opened, the user is prompted to resolve the broken link between the two files due to the name change. This is what I'm trying to avoid. I know there is code out there that can update references I'm just not sure how to go about it using python.
0 Likes
Message 4 of 5

rjay75
Collaborator
Collaborator

Never used Python with Inventor but you know how to reference a COM application (or .NET) with Python. If so after you copy and rename your files you need to go through the assembly and replace any references to those files with the new file name locations. If you just copy the files internally the references are full paths to the original file names.

 

So if you copy and rename all the files and open one of them if they reference another file the it will be a reference to the original file name.

 

Attached is a VBA application I wrote to mimic the copy design process from within Inventor. You can look at the source to see how it was done.

 

0 Likes
Message 5 of 5

Anonymous
Not applicable

Unfortunately, I do not know how to operate with COM. It seems like that would really help me out, but I'm finding it difficult to locate documentation that can explain this to me in pythonic terms. Thank you for the example application. I can clearly see what needs to be done... I just need to learn how it can be done in python.

 

Thanks for your help

0 Likes