McNeel Wiki
Selecting Objects by Linetype
edit · print · help · all topics
Main Pages

AccuRender

Bongo

Brazil r/s

Developer

Flamingo

Flamingo

Penguin

Rhino Blogs

Rhino

Rhino Labs

Search

Languages

Česky

Deutsch

English

Español

Français

Italiano

Polish

日本語

한국어

中文(繁體)

中文(简体)

 
.
DeveloperRhinoScript
Version4.0
SummaryDemonstrates how to select objects by linetype using RhinoScript.

Question

How can I select objects by linetype using RhinoScript?

Example

The following example code demonstrates how to select objects by linetype. In this example all objects that are assigned the specified linetype are selected. But, it is not difficult to select only certain types of objects (e.g. curves).

  Sub SelLinetype


    Dim strLinetype
    strLineType = Rhino.GetString("Object linetype name to select")
    If Not IsString(strLinetype) Then Exit Sub
    If Not Rhino.IsLinetype(strLinetype) Then Exit Sub


    Dim arrObjects, strObject


    ' If you want to filter on all visible objects,
    ' use the following line of code.
    arrObjects = Rhino.NormalObjects


    ' Or, if you want to filter on just curve objects
    ' use the following line of code.
    ' arrObjects = Rhino.ObjectsByType(4)


    If IsArray(arrObjects) Then
      Rhino.EnableRedraw False
      For Each strObject In arrObjects
        If StrComp(Rhino.ObjectLinetype(x), strLinetype, 1) = 0 Then
          Rhino.SelectObject(strObject)
        End If
      Next
      Rhino.EnableRedraw True
    End If


  End Sub


  Function IsString(ByVal str)
    IsString = False
    If VarType(str) = vbString Then IsString = True
  End Function  
rename · changes · history · subscriptions · lost and found · references · file upload