Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create Rigid Joint in Assembly

6 REPLIES 6
Reply
Message 1 of 7
LukeDavenport
1069 Views, 6 Replies

Create Rigid Joint in Assembly

 


Hi,

I'm trying to create a rigid joint between two faces on two occurrences, using the centre point of each face. I understand you need a GeometryIntent object for each face, and the 'Intent' parameter specifies the position on the face - however I've tried using a Point object (and also a Point2D object) for the 'Intent' parameter with no success - it errors out on the CreateAssemblyJointDefinition.

In the code below - I've already got 2 FaceProxy objects, and a Point object on the centre of each face.

Can anyone point me in the right direction?

I know that joints are new in Inventor 2014, but it would probably be useful to have another example or two in the API help if possible.

Many thanks


' Note - oPoint1 and oPoint2 are the Point objects (X Y Z in assembly coordinates)

'
Create an intent to the center of Face1proxy
Dim oFaceProxy1Intent As GeometryIntent oFaceProxy1Intent = oDef.CreateGeometryIntent(oFaceProxy1, oPoint1) ' Create an intent to the center of Face2proxy
Dim oFaceProxy2Intent As GeometryIntent oFaceProxy2Intent = oDef.CreateGeometryIntent(oFaceProxy2, oPoint2) ' Create two intents to define the geometry for the connection.

Dim intentOne As GeometryIntent intentOne = oDef.CreateGeometryIntent(oFaceProxy1, oFaceProxy1Intent) Dim intentTwo As GeometryIntent intentTwo = oDef.CreateGeometryIntent(oFaceProxy2, oFaceProxy2Intent) ' 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 = False Dim Joint As AssemblyJoint Joint = oDef.Connections.Add(jointDef) ' Make the joint visible.

Joint.Visible = True
 
6 REPLIES 6
Message 2 of 7

 

Can anyone point me in the right direction for this? I'm sure this must be a fairly common requirement - a rigid joint between the centre of two faces....

 

Many thanks for your attention.

Message 3 of 7
t_stramr
in reply to: LukeDavenport

Hi Luke,

 

Could you attach your datatset so I can investigate your issue? Just attach ZIP file that includes assembly and all necessary part files as you show on attached pictures. If you have also video it would be great to attach it as well.

 

Thanks,

Robert

Message 4 of 7
LukeDavenport
in reply to: t_stramr

Hi Robert,

Thanks for the reply. Zipped folder attached. Contains the assembly, and a 30 second video.

 

The iLogic rule to create the rigid joint is already in the assembly file.

 

Many thanks,
Luke

 

 

Message 5 of 7
t_stramr
in reply to: LukeDavenport

Excellent.

I will contact you back with my findings over end of this week.

 

Thanks,

Robert

Message 6 of 7
philippe.leefsma
in reply to: t_stramr

Let's see what Robert finds, but here is a sample based on another dataset, it should be rather straightforward for you to get it working with your assembly:

 

' This sample demonstrates creating an assembly connection.  It connects the
' centers of two faces using a rigid connection.  The part SamplePart.ipt must
' be used because the sample assumes there are iMates in the part which it
' used to find specific geometry.
Public Sub AssemblyConnect()
    ' Create a new assembly document.
    Dim asmDoc As AssemblyDocument
    Set asmDoc = ThisApplication.Documents.Add(kAssemblyDocumentObject, _
                  ThisApplication.FileManager.GetTemplateFile(kAssemblyDocumentObject))
    Dim asmDef As AssemblyComponentDefinition
    Set asmDef = asmDoc.ComponentDefinition
    
    ' Place an occurrence into the assembly.
    Dim occ1 As ComponentOccurrence
    Dim occ2 As ComponentOccurrence
    Dim trans As Matrix
    Set trans = ThisApplication.TransientGeometry.CreateMatrix
    Set occ1 = asmDef.Occurrences.Add("C:\Users\ekinsb\Documents\Presentations\AU 2012\Inventor 2014\SamplePart.ipt", trans)
    
    ' Place a second occurrence with the matrix adjusted so it fits correctly with the first occurrence.
    trans.Cell(1, 4) = 6 * 2.54
    Set occ2 = asmDef.Occurrences.Add("C:\Users\ekinsb\Documents\Presentations\AU 2012\Inventor 2014\SamplePart.ipt", trans)
    
    ' Get Face 6 from occ1 and create a FaceProxy.
    Dim face1 As Face
    Set face1 = GetNamedEntity(occ1, "Face6")
    Dim face2 As Face
    Set face2 = GetNamedEntity(occ2, "Face7")
    
    ' Create two intents to define the geometry for the connection.
    Dim intentOne As GeometryIntent
    Set intentOne = asmDef.CreateGeometryIntent(face1, PointIntentEnum.kPlanarFaceCenterPointIntent)
    Dim intentTwo As GeometryIntent
    Set intentTwo = asmDef.CreateGeometryIntent(face2, PointIntentEnum.kPlanarFaceCenterPointIntent)

    ' Create a rigid connection between the two parts.
    Dim connectDef As AssemblyConnectionDefinition
    Set connectDef = asmDef.Connections.CreateAssemblyConnectionDefinition(kRigidConnectionType, intentOne, intentTwo)
    connectDef.FlipAlignmentDirection = False
    connectDef.FlipOriginDirection = True
    Dim connect As AssemblyConnection
    Set connect = asmDef.Connections.Add(connectDef)
    
    ' Make the connection visible.
    connect.Visible = True
End Sub

' This finds the entity associated with an iMate of a specified name.  This
' allows iMates to be used as a generic naming mechansim.
Private Function GetNamedEntity(Occurrence As ComponentOccurrence, Name As String) As Object
    ' Look for the iMate that has the specified name in the referenced file.
    Dim iMate As iMateDefinition
    Dim partDef As PartComponentDefinition
    Set partDef = Occurrence.Definition
    For Each iMate In partDef.iMateDefinitions
        ' Check to see if this iMate has the correct name.
        If UCase(iMate.Name) = UCase(Name) Then
            ' Get the geometry assocated with the iMate.
            Dim entity As Object
            Set entity = iMate.entity
            
            ' Create a proxy.
            Dim resultEntity As Object
            Set resultEntity = Nothing
            Call Occurrence.CreateGeometryProxy(entity, resultEntity)
            
            Exit For
        End If
    Next
    
    ' Return the found entity, or Nothing if a match wasn't found.
    Set GetNamedEntity = resultEntity
End Function

Regards,

Philippe.

 



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 7 of 7
t_stramr
in reply to: philippe.leefsma

Philippe already gave you requested answer. This is an example from joint API tutorial that places joint origins at center of planar face.

 

Let's take a look closer.

As you can see in Joint command when executed from UI, Inventor allows you to define joint origin on planar face only at limited set of points. Supported are:

 

• Linear edge or sketch line on which the start/mid/end point can be specified as origin. The direction of the linear object defines the origin direction.
• Circular/elliptical edge or sketch entity which the center will be used as origin. The normal of the object defines the origin direction.
• Cylindrical/conical/elliptical-cylindrical face which the start/mid/end point on the axis of the face can be specified as origin. The axis of the face defines the origin direction.
• Toroidal/spherical face which the center will be used as origin. The axis of the toroidal face defines the origin direction.
• Planar face that has linear/circular/elliptical edges which the start/mid/end point of linear edge or center of circular/elliptical edge can be specified as origin. The normal of the planar face defines the origin direction.

 

Each of these supported points is constrained to the geometry that the point belongs to. For example edge mid point preserves its position in the mid of the edge curve even if edge changes its size.

This is the reason why you can't specify an arbitrary point as geometry intent. The origin point can't be defined by exact coordinates ignoring internal constraints to jointed geometry.

 

Here are supported values for object of PointIntentEnum type:

 

kAxisStartPointIntent
kAxisMidPointIntent
kAxisEndPointIntent
kPlanarFaceCenterPointIntent

 

If you have more questions feel free to ask.

 

Robert

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report