How to return object name in rhino with python

Helle ia m tryng to return the object name of an object

i have tried diferent stuff without succes

i do have the id with this comment

import rhinoscriptsyntax as rs
objectIds = rs.GetObjects(“Pick some object”)
for id in objectIds: print “Object identifier:”, id

What is inside objectIds in rhrino ?

thank you

Try
rs.ObjectName ()

Does that help?

no succes

i have tried

import rhinoscriptsyntax as rs
objectIds = rs.GetObjects(“Pick some object”)
for id in objectIds: print “Object identifier:”, id
Name = rs.GetUserText(objectIds)
print “Object Name”, Name

sorry succes

import rhinoscriptsyntax as rs

objectIds = rs.GetObjects(“Pick some object”)
for id in objectIds: print “Object identifier:”, id
Name = rs.ObjectName(objectIds)
print “Object Name”, Name

1 Like

this does work only when i select on object, but when i select two, i just get the first id of the first object

import rhinoscriptsyntax as rs
objectIds = rs.GetObjects(“Pick some object”)

for id in objectIds:
print “Object identifier:”, id
Name = rs.ObjectName(objectIds)
print “Object Name”, Name

I’m not familiar with Python syntax, but isn’t there some kind of statement that will loop through all the members of objectlds?

Something like:

for each id in objectlds
print…
etc…
loop

Hi Phmadeira

Try this:

(pseudo code)

for singleID in objectIDs:
   name = rs.ObjectName(singleID)
   print "name for object is ", name

So what you do is itterate over the individual ID’s in the list.
For each item (single objectID) you get the object name.

An object ID is the reference to the object in the Rhino document.

HTH
-Willlem