How to find Rhino id for all new mesh-objects generated when i split/extract/collapse a mesh object?

Hi All

I am performing lot of operations inside a python script where i use many commands that add/remove mesh-objects. For instance:

split_cmd_str = "_MeshSplit _SelID " + str(mesh_obj_id[0]) + " _Enter _SelID " + str(surf_id) + " _Enter "result1 = rs.Command(split_cmd_str)

mirror_cmd_str = "_Mirror " + " 3 " + str(point1) + " " + str(point2) + " " + str(point3)
result2 = rs.Command(mirror_cmd_str)

Now, so far i have been unable to get a work around using rs.command("_Undo"). I was wondering if I can somehow get the ids of these newly generated mesh objects so that i can delete them if needed. One way to do it is use rs.AllObjects() to create a list of original objects and then see what new Rhino-ids have been added.

But does Rhino provides this information right away somehow. Or the best if somebody can help me in using rs.Command("_Undo").

Hello - if you run a top level Rhino command you can check for success with

if rs.LastCommandResult() == 0:
    MyNewIds = rs.LastCreatedObjects()