Export/Import Relations from/in Inventor main assembly with iLogic or VBA

Export/Import Relations from/in Inventor main assembly with iLogic or VBA

Anonymous
Not applicable
773 Views
5 Replies
Message 1 of 6

Export/Import Relations from/in Inventor main assembly with iLogic or VBA

Anonymous
Not applicable

Hi, maybe my question is too hard, but I try: do you know a iLogic/VBA code (written by anyone) that, if run:

 

  1. reads/analyzes all the existing relations/constraints among parts and subassemblies in the main assembly;
  2. save all these relations/constraints (with info about which parts/subass are constrained) in an external file (maybe easly readable by human users), for example a txt file (this file should contain at least the name of the two entities that are in relationship, the type of relationship, the specific parameters of the relationship);
  3. can import the relations/constraints included in the file inside a STEP that is the main assembly exported as STEP, so with the loss of all the constraints?

My question is to facilitate the exchange of projects between various platforms without loss of constraints.

Has anyone ever tried to do something like that? Would it be theoretically possible with current Inventor API (iLogic or VBA)?

 

PS: Inventor 2018 Professional

0 Likes
Accepted solutions (2)
774 Views
5 Replies
Replies (5)
Message 2 of 6

philip1009
Advisor
Advisor
Accepted solution

The method for accessing the list of Constraints in an Assembly is:

oCons = ThisDoc.Document.ComponentDefinition.Constraints

 

Then with a loop you can go through each Constraint and all of it's properties:

For Each oCon As AssemblyConstraint In oCons

 

Then you'll probably have to have an If statement for every constraint type depending on all of the information you're looking to get.  You can open the API guide from Inventor to see what methods can be used for iLogic/Add-Ins.

 

Open API guide.Open API guide.API guide sample.API guide sample.

Message 3 of 6

Anonymous
Not applicable

Hi @philip1009, thank you for info about that, but really I don't want to write a code for that (it would take me too much time, maybe when I will have more free time), I ask if something like that already exists.

 

Purpose is to be able to open with version Y of Inventor any assembly created with version X of Inventor (with Y < X) without loss of constraints/relations among parts/subassemblies. For now it is impossible to open a Inventor 2018 assembly with Inventor 2016 for example, the only way is to create a STEP (I prefer it rather than IGES or others formats) and to import the step with the old Inventor version, but with full loss of constraints (the thing is frustrating and not very useful if more people works on a single project using different versions of Inventor).

 

So I don't want to write something new, just to know if there is something already done by others (and possibly free). I wait for other replies, if there will be, and then I will decide how to proceed.

 

Thanks

Regards

 

0 Likes
Message 4 of 6

philip1009
Advisor
Advisor

Okay, then that function doesn't exist, it is an annoying con that Inventor can't possibly save to previous versions like AutoCAD and other software, granted that's because Inventor is much more complicated than 2D lines.  However it is possible for Inventor 2017 and newer to open files from future Inventor software, although I haven't tested the extent of that feature yet.

Message 5 of 6

BrianEkins
Mentor
Mentor
Accepted solution

It is theoretically possible to write a program that will do what you described, plus a lot more, like copying the iProperties and colors.  However, I'm not aware of any existing programs that do it.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 6 of 6

Anonymous
Not applicable

Hi @philip1009 and @BrianEkins, thank you for reply. I consider the answer to be definitive: no existing iLogic/VBA program that exports/imports Inventor constraints/relations among parts and subassemblies.

 

Regards

0 Likes