Arc Direction in Rhinoscript

How can you find the direction an arc is drawn. If you run this script and select either of the 2 arcs in the attached file you get the same answer.

Option Explicit
'Script written by <insert name>
'Script copyrighted by <insert company name>
'Script version 17 June 2015 16:17:28

Call Main()
Sub Main()
	Dim strObject, dblAngle, arrPointStart, arrPointEnd

	strObject = Rhino.GetObject("Select arc")

	If Rhino.IsArc(strObject) Then

		dblAngle = Rhino.ArcAngle(strObject)
		arrPointStart = Rhino.CurveStartPoint(strObject)
		arrPointEnd = Rhino.CurveEndPoint(strObject)

		Rhino.Print "Arc angle: " & CStr(dblAngle) & " Arc Start: " & Rhino.Pt2Str(arrPointStart) & " Arc End: " & Rhino.Pt2Str(arrPointEnd)

	End If


End Sub

I’d like the 180° as positive or negative, is there some way to find this.

Also seems odd that the answers from the script ignore the direction the arcs are drawn.

Thanks Mark.
temp.3dm (32.9 KB)

Hi Marc,

you can use the CurvePlane to determine the angle direction. This script should work for arcs with cplane top:

Option Explicit
'Script written by <insert name>
'Script copyrighted by <insert company name>
'Script version 17 June 2015 16:17:28

Call Main()
Sub Main()
	Dim strObject, dblAngle, arrPointStart, arrPointEnd
	Dim arrPlane

	strObject = Rhino.GetObject("Select arc")

	If Rhino.IsArc(strObject) Then

		dblAngle = Rhino.ArcAngle(strObject)
		arrPointStart = Rhino.CurveStartPoint(strObject)
		arrPointEnd = Rhino.CurveEndPoint(strObject)
		arrPlane = Rhino.CurvePlane(strObject)
    
		If arrPlane(3)(2) < 0.0 Then
			dblAngle = -dblAngle
		End If
    
		Rhino.Print "Arc angle: " & CStr(dblAngle) & " Arc Start: " & Rhino.Pt2Str(arrPointStart) & " Arc End: " & Rhino.Pt2Str(arrPointEnd)
		Rhino.ViewCPlane , arrPlane

	End If

End Sub
1 Like

Thanks Jess,
That works great.

Mark.