Constrain two Vertexs in assembly

Constrain two Vertexs in assembly

johnster100
Collaborator Collaborator
638 Views
3 Replies
Message 1 of 4

Constrain two Vertexs in assembly

johnster100
Collaborator
Collaborator

Hi,

I am trying to constrain two edges together. My first constraint takes the two edges and and mates them. This works fine.

 

I then try to constrain the end of the edges together using the StopVertex and StartVertex as the points for mating:

 

Dim oVertex1 As Inventor.VertexProxy
Dim oVertex2 As Inventor.VertexProxy
oVertex1 = oEdge1.StopVertex
oVertex2 = oEdge2.StartVertex

oAssyCompDef.Constraints.AddMateConstraint(oVertex1, oVertex2, 0)

 

 

oEdge1 and oEdge2 are edge proxies and behave as normal when I mate them.

 

The code always crashes inventor on the 'addmateconstraint' when I try to mate the vertexProxies

 

Any ideas what I'm doing wrong?

 

thanks,

John

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

JaneFan
Autodesk
Autodesk
Accepted solution

Hey John, 

 

I don't see anything you did wrong. I performed the steps you described with local model and the constraint can be created successfully:

Create a mate constraint with two edge proxies, then create another mate constraint with the vertex proxies: 

Dim topAssy As AssemblyDocument
Set topAssy = ThisApplication.ActiveDocument

Dim oE1 As EdgeProxy
Dim oE2 As EdgeProxy
Set oE1 = topAssy.SelectSet(1)
Set oE2 = topAssy.SelectSet(2)

Call topAssy.ComponentDefinition.Constraints.AddMateConstraint(oE1, oE2, 0)
Call topAssy.ComponentDefinition.Constraints.AddMateConstraint(oE1.StartVertex, oE2.StopVertex, 0)

 

What version of inventor you are using? Would you please try the same steps with creating mate constraint with two simple blocks? 

 

 




Jane Fan
Inventor/Fusion QA Engineer
0 Likes
Message 3 of 4

johnster100
Collaborator
Collaborator

thanks,

that worked.

 

I had a changed a parameter in the model and this was causing the crash during the constraint operation

0 Likes
Message 4 of 4

JaneFan
Autodesk
Autodesk

Hey Jon, 

 

Glad it worked. It would be very helpful if you could send crash report with steps if you met it again. Thank you. 




Jane Fan
Inventor/Fusion QA Engineer
0 Likes