How to get the resulting objects from a scripted command?

e.g. How do I get the curve(s) after using something like this:

rs.Command("_Silhouette _selid {} _Enter".format(all_objs[i].Id))

Hi @ivelin.peychev, one way would be:

rc = rs.Command("_Silhouette")
if rc:
    obj_ids = rs.LastCreatedObjects(select=False)

_
c.

1 Like

Thanks @clement,

I just thought of another way. Getting the curves created in the current layer but yours is definitely better :slight_smile:

is the ‘standard’ method for this… That is really what it’s designed for.

1 Like

FWIW …

When your command only creates one object, you can also use FirstObject()

https://developer.rhino3d.com/api/RhinoScriptSyntax/#collapse-FirstObject

1 Like

Thanks for the hint @emilio, I was surprised that when running silhouette on a pipe object it creates two circles and two lines, go figure.

Often Silhouette creates more curves than we need.
When using it interactively, deleting the unwanted curves is easy.
I guess that in a script things may be more complex … :confused:

Yep, I have to use two more commands afterwards :slight_smile:
_Project and _CurveBoolean

1 Like