Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5892

Curve segment info

$
0
0

@Hughes_Tooling wrote:

What's the easiest way to get information on sub curves in a polycurve. Is using ExtractPolyCurveSegment to get a copy then deleting the copy like in the script below the only way?

Thanks Mark.

Option Explicit
'Script written by <insert name>
'Script copyrighted by <insert company name>
'Script version 19 June 2015 17:27:41

Call Main()
Sub Main()
	Dim Curve, i, count, strObject

	Curve = Rhino.GetObject("Select polyCurve", 4, True)

	If IsNull(Curve) Then Exit Sub

	If Not Rhino.IsPolyCurve(Curve) Then Exit Sub

	count = Rhino.PolyCurveCount(Curve)

	For i = 0 To count - 1

		strObject = Rhino.ExtractPolyCurveSegment(Curve, i)

		If Rhino.IsArc(strObject) Then
			Rhino.Print("Curve " & i & " is an arc")
		End If

		If Rhino.IsLine(strObject) Then
			Rhino.Print("Curve " & i & " is a line")
		End If

		Call Rhino.DeleteObject(strObject)

	Next

End Sub

Posts: 8

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 5892

Trending Articles