Interop

public static class Interop
Contains static methods to marshal objects between RhinoCommon and legacy Rhino_DotNet or C++.

Methods

CommandLineOptionFromNativePointer

#Since v8.0
public static CommandLineOption CommandLineOptionFromNativePointer(nint ptrCommandLineOption)
Create a command line option for a native pointer. Do not hold onto this class as it does not control the lifetime of the underlying pointer
ptrCommandLineOption (nint)

CreateFromNativePointer

#Since v5.0
public static GeometryBase CreateFromNativePointer(nint pGeometry)
Constructs a RhinoCommon Geometry class from a given ON_Geomety*. The ON_Geometry* must be declared on the heap and its lifetime becomes controlled by RhinoCommon.
pGeometry (nint)ON_Geometry*
The appropriate geometry class in RhinoCommon on success.

FileReadOptionsConstPointer

#Since v6.0
public static nint FileReadOptionsConstPointer(FileReadOptions options)
Returns the underlying const CRhinoFileReadOptions* for a Rhino.FileIO.FileReadOptions object. You should only be interested in using this function if you are writing C++ code.
options (FileReadOptions)A FileReadOptions object.
A pointer to the Rhino const object.

FileWriteOptionsConstPointer

#Since v6.0
public static nint FileWriteOptionsConstPointer(FileWriteOptions options)
Returns the underlying const CRhinoFileWriteOptions* for a Rhino.FileIO.FileWriteOptions object. You should only be interested in using this function if you are writing C++ code.
options (FileWriteOptions)A FileWriteOptions object.
A pointer to the Rhino const object.

FontFromPointer

#Since v6.0
public static Font FontFromPointer(nint ptrManagedFont)
Create managed Font from native ON_Font*
ptrManagedFont (nint)

FromOnBrep

#Since v5.0
public static Brep FromOnBrep(object source)
Copies a Rhino_DotNet brep to a RhinoCommon brep class.
source (object)RMA.OpenNURBS.IOnBrep or RMA.OpenNURBS.OnBrep.
RhinoCommon object on success. This will be an independent copy.

FromOnCurve

#Since v5.0
public static Curve FromOnCurve(object source)
Copies a Rhino_DotNet curve to a RhinoCommon curve class.
source (object)RMA.OpenNURBS.IOnCurve or RMA.OpenNURBS.OnCurve.
RhinoCommon object on success. This will be an independent copy.

FromOnMesh

#Since v5.0
public static Mesh FromOnMesh(object source)
Copies a Rhino_DotNet mesh to a RhinoCommon mesh class.
source (object)RMA.OpenNURBS.IOnMesh or RMA.OpenNURBS.OnMesh.
RhinoCommon object on success. This will be an independent copy.

FromOnSurface

#Since v5.0
public static Surface FromOnSurface(object source)
Copies a Rhino_DotNet surface to a RhinoCommon Surface class.
source (object)Any of the following in the RMA.OpenNURBS namespace are acceptable. IOnSurface, OnSurface, IOnPlaneSurface, OnPlaneSurface, IOnClippingPlaneSurface, OnClippingPlaneSurface, IOnNurbsSurface, OnNurbsSurfac, IOnRevSurface, OnRevSurface, IOnSumSurface, OnSumSurface.
RhinoCommon object on success. This will be an independent copy.

NativeGeometryConstPointer

#Since v5.0
public static nint NativeGeometryConstPointer(GeometryBase geometry)
Returns the underlying const ON_Geometry* for a RhinoCommon class. You should only be interested in using this function if you are writing C++ code.
geometry (GeometryBase)A geometry object. This can be null and in such a case nint.Zero is returned.
A pointer to the const geometry.

NativeGeometryNonConstPointer

#Since v5.0
public static nint NativeGeometryNonConstPointer(GeometryBase geometry)
Returns the underlying non-const ON_Geometry* for a RhinoCommon class. You should only be interested in using this function if you are writing C++ code.
geometry (GeometryBase)A geometry object. This can be null and in such a case nint.Zero is returned.
A pointer to the non-const geometry.

NativeNonConstPointer

#Since v6.0
public static nint NativeNonConstPointer(DisplayPipeline pipeline)
Get CRhinoDisplayPipeline* for a DisplayPipeline instance
pipeline (DisplayPipeline)

NativeNonConstPointer

#Since v6.0
public static nint NativeNonConstPointer(GetPoint getPoint)
Get CRhinoGetPoint* from a GetPoint instance
getPoint (GetPoint)

NativeNonConstPointer

#Since v6.0
public static nint NativeNonConstPointer(RhinoViewport viewport)
Get CRhinoViewport* from a RhinoViewport instance
viewport (RhinoViewport)

NativeNonConstPointer

#Since v6.0
public static nint NativeNonConstPointer(ViewCaptureSettings settings)
Get a CRhinoPrintInfo* for a given ViewCaptureSettings class
settings (ViewCaptureSettings)

NativeNonConstPointer

#Since v5.1
public static nint NativeNonConstPointer(ViewportInfo viewport)
Get ON_Viewport* from a ViewportInfo instance
viewport (ViewportInfo)

NativeRhinoDocPointer

#Since v5.0
public static nint NativeRhinoDocPointer(RhinoDoc doc)
Gets the C++ CRhinoDoc* for a given RhinoCommon RhinoDoc class.
doc (RhinoDoc)A document.
A pointer value.

NSFontFromFont

#Since v6.9
public static nint NSFontFromFont(Font font, double pointSize)
Get native NSFont* from a Rhino Font. Only works on Mac
font (Font)
pointSize (double)Point size
NSFont* on success. IntPtr.Zero on failure

NSFontFromFont

#Since v6.9
public static nint NSFontFromFont(Font font)
Get native NSFont* from a Rhino Font. Only works on Mac
font (Font)
NSFont* on success. IntPtr.Zero on failure

PlugInPointer

#Since v5.0
public static nint PlugInPointer(PlugIn plugin)
Gets a C++ plug-in pointer for a given RhinoCommon plug-in.

This is a Rhino SDK function.

plugin (PlugIn)A plug-in.
A pointer.

RhinoObjectConstPointer

#Since v5.0
public static nint RhinoObjectConstPointer(RhinoObject rhinoObject)
Returns the underlying const CRhinoObject* for a RhinoCommon class. You should only be interested in using this function if you are writing C++ code.
rhinoObject (RhinoObject)A Rhino object.
A pointer to the Rhino const object.

RhinoObjectFromPointer

#Since v5.0
public static RhinoObject RhinoObjectFromPointer(nint pRhinoObject)
Constructs a RhinoCommon Rhino object from an unmanaged C++ RhinoObject pointer.
pRhinoObject (nint)The original pointer.
A new Rhino object, or null if the pointer was invalid or nint.Zero.

ToIRhinoViewport

#Since v5.0
public static object ToIRhinoViewport(RhinoViewport source)
Convert a Rhino.Display.Viewport to an RMA.Rhino.IRhinoViewport.
source (RhinoViewport)A RhinoCommon viewport.
Rhino_DotNet IRhinoViewport object on success. This will be an independent copy.

ToOnBrep

#Since v5.0
public static object ToOnBrep(Brep source)
Constructs a Rhino_DotNet OnBrep that is a copy of a given brep.
source (Brep)A source brep.
Rhino_DotNet object on success. This will be an independent copy.

ToOnCurve

#Since v5.0
public static object ToOnCurve(Curve source)
Constructs a Rhino_DotNet OnCurve that is a copy of a given curve.
source (Curve)A RhinoCommon source curve.
Rhino_DotNet object on success. This will be an independent copy.

ToOnMesh

#Since v5.0
public static object ToOnMesh(Mesh source)
Constructs a Rhino_DotNet OnMesh that is a copy of a given mesh.
source (Mesh)A source brep.
Rhino_DotNet object on success. This will be an independent copy.

ToOnSurface

#Since v5.0
public static object ToOnSurface(Surface source)
Constructs a Rhino_DotNet OnSurface that is a copy of a given curve.
source (Surface)A source brep.
Rhino_DotNet object on success. This will be an independent copy.

ToOnXform

#Since v5.0
public static object ToOnXform(Transform source)
Constructs a Rhino_DotNet OnXform from a given RhinoCommon Transform.
source (Transform)A RhinoCommon source transform.
Rhino_DotNet object on success. This will be an independent copy.

TryCopyFromOnArc

#Since v5.0
public static bool TryCopyFromOnArc(object source, out Arc destination)
Attempts to copy the contents of a RMA.OpenNURBS.OnArc to a Rhino.Geometry.Arc.
source (object)A source OnArc.
destination (out Arc)A destination arc.
true if the operation succeeded; false otherwise.

TryCopyToOnArc

#Since v5.0
public static bool TryCopyToOnArc(Arc source, object destination)
Attempts to copy the contents of a Rhino.Geometry.Arc to a RMA.OpenNURBS.OnArc.
source (Arc)A source arc.
destination (object)A destination OnArc.
true if the operation succeeded; false otherwise.

ViewCaptureFromPointer

#Since v6.0
public static ViewCaptureSettings ViewCaptureFromPointer(nint ptrViewCapture)
Create a ViewCaptureSettings class from a native const CRhinoPrintInfo* The pointer values are copied
ptrViewCapture (nint)