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.
Solved! Go to Solution.
Solved by philippe.leefsma. Go to Solution.
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.