Get the Name of Objects in an Object list

Hi Forum,

I currently stuck a little bit. I have a collection of Meshes. I want to join all meshes with the same Name.
But i dont understand the objectnames function:
https://developer.rhino3d.com/api/rhinoscript/object_methods/objectnames.htm

What did i do wrong? Thank you!

import rhinoscriptsyntax as rs
import Rhino
meshes = rs.ObjectsByType(32)
arrname = Rhino.ObjectNames(meshes)
print(arrname)


This is the Error i keep getting:
Message: ‘Rhino’ object has no attribute ‘ObjectNames’

You are mixing VB Rhinoscript and Python Rhinoscriptsyntax…

Maybe this will help:

https://developer.rhino3d.com/api/RhinoScriptSyntax/#selection-ObjectsByName

Or, to have the equivalent of vb Rhino.ObjectNames():

all_names=[rs.ObjectName(obj) for obj in objs]

(where objs is your list of objects to check)

1 Like

Very helpfull! Thank you very much!

The code is not very sophisticated but cleans the user mess. so its helpfull. Maybe it helps people who google the issue.

# Packe alle NetzID in eine Liste
meshes = rs.ObjectsByType(32)

#fuege Netze mit gleichen Namen zusammen

all_names=[rs.ObjectName(obj) for obj in meshes]

for name in all_names:
    rs.Command("_-Selname " + name + " _join _enter _Selnone")

meshes = rs.ObjectsByType(32)