List of Python/RhinoCommon commads corresponding to the GUI commands?

Hi all,

I am trying to write some python programs to automate some steps that I normally would do manually in the Rhino6 GUI. I always run into the same problem: The GUI commands don’t correspond to Python rhinoscript or RhinoCommon commands. Is there any comprehensive correspondence table?

In particular I am looking for the equivalents to be usable in Python for:
CreateUVCrv
PlanarSrf
FlowAlongSrf
UnrollSrfUV
to just name a few.

Also an annoying fact is that CreateUVCrv creates the trimmed and the untrimmed uv curves. Is there any way to stop Rhino from providing the untrimmed versions?

Any insights?
Thanks.

Hello,

You can use rs.Command() to directly script any Rhino command.

Graham

Hello Graham,

thank you, that’s certainly a valid solution.

I am wondering what the performance hit is using this route. The idea is to treat several hundred parts with multiple commands so performance might be an issue.

So, if anybody has a comprehensive list of all commands that can be called directly I am still interested.

Thanks again,
B.

Hi @junk,

Neither RhinoCommon nor Python have any ‘commands’. Rather, they APIs that have functions and classes, with properties and methods, that can be used to construction commands.

For example, if you wanted to create a planar surface using Rhino, you might run the PlanarSrf command. However, if you wanted to create a planar surface using Rhino using RhinoCommon, you’d use Brep.CreatePlanarBreps.

Does this help?

– Dale

Hi Dale,

thank you for your reply.

I am well aware of the difference between the GUI commands and the API calls they are internally mapped to.

Your example of the mapping of the command ‘PlanarSrf’ to the API call ‘Brep.CreatePlanarBreps’ is exactly what I am looking for in the form of a comprehensive correspondence list mapping all the GUI commands to their corresponding API calls.

As one can easily see the command name (PlanarSrf) has not much in common with the API method name (Brep.CreatePlanarBreps). Thus, guessing or searching through the RhinoCommon API documentation isn’t very efficient.

I would really appreciate if you could provide such a correspondence list.

Kind regards,
B.

Because it is not necessarly the same. However, the command might use the method as part of its internal structure. Therefor, the list you are asking for would basicly mean to open up the source of the commands.

Hi @junk,

The best we can do today is the RhinoCommon API documents and the developer samples on GitHub. When you’ve looked there and here (on Discourse) and still can’t find what your looking for, don’t hesitate to ask.

Thanks,

– Dale

Hi Dale,

thanks again for your help and your offer to help me further.

The GUI commands for which I would need the corresponding RhinoCommon
API calls at the moment are:

  • CreateUVCrv (to get the UV curves of a surface)
  • PlanarSrf - you answered tha one already
  • FlowAlongSrf - I think I saw that one in the examples somwhere
  • TextObj - should be trival (should be in the Python
    Rhinoscript library)
  • UnrollSrfUV
  • DupBorder
  • Group operations - should be again in the rhinoscript library
  • Export STEP files - I think I saw an example for DXF, but not for STEP

Sorry for bothering you.
I can start to collect all those correspondances .
Maybe with the help of other ppl in the forum we can arrive at a long
list after a while that might be useful for everybody.

Kind regards,
B.

Hi @junk,

In the future, you might break up these questions into smaller chunks that are easier to deal with.

But, here we go:

Use BrepLoop.To2dCurve. Here is an example.

Use Brep.CreatePlanarBreps.

Use a SporphSpaceMorph space morph.

Here is the source to rhinoscriptsyntax is you want to use it as an example.

The code behind this command is not exposed in any API. However, if you want to unroll a surface, use the Unroller class.

Here is an example you can use.

Use the document’s GroupTable.

There is no API for this. Just script the _Export command.

Hope this helps.

– Dale