ObjectsByMaterialIndex

Returns the identifiers of all objects based on the objects' material index. An object's material index can be obtained using ObjectMaterialIndex.

Syntax

Rhino.ObjectsByMaterialIndex (intMaterialIndex [, blnSelect])

Parameters

intMaterialIndex

Required.  Number.  The zero-based material index to query.

 

blnSelect

Optional.  Boolean.  Select the objects.  If omitted, the objects are not selected (False).

Returns

Array

An array of strings identifying the objects if successful.

Null

If not successful, or on error.

Example

Const RhSurface = &h8

const RhPolysurface = &h10

const RhMesh = &h20

const RhInstanceReference = &h1000

const RhExtrusion = &h40000000

Dim arrObjects, strObject, intMaterialIndex, intType

intType = RhSurface + RhPolysurface + RhMesh + RhInstanceReference + RhExtrusion

strObject = Rhino.GetObject("Select a renderable object", intType)

If Not IsNull(strObject) Then

  intMaterialIndex = Rhino.ObjectMaterialIndex(strObject)

  If (intMaterialIndex >= 0) Then

    arrObjects = Rhino.ObjectsByMaterialIndex(intMaterialIndex, True)

  End If

End If

Also See

ObjectsByMaterialSource

ObjectMaterialIndex