Cage edit equivalence command in python


i want to deform a sphere by rhinoscripts,the same action that we do it with cage edit in rhino ,but i dont know witch command i have to use in python ?


Hi Elena​imani,

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!

CageEdit for Multiple Objects

thank u for answering!

at first i think i have to use one of the mesh commanads right?


I was using that code to deform a mesh. I think you can use the cage edit on just about anything. Just change the filter in GetObjects from 32 to whatever is appropriate (or remove it altogether). See the help file for the filter numbers.