Forgot password?

Create an account!

Forum

« back

RhinoScript – Group by object name?

Messages

Please log in to write a message.

  • 5. Johannes (Aug 25, 2012 13.08):

    I added two scripts to our script library:

    group objects by name:
    www.rhinoscript.org/scripts/136

    group objects by property:
    www.rhinoscript.org/scripts/137

    johannes

  • 4. Archier (Aug 25, 2012 07.23):

    My Friend Jon Kaitler put this together.

    Call Sel_GetObjectName()
    Sub Sel_GetObjectName()

    Dim arrObjects, arrNames, strName, i, strGroup

    arrObjects = Rhino.AllObjects

    'get object name(s)

    If IsArray(arrObjects) Then

    arrNames = Rhino.ObjectNames(arrObjects)

    If IsArray(arrNames) Then

    For i = 0 To UBound(arrObjects)

    strName = arrNames(i)

    Next

    End If

    End If

    'create new group for each name(s)

    For i = 0 To UBound(arrNames)

    strGroup = Rhino.AddGroup(arrNames(i))

    Next

    Call Group_Objects()

    End Sub

    '-------------------

    Call Group_Objects()
    Sub Group_Objects()

    'add objects to corresponding groups

    Dim arrObjects, strGroup, arrGroups, strName

    arrGroups = Rhino.GroupNames

    If IsArray(arrGroups) Then

    For i = 0 To UBound(arrGroups)

    strName = arrGroups(i)

    strGroup = arrGroups(i)

    If Not IsNull(strName) Then

    arrObjects = Rhino.ObjectsByName(strName, True)

    If IsArray(arrObjects) Then

    Rhino.AddObjectsToGroup arrObjects, strGroup

    End If

    End If

    Next

    End If

    End Sub

  • 3. Archier (Aug 24, 2012 01.41):

    Thanks Johannes!

    Really appreciate it!

  • 2. Johannes (Aug 23, 2012 16.01):

    hi
    get objects by name - Rhino.ObjectsByName (strName)
    add a group - Rhino.AddGroup(groupName)
    add the objects from step 1 to the group - Rhino.AddObjectstoGroup(groupName)

    cheers

  • 1. Archier (Aug 22, 2012 13.09):

    Hi,

    I would like to group geometry by name not layer. Any ideas/thoughts?

    Cheers

Recommend

Why are these buttons gray?