How is useful the RhinoScriptSyntax

It is probably a very newbie question, but I wonder what is the benefit of using RhinoScriptSyntax in Python in opposite directly using Rhino common API? The simple example it’s possible to make a point using both ways (Rhino. and RhinoScriptSyntax.) but in which cases RhinoScriptSyntax is helpful or vital so to say?

import rhinoscriptsyntax as rs
from Rhino import Geometry

Pt0 = Geometry.Point3d(1,1,1)
Pt1 = rs.CreatePoint(1,1,1)

Hi,

As per the link:

The RhinoScriptSyntax module contains hundreds of easy-to-use functions that perform a variety of operations on Rhino.

It’s a module for convenience build to mimic the methods available in RhinoScript

I’d say RhinoScriptSyntax is not vital, just helpful and convenient as it’s all (Rhino)Python there is nothing in there you cannot do with Python and RhinoCommon.

-Willem

1 Like

@Willem for your experience, when you are scripting you commonly apply RhinoScriptSyntax and don’t use RhinoCommon, right?

What I’d say is more conveniant are the hints that you get while using RhinoScript in GhPython e.g it’s easier to find out what are the input variables needed for specific method. But sometimes using rhinocommon itself becomes more conveniant, for example when I know already some method from C# or I found it already in rhinocommon documentation, then I don’t waste time to find how to do it with RhinoScript.

1 Like

@w.radaczynski @Willem thank you for your response

Yes, in this case it doesn’t make much difference.
But when working with RhinoObjects or Layers or Views etc. rhinoscriptsyntax could let you write a shorter code.

Example:

import rhinoscriptsyntax as rs
import Rhino
import scriptcontext

arc0 = rs.AddArc3Pt( [ 10, 10, 10 ], [ 30, 10, 10 ], [ 20, 20, 10 ] )

arc1 = scriptcontext.doc.Objects.AddArc(
    Rhino.Geometry.Arc( 
        Rhino.Geometry.Point3d( 10, 10, 20 ),
        Rhino.Geometry.Point3d( 20, 20, 20 ),
        Rhino.Geometry.Point3d( 30, 10, 20 ) ) )
scriptcontext.doc.Views.Redraw()

HTH

1 Like

I’d say in case you want to do operations on the geometry you generate before adding them to the rhinodoc, it’s much easier to do everything directly in RhinoCommon and only add things to the rhinodoc when your operations are finished.

3 Likes