Programmatically identify frame generator control geometry

Programmatically identify frame generator control geometry

ciofi
Explorer Explorer
418 Views
1 Reply
Message 1 of 2

Programmatically identify frame generator control geometry

ciofi
Explorer
Explorer

We need programmatically identify the control geometry of a frame generator subassembly.

 

We correctly identified framedoc,skeletondoc and framememberdoc like mentioned here:

 

https://forums.autodesk.com/t5/inventor-customization/determine-subassembly-generated-by-framegenera...  

 

but we can't find a way to identify the control geometry document....... is there a way to do this ?

 

Thanks in advance

0 Likes
419 Views
1 Reply
Reply (1)
Message 2 of 2

YuhanZhang
Autodesk
Autodesk

Here is a VBA sample to do this:

 

Sub GetFrameInfo()
    Dim oDoc As AssemblyDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oAtts As AttributesEnumerator
    Set oAtts = oDoc.AttributeManager.FindAttributes
    
    ' Get the MasterFrameOcc
    Dim oMasterFrameOcc As ComponentOccurrence, oCol As ObjectCollection
    Set oCol = oDoc.AttributeManager.FindObjects(, "Type", "MasterFrameOcc")
    Set oMasterFrameOcc = oCol.Item(1)
    Debug.Print "Frame occurrence: " & oMasterFrameOcc.Name
    
    ' Get the custom constraint added between the frame control geometry and frame document geometry
    Dim oFrameConstraint As CustomConstraint
    Set oCol = oDoc.AttributeManager.FindObjects(, "com.autodesk.FG.CustomConstraint.Name", "com.autodesk.FG.FrameGenerator")
    Set oFrameConstraint = oCol.Item(1)
    
    Dim oTempOccu As ComponentOccurrence, oControlOccu As ComponentOccurrence
    Set oControlOccu = oFrameConstraint.OccurrenceOne
    If oControlOccu Is oMasterFrameOcc Then
        Set oControlOccu = oFrameConstraint.OccurrenceTwo
    End If
    Debug.Print "Control occurrence: " & oControlOccu.Name
End Sub

Hope it helps.

 



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes