Selected Object in Python

Hi all,

I’ve got this routine:

import rhinoscriptsyntax as rs


Unfortunately, I don’t ghet the result I expected: whatever the objects I select with rs.GetObjects(), all objects are selected at the end of the script… Any idea why it does that?

Thank you!


GetObjects just gets the identifier of the object so you can later on use that identification to tell python what to do with what. GetObjects returns a list, and that list needs a name. So do something like this:

myObjects=rs.GetObjects("select objects")

Now you have to tell Python that these objects are to be selected. One way is adding this line:


If you look at the help file you will see that GetObject() has options to it, so it possible to select the objects directly after you have picked them, or even have Python accept preselected objects and add filters so you can only select meshes, curves and/or polysurfaces etc, and/or only select objects from another list.

Good luck.

By default picked objects are not selected. Try this:


Thank you very much!