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: 

iLogic code to change the flat pattern orientation.

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
ro01
1535 Views, 2 Replies

iLogic code to change the flat pattern orientation.

Is there a way to switch the flat pattern orientation using ilogic. Or is there a way to flip the Base face back and forth on a part, but setting up custom orientations and being able to switch between them using ilogic would be nice.

2 REPLIES 2
Message 2 of 3
ro01
in reply to: ro01

I have done this in an iPart, but I don't know what the variable would be in iLogic.

Message 3 of 3
philippe.leefsma
in reply to: ro01

There is no difference between using the API in VBA or from iLogic, you can take a look at the API Help files, multiple VBA samples are available there.

 

The FlatPattern.FlipBaseFace method seems to provide what you are looking for.

 

The following sample illustrates how to rotate the flat pattern, that feature was introduced in 2014:

 

Public Sub SheetMetalOrientFlat()

    Dim partDoc As PartDocument
    Set partDoc = ThisApplication.ActiveDocument
    
    Dim smDef As SheetMetalComponentDefinition
    Set smDef = partDoc.ComponentDefinition
    
    If Not smDef.HasFlatPattern Then
        smDef.Unfold
    End If
    
    Dim orientation As FlatPatternOrientation
    Set orientation = smDef.FlatPattern.FlatPatternOrientations.ActiveFlatPatternOrientation.Copy("New Orientation")
    
    ' Find an linear edge that lies along the flattened plane.
    Dim flatEdge As Edge
    Dim tempEdge As Edge
    For Each tempEdge In smDef.FlatPattern.Body.Edges
        If tempEdge.GeometryType = kLineSegmentCurve Then
            If Abs(tempEdge.StartVertex.Point.Z - tempEdge.StopVertex.Point.Z) < 0.0001 Then
                Set flatEdge = tempEdge
                Exit For
            End If
        End If
    Next
    
    orientation.Activate
    orientation.AlignmentRotation.Expression = "30 deg"
    orientation.AlignmentAxis = flatEdge
    
End Sub

 

Hope that helps.

 

Philippe.

 

 

 



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

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

Post to forums  

Autodesk Design & Make Report