Native python calls for import STL and section objects?

Dear community,

Just a simple question: is there a native function call to section an object in python?

I know that I can call the command like

   rhino.command "_section w0,-400,0 w0,400,0 _Enter"

but can this be done directly in Python or C# using functions instead of Rhino commands?

Same question for importing e.g. STL files: I know how to do it using a Rhino command, but wonder if this can be done directly in python or C#…

Kind regards,

Filip

You should be able to use rs.ProjectCurveToSurface(curve, surfaces, direction) and project a line onto the object(s) in the desired direction vector. That should be more or less the equivalent of the Section command as far as I know.

The RhinoCommon method (accessible in C#, Python, etc.) for this is Curve.ProjectToBrep()

Edit: forgot to answer the second question -
No, for importing/exporting binary files, there is no other method aside from scripting the Rhino command…

–Mitch