Hi this is to inform Autodesk of a possible glitch/bug in the joint creation API. To explain:
Normal UI behaviour: If I create a rigid joint between 2 faces, and then move or twist either of the faces in any direction, the joint remains rigid and intact.
Apparent API behaviour: A programmatically created rigid joint will remain intact for some movements (turning/translating the face) but not for others (twisting/rotating the face).
I would assume that the behaviour of an API created rigid joint should be the same as a normal UI created joint.
This is an important part of a large customer project we are currently working on. I'll be very happy to provide a dataset/video explaining the problem further as required.
Many thanks,
Luke
ps. Heres the function that creates the rigid joint. This works fine - the problem occurs later when a joint face is moved.
Public Sub AssemblyJoint(face1 As Face, face2 As Face, seljoint1compocc As ComponentOccurrence, seljoint2compocc As ComponentOccurrence)
' create a FaceProxy.
Dim AsmDef As AssemblyComponentDefinition
AsmDef = inventorapp.ActiveDocument.ComponentDefinition
Try
' create a FaceProxy.
Dim face3 As FaceProxy
Dim face4 As FaceProxy
seljoint1compocc.CreateGeometryProxy(face1, face3)
seljoint2compocc.CreateGeometryProxy(face2, face4)
Dim face1Intent As GeometryIntent = AsmDef.CreateGeometryIntent(face3, PointIntentEnum.kPlanarFaceCenterPointIntent)
Dim face2Intent As GeometryIntent = AsmDef.CreateGeometryIntent(face4, PointIntentEnum.kPlanarFaceCenterPointIntent)
Dim intentOne As GeometryIntent = face1Intent
Dim intentTwo As GeometryIntent = face2Intent
Dim jointDef As AssemblyJointDefinition = AsmDef.Joints.CreateAssemblyJointDefinition(AssemblyJointTypeEnum.kRigidJointType, intentTwo, intentOne)
' jointDef.FlipAlignmentDirection = False
jointDef.FlipOriginDirection = True
Dim joint As AssemblyJoint = AsmDef.Joints.Add(jointDef)
' Make the joint visible.
joint.Visible = True
joint1Label.Text = ""
joint1partlab.Text = ""
joint2Label.Text = ""
joint2partlab.Text = ""
Catch ex As Exception
End Try
End Sub
Hi - can someone from Autodesk please respond to this thread?
Please see attached pics - they show:
1) Rigid joint that has been created with the user interface - the two faces align as expected.
2) Rigid joint that has been created with the API (iLogic rule) - The two faces do not align as expected.
I also have a very quick 30 second video showing this - that I will be happy to provide. The code below can also be pasted straight into an iLogic rule to test this on any two parts in an assembly.
Can anyone explain this difference between UI and API or confirm that this is a bug please.
Many thanks,
Luke
Imports AssemblyJointTypeEnum Imports Inventor.SelectionFilterEnum 'Make a ref to active docDim doc As AssemblyDocument = ThisApplication.ActiveDocument Dim oDef As AssemblyComponentDefinition = doc.ComponentDefinition ' Set a reference to the transient geometry collection.Dim oTransGeom As TransientGeometry = ThisApplication.TransientGeometry Dim oObj As Object Dim oObj2 As Object Dim oSSet As SelectSet oSSet = doc.SelectSet ' Set selection filter to part planar faces onlyDim oFilter As SelectionFilterEnum oFilter = kPartFacePlanarFilter ' Get a object selection from the user (Face)
oObj = ThisApplication.CommandManager.Pick(oFilter, "Pick Face 1 For Joint") oObj2 = ThisApplication.CommandManager.Pick(oFilter, "Pick Face 2 For Joint") If Not (TypeOf oObj Is FaceProxy) Then MessageBox.Show("Error!", "Title") Exit Sub End If Dim oFaceProxy1 As FaceProxy oFaceProxy1 = oObj If Not (TypeOf oObj Is FaceProxy) Then MessageBox.Show("Please select 2 faces...", "Title") Exit Sub End If Dim oFaceProxy2 As FaceProxy oFaceProxy2 = oObj2 Dim face1Intent As GeometryIntent = oDef.CreateGeometryIntent(oFaceProxy1, PointIntentEnum.kPlanarFaceCenterPointIntent) Dim face2Intent As GeometryIntent = oDef.CreateGeometryIntent(oFaceProxy2, PointIntentEnum.kPlanarFaceCenterPointIntent)
' Create two intents to define the geometry for the connection.
Dim intentOne As GeometryIntent intentOne = face1Intent Dim intentTwo As GeometryIntent intentTwo = face2Intent ' Create a rigid jont between the two parts.Dim jointDef As AssemblyJointDefinition jointDef = oDef.Joints.CreateAssemblyJointDefinition(AssemblyJointTypeEnum.kRigidJointType, intentOne, intentTwo) jointDef.FlipAlignmentDirection = False jointDef.FlipOriginDirection = True Dim oEdge1 As Edge = oFaceProxy1.Edges.Item(1) Dim oEdge2 As Edge = oFaceProxy2.Edges.Item(1) Dim Joint As AssemblyJoint Joint = oDef.Joints.Add(jointDef) ' Make the joint visible.Joint.Visible = True
Hi Luke,
Yes, I would like to see a video showing all the steps.
Also, I'm wondering why you have 4 parts in the assembly instead of just 2.
Is it necessary in order to reproduce the behaviour?
It could also be useful to attach all the sample documents you are using.
Thank you,
Hi Adam,
Thanks for the reply - please refer to this thread - I believe another Autodesk employee is looking at this now for us.
Thanks,
Luke