Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
StKrause
in reply to: ice_sid

to search the longest edge and rotate the TextBox use:

 

' search the longest edge
Dim maxLen As Double
Dim maxEdge As Edge
For Each oEdge As Edge In oEdgeLoop.Edges
	eLen = ThisApplication.MeasureTools.GetMinimumDistance(oEdge.StartVertex.Point, oEdge.StopVertex.Point)
	If eLen > maxLen Then
		maxLen = eLen
		maxEdge = oEdge
	End If
Next
Dim oP1 As Point2d = oSketch.ModelToSketchSpace(maxEdge.StartVertex.Point)
Dim oP2 As Point2d = oSketch.ModelToSketchSpace(maxEdge.StopVertex.Point)
Ang = Atan((oP2.Y - oP1.Y) / (oP2.X - oP1.X))
' rotate TextBox
Dim oColl As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection() 
oColl.Add(oTextBox)
oTextBox.ShowBoundaries = True
oSketch.RotateSketchObjects(oColl, oSketch.ModelToSketchSpace(CenterPt), Ang, False, True)
Dim oHin As Vector2d = ThisApplication.TransientGeometry.CreateVector2d(1, 0)
Dim oHer As Vector2d = ThisApplication.TransientGeometry.CreateVector2d(-1, 0)
oSketch.MoveSketchObjects(oColl, oHin)
oSketch.MoveSketchObjects(oColl, oHer)