RhinoScript - responding to command prompts & pausing refresh

I have a RhinoScript in which I create an array of points, select them (in code), execute MeshPatch to convert them to a mesh, select the new mesh, then execute ToSubD. The code looks like this after I’ve generated the points, which are in an object array named “arrPtObjects”.

Rhino.UnselectAllObjects
Rhino.SelectObjects arrPtObjects
Rhino.Command _MeshPatch
(need something here to address MeshPatch prompts)

Rhino.UnselectAllObjects
Rhino.Selectobject Rhino.FirstObject
Rhino.Command _ToSubD
(need something here to address ToSubD prompts)

Rhino.DeleteObjects arrPtObjects

Question 1: How can I respond in RhinoScript to the parameters prompts resulting from the MeshPatch and ToSubD commands? I’ve tried searching help docs for this and tried what I found, but nothing worked. The way it works now, the user must respond to the prompts for the code to continue.

Question 2: My point generation is rather time consuming. Is there a way to pause viewport refresh then restart it after the point generation is done?

Use directly the Rhino.MeshPatch command instead of calling the Rhino.command
About the “ToSubd” command I don’t see a function in VbScript… maybe in Pythonscript…
If you use the Rhino.command _ToSubD you can specify the options you need
UseMesh=ControlPoints MeshCreases=No MeshCorners=No UseSurface=Location SurfaceCorners=No DeleteInput=No
and call Enter at the end.

Rhino.EnableRedraw ([blnRedraw]) will enable/disable the screen redrawing (this will save a lot of time)
Another thing that can save time is to disable echo from the command prompt when Rhino.command is used

Rhino.Command (strCommand [, blnEcho])

strCommand - Required. String. A Rhino command including any arguments.
blnEcho - Optional. Boolean. The command echo mode. If omitted, command prompts are echoed (True).

Thanks, most of that worked. But for the ToSubD I still ran into difficulty. I tried both all in one line and two separate lines, but neither worked to address the prompts. Please advise the proper syntax:

Rhino.Command _ToSubD ControlPoints MeshCreases=No MeshCorners=No UseSurface=Location SurfaceCorners=No DeleteInput=Yes

Rhino.Command _ToSubD
Rhino.Command UseMesh=ControlPoints MeshCreases=No MeshCorners=No UseSurface=Location SurfaceCorners=No DeleteInput=Yes

You should write all the options on the same line as a text delimited by commas:
Rhino.Command “_ToSubD _Enter”
If you need to have some options specified or different from standard ones, add them after the _ToSubD:
Rhino.Command “_TosubD _DeleteInput=Yes _Enter”
Usually I specify all the options only to be sure that the command works always in the same way.

Perfect, thank you. Will SubD commands be added to RhinoScript at some point?

1 Like

You’re welcome.

Don’t think that VbScript will be updated in the future.
At the moment (if VbScript isn’t enough) I suggest to move to Python Script that is a newer language and more powerful.
Cheers.