June 23, 2009

RhinoScript | Select curves by linetypes

Sub SelectbyLinetype()

Dim arrLineTypes, strLinetype, arrObjects, strObject
Dim i : i=0
Rhino.UnselectAllObjects

arrLinetypes = Rhino.LinetypeNames

strLinetype = Rhino.GetString("Linetype to select objects", arrLinetypes(0), arrLinetypes)

Rhino.EnableRedraw False

arrObjects = Rhino.ObjectsByType (4 )

Rhino.UnselectAllObjects

For Each strObject In arrObjects

If strLinetype = Rhino.ObjectLinetype (strObject) Then
  Rhino.SelectObject strObject
  i=i+1
End If

Next

Rhino.Print CStr(i)&" curves was selected."
Rhino.EnableRedraw True
End Sub


입력한 Linetype인 커브들를 선택하는 간단한스크립트를인데 라이노스 질문에 답하느라 만들었다. 도면 작업시 간혹 유용하게 쓰일 것 같다.

No comments: