Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, everyone
Is it possible to move the FlatPattern to the origin using iLogic before doing a DXF export.
The FlatPattern is deleted and recreated after each export.
Currently we are doing an alignment based on a named edge.
Maybe the x and y coordinate of the edge can be used?
...
' get length from named Edge
Dim ALen As Double
Try
Dim oEdge As Edge = namedEntities.FindEntity("Achse_Tritt")
ALen = Sqrt(Pow((oEdge.StartVertex.Point.X - oEdge.StopVertex.Point.X), 2) + Pow((oEdge.StartVertex.Point.Y - oEdge.StopVertex.Point.Y), 2))
Catch
MessageBox.Show("Keine benannte Achse gefunden!")
ALen = 0.0
End Try
'Create Flat Pattern
If oCompDef.HasFlatPattern = False Then
oCompDef.Unfold
Else
End If
Dim sheetMetalDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition
Dim orientation As FlatPatternOrientation
orientation = sheetMetalDef.FlatPattern.FlatPatternOrientations.ActiveFlatPatternOrientation.Copy("New Orientation")
' Find an linear edge that lies along the flattened plane.
Dim flatEdge As Edge
Dim tempEdge As Edge
Dim EdgeLen As Double = 0.0
Dim TmpEdgeLen As Double
For Each tempEdge In sheetMetalDef.FlatPattern.Body.Edges
If tempEdge.GeometryType = kLineSegmentCurve Then
If Abs(tempEdge.StartVertex.Point.Z - tempEdge.StopVertex.Point.Z) < 0.0001 Then ' is on flat pattern plane
TmpEdgeLen = Sqrt(Pow((tempEdge.StartVertex.Point.X - tempEdge.StopVertex.Point.X), 2) + Pow((tempEdge.StartVertex.Point.Y - tempEdge.StopVertex.Point.Y), 2))
' and has same length as named edge
If EqualWithinTolerance(ALen, TmpEdgeLen)
flatEdge = tempEdge
Exit For
End If
End If
End If
Next
' modify flat pattern orientation
Try
orientation.Activate
orientation.AlignmentAxis = flatEdge
orientation.AlignmentRotation.Value = 0.0 ' 0 - 2 PI
Catch
End Try
...
now
should be
Solved! Go to Solution.