Split command

Hello,

I trying Split command , using two preselected objs, and use rs.command to slitp
the obj .

import rhinoscriptsyntax as rs
obj1 = rs.GetObject(“Get frist obj for split”)
obj2 = rs.GetObject(“Get Second obj to cut”)
rs.Command("_Split" + "SelID "+ str(obj1) + “_Enter” + “SelID” + str(obj2) + “_Enter” )

For some reason this dont work, any tip?

The following should work - you need to make sure there are spaces in the string between arguments:

import rhinoscriptsyntax as rs
obj1 = rs.GetObject("Get first obj for split")
obj2 = rs.GetObject("Get second obj to cut")
rs.Command("_Split SelID "+str(obj1)+" _Enter _SelID "+str(obj2)+" _Enter")

Here is a different way using the “format” method to insert the GUID’s as strings automatically:

import rhinoscriptsyntax as rs
obj1 = rs.GetObject("Get first obj for split")
obj2 = rs.GetObject("Get second obj to cut")
rs.Command("_Split SelID {} _Enter _SelID {} _Enter".format(obj1,obj2))

Thank you