rhw2
November 2, 2015, 12:44am
1
Continuing the discussion from Cage edit equivalence command in python :
I can’t seem to get the rs.command CageEdit to work for multiple objects!
For example, I used a similar script but selected multiple objects:
#objects
Model = rs.GetObjects("select objects", 16)
#cage edit
strModel = str(Model) + " "
rs.Command("_CageEdit " + "selid " + strModel + "_enter " + "BoundingBox " + "World " + "XPointCount " + "2 " + "YPointCount " + "2 " + "ZPointCount " + "2 " + " _enter " + "Global ")
Please let me know why my script is not working. Thanks!
Would “selid” have an influence on single versus multiple objects selected?
Thanks.
Hi Elenaimani,
I have been trying to do something similar. It seems like there isn’t an “rs.CageEdit” command available however you can access it through the rs.Command function.
Here is a bit of code that I have used for this:
#load GUID of Mesh
Model=rs.GetObject('Select Mesh',32)
#cage edit
strModel=str(Model) + " "
rs.Command("_CageEdit " + "selid " + strModel + " _enter " + "BoundingBox " + ...
..."World " + "XPointCount " + "7 " + "YPointCount " + "ZPointCount " ...
...+"5 " + " _enter " + "Global ")
This duplicates the commands you would enter without python in the command line. You can then select points to move using GetGripObjects:
#prompt to select cage points to move
CagePoints=rs.GetObjectGrips("select cage points")
It would be nice if there was something a little more integrated to do this but for now this works.
Hope this helps!
SelID only works on one GUID at a time, your variable “Model” will be a list, so it won’t work that way. If you need to select multiple objects to use in a command-line script there are one of two possibilities:
If the command needs only one object group input, usually you can just pre-select the objects:
#objects
Model = rs.GetObjects("select objects", 16, select=True) #objects are selected
#cage edit
strModel = str(Model) + " "
rs.Command("_CageEdit _BoundingBox _World _XPointCount=2 _YPointCount=2 _ZPointCount=2... etc")
Otherwise, it there is more than one set of objects to be input, you can create groups and select them with SelGroup in the command line string.
–Mitch
1 Like