Using code export the components from an IAM (Assembly) file and Preserve positional

Using code export the components from an IAM (Assembly) file and Preserve positional

qiulfVZV72
Explorer Explorer
292 Views
10 Replies
Message 1 of 11

Using code export the components from an IAM (Assembly) file and Preserve positional

qiulfVZV72
Explorer
Explorer
Using code in Autodesk Inventor, export the components from an IAM (Assembly) file, generate derivatives while preserving the assembly relationships of the components within the IAM.
The exported derivatives should allow for the reconstruction of the assembly relationships when imported into a new assembly.
Key :
  1. Export components as derivatives (ipt files)
  2. Preserve positional and constraint-based relationships
  3. Enable reconstruction of the assembly position in new contexts
0 Likes
293 Views
10 Replies
Replies (10)
Message 2 of 11

CGBenner
Community Manager
Community Manager

@qiulfVZV72 

Hello, and welcome to the forum.  Are you asking if this is possible, or do you need help developing the code?  Have you started anything on your own that you could share with the experts here?

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!


Chris Benner
Community Manager

0 Likes
Message 3 of 11

qiulfVZV72
Explorer
Explorer

We tried to use VBA to export derivatives.
It extracted all components from the hierarchical directory, and we could export the derivatives by checking them in a table.
However, the exported derivatives lack positional information and need to be reassembled.

0 Likes
Message 4 of 11

qiulfVZV72
Explorer
Explorer

We hope to get suggestions on code development in this regard.

0 Likes
Message 5 of 11

qiulfVZV72
Explorer
Explorer

You can see the VBA script.

0 Likes
Message 6 of 11

qiulfVZV72
Explorer
Explorer

You can forword the VBA_script.

0 Likes
Message 7 of 11

qiulfVZV72
Explorer
Explorer
How can i using code in Autodesk Inventor to export the components from an IAM (Assembly) file, generate Derived Part while preserving the assembly relationships of the components within the IAM?
 
The exported derivatives should allow for the reconstruction of the assembly relationships when imported into a new assembly.
Key :
  1. Export components as derivatives (ipt files)
  2. Preserve positional and constraint-based relationships
  3. Enable reconstruction of the assembly position in new contexts
0 Likes
Message 8 of 11

qiulfVZV72
Explorer
Explorer

The `CreateUniformScaleDef` operation fails when applied to `DerivedPartComponents`.

0 Likes
Message 9 of 11

CGBenner
Community Manager
Community Manager

@WCrihfield @JelteDeJong or any other geniuses in this forum... any ideas on this one?

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!


Chris Benner
Community Manager

0 Likes
Message 10 of 11

WCrihfield
Mentor
Mentor

I am not sure I would be much help with this type of project.  I have never done anything like that before, manually or by code, because I never wanted or needed to.  Some of what is being asked for does not even sound possible to me, but I could be wrong.

A part file can not store assembly level constraint related information that would simply 'reconnect' the moment it is dropped back onto some other similar assembly, as far as I know.  The closest thing that comes to mind is 'iMates', but I never really got into those that much, due to the way we do things were I work.  The next thing that comes to mind is the 'common origin' technique, where each components location & orientation, in reference to its parent assembly's origin work features, is recorded back down into the part, one way or another.  Then when the part is placed into another assembly, it is positioned & oriented within its parent assembly using that 'common origin' data that was stored in the part (not constraint data).  Sort of like when starting from a multi-body part file, then selecting the bodies within that part and using either 'MakePart' or 'MakeComopnents' commands to create a new part file(s) for each body, which only includes that one body, then create a new assembly, then put all of them into it, constrained origin to origin.  They will all still be in the same locations & orientations from their own origin, as when in the original part, so we can constrain the origin's of each component to the assembly's origin to put them all back together the same way they were in the original part.  No faces, edges, or vertices involved in any of the assembly constraints, just origin work feature to origin work feature.  I never use that process myself, but that is one scenario that comes to mind to preserve location and orientation for assembly level purposes.

Plus, I pretty much never create/manage 'derive' related stuff by code...just manually, and not for the purposes being discussed here.  So, I'm sure there must be others here who would have more insights or experience with the steps involved in this type of overall process.  Maybe saving the assembly, and its components, as templates would help.  Then, when you need other variations of the main assembly, or any of its components, just generate them using the 'New' command, then modify them as needed, then save them to files.  With the same source documents (ancestry) each time, that should help preserve constraints when replacing one with another, and avoid the need for all the derived copies, and attempts at recording assembly level constraint related information down at the part level, which is usually not a good idea.

Plus, I stopped using VBA macros years ago, shortly after hearing that it is no longer being maintained/updated by its developers (Microsoft), making it a security risk for my company.  I do all of my Inventor automations through iLogic rules now.

If someone else here could confirm that what is being asked for is actually possible, and could explain each step involved in as much detail as possible about how it could be done manually, then I may be able to 'help' with (not completely develop) the code required for accomplishing similar results.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 11 of 11

CGBenner
Community Manager
Community Manager

@qiulfVZV72 

 

Hello, Did the information provided answer your question? If so, please use Accept Solution so that others may find this in the future. Thank you very much!

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!


Chris Benner
Community Manager

0 Likes