How to record constraits from one assembly and use them in another

How to record constraits from one assembly and use them in another

jaka73LU2
Participant Participant
688 Views
5 Replies
Message 1 of 6

How to record constraits from one assembly and use them in another

jaka73LU2
Participant
Participant

Hi,

 

I am trying to build modular assemblys. I have an idea of how to do it, but I don't even know if it is possible.

 

I have a standard part that is always present in final assembly and i have optional parts that get in assembly sometimes. I would like to have a program that would open up optional parts and automaticly make constraits with the standard part.

 

Somehow I was thinking the program would remember specific faces and assosiated constraints and would link up automaticly.

 

Normaly if you link two parts with each other in one assembly this link does not carry over to a new assembly if you import those same parts individualy.

 

I am trying to make inventor remember this links from one assembly and carry them over to another assembly. This link data would probably have to be written in a external file.

 

Could some one tell me if this is posible and if soo, point me in the right direction.

0 Likes
689 Views
5 Replies
Replies (5)
Message 2 of 6

Curtis_W
Consultant
Consultant

Hi @jaka73LU2 

 

Welcome to the forum.

 

I think you can accomplish what you are wanting to do with iLogic. 

 

  • First create the assembly constraints manually.
  • Then create a new iLogic rule.
  • Next locate the secondary part in the Model tree in the Ruler Editor
  • Right click on main part and choose Capture Current State (Components Constraints.Add)
  • Observe the code created for you:
    • this code adds the component to the assembly
    • this code re-creates all the constraints found on that part.

 

Now you can use this code in a rule in another assembly configuration that contains only the primary component, as long as:

  • The component names match 
  • The geometry of the components is the same.

In my example image, Part1 is the primary component and Part2 is a secondary component. 

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Curtis_Waguespack_0-1654263873014.png

 

 

 

EESignature

0 Likes
Message 3 of 6

jaka73LU2
Participant
Participant

Tanks for fast reply,

 

Would this work also in an Addin?

 

I am trying to automate this proces accros multiple computers and like I said, I would need to read files outside of inventor.

So is this possible with the inventor API in VB.net?

 

It would be realy convenient if there was a an API method that would do that.

0 Likes
Message 4 of 6

Curtis_W
Consultant
Consultant

Hi @jaka73LU2 

 

No unfortunately the previous information only pertains to iLogic. I'm not aware of a n API method or any API example to extract the constraint information from the assembly in the same way, but I suppose it could be written.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 5 of 6

jaka73LU2
Participant
Participant

Ok, so my question would be, is it possible to do this same thing, with the API?

 

I would assume I would be something like getting the constraints of top level objects and record there constraint faces?

 

Could you point me in the right dirrection?

0 Likes
Message 6 of 6

jaka73LU2
Participant
Participant

I am able to find the constraints of a component in the assembly throu

 

Dim oAsmDef As AssemblyComponentDefinition = g_assemblyDoc.ComponentDefinition
Dim oConstrs As AssemblyConstraints = oAsmDef.Constraints

 

Dim oConstraints As AssemblyConstraints = oAsmDef.Constraints
Dim oConstraint As AssemblyConstraint = oConstraints.Item(1).Name

 

But I cant get the assosiated faces that define where the constraint holds two piaces.

 

 

 

0 Likes