Workaround for missing options/commands from python


#1

Hi,

Still quite new to Rhino…
I would need access from python to RebuildSurface with an option retrim, as available from the GUI command _Rebuild …
It is possible to call that command directly somehow.
A similar thing with _MergeSrf, I did not find corresponding function from python, though I would really need it. I would be grateful for advice.

J


#2

Hi Jiri, for Rebuild you can use rs.Command, preselect the surface in question and supress the dialog like this:

import rhinoscriptsyntax as rs

def RebuildEx(U=10, V=10, UDeg=3, VDeg=3, Del="_Yes", ReTrim="_Yes"):
    srf = rs.GetSurfaceObject("Select a surface", True, True)
    if srf:
        cmd = "_-Rebuild"
        cmd = cmd + " _UPointCount=" + str(U)
        cmd = cmd + " _VPointCount=" + str(V)
        cmd = cmd + " _UDegree=" + str(UDeg)
        cmd = cmd + " _VDegree=" + str(VDeg)
        cmd = cmd + " _DeleteInput=" + Del
        cmd = cmd + " _ReTrim=" + ReTrim
        cmd = cmd + " _Enter _Enter"
        rs.Command(cmd, False)

if __name__=="__main__":
    RebuildEx(16,16,3,3,"_Yes", "_Yes")

_MergeSrf might work similar but both surfaces should be preselected and mergable.

c.


#3

Hi Clement,

thank you very much! it works exactly how I need. One additional question:
how would I know all the arguments that some command takes such as
"_UpointCount" … maybe i don’t see those because I work in a non-english localization?
If you could point to a documentation which I missed or to code, where I could figure out the arguments. Thank you again,
Jiri


#4

Just type the -dash version of the English command with an underscore:

-_Rebuild

and you will see all the command line options. The different localizations should have all the same options, but localized. The advantage of scripting the command in English with the underscore is that it will work anywhere in all languages.

HTH, --Mitch