GetObjects() - How to get a list/array with only object id's?

Hey

I am programming in python.

I am trying to find a way to select all item’s and put them into an array so as i can do a loop later to get all control points.

The way i thought about doing this was with GetObjects() function.

The problem with this function is that when i try to loop it later with python it says GUID is a problem

When i use GetObject. I get only the objectid

When i use GetObjects i get

> [<System.Guid object at 0x000000000000002B [0e6ed349-e22e-4517-82c5-d5f6af30ecd2]>, <System.Guid object at 0x000000000000002C [82dfb54c-831a-4671-a3b8-78ad893062c4]>]

How can i get only the following from the abovementioned array?

[0e6ed349-e22e-4517-82c5-d5f6af30ecd2,82dfb54c-831a-4671-a3b8-78ad893062c4]

As a reminder we are using python.!

The example code of the idea.

#pick an object
object_id = rs.GetObjects("Select Surface", rs.filter.surface)

#Loop between my objects
for object_i in object_id:
    #get the surface's control points
    cpoints = rs.SurfacePoints(object_i)

Any ideas are welcome, either to make my solution work or any other solution to get the control points from all items in my current design sheet.

Regards
Italos M.

Your code above seems to work here…

–Mitch

1 Like

Does it get you only Object Id’s?

Or it gets you “<System.Guid object at 0x000000000000002B [0e6ed349-e22e-4517-82c5-d5f6af30ecd2]>, <System.Guid object at 0x000000000000002C [82dfb54c-831a-4671-a3b8-78ad893062c4]>”

The goal is to get the goal id only so i can loop it.

The object_id List is not loopable after i GetObjects unfortunately.

What do i do wrong?

I don’t know where you’re seeing where it’s going wrong, I just tested on both Windows and Mac - although I do not have the latest version of Mac, as I haven’t updated to Mavericks yet.

I only do development in Windows as there is no script editor or debugger in Mac. Below is what the script looks like paused at a breakline. It is looping correctly through the object id’s and extracting the surface points.

–Mitch

1 Like

Ok thank you :smile:
It seems its a problem of Mac.

I just get the latest build of rhino crash when i run the script.

I just ran this script on windows and it run just fine.

Thank you Helvetosaur for your help!

-Italos

Well, I just upgraded my system to Mavericks and installed the latest build of Rhino, und the code still runs fine…

–Mitch

Hey Mitch. I am retrying. If it doesnt work i will post a video