Interop

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

Methods

CommandLineOptionFromNativePointer

#Since v8.0
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
public static CommandLineOption CommandLineOptionFromNativePointer(
nint
ptrCommandLineOption
)

CreateFromNativePointer

#Since v5.0
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.
public static GeometryBase CreateFromNativePointer(
nint
pGeometry
ON_Geometry*
)
The appropriate geometry class in RhinoCommon on success.

FileReadOptionsConstPointer

#Since v6.0
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.
public static nint FileReadOptionsConstPointer(
options
A FileReadOptions object.
)
A pointer to the Rhino const object.

FileWriteOptionsConstPointer

#Since v6.0
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.
public static nint FileWriteOptionsConstPointer(
options
A FileWriteOptions object.
)
A pointer to the Rhino const object.

FontFromPointer

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

FromOnBrep

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

FromOnCurve

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

FromOnMesh

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

FromOnSurface

#Since v5.0
Copies a Rhino_DotNet surface to a RhinoCommon Surface class.
public static Surface FromOnSurface(
source
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
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.
public static nint NativeGeometryConstPointer(
geometry
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
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.
public static nint NativeGeometryNonConstPointer(
geometry
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
Get CRhinoDisplayPipeline* for a DisplayPipeline instance
public static nint NativeNonConstPointer()

NativeNonConstPointer

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

NativeNonConstPointer

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

NativeNonConstPointer

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

NativeNonConstPointer

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

NativeRhinoDocPointer

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

NSFontFromFont

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

NSFontFromFont

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

PlugInPointer

#Since v5.0
Gets a C++ plug-in pointer for a given RhinoCommon plug-in.

This is a Rhino SDK function.

public static nint PlugInPointer(
plugin
A plug-in.
)
A pointer.

RhinoObjectConstPointer

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

RhinoObjectFromPointer

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

ToIRhinoViewport

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

ToOnBrep

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

ToOnCurve

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

ToOnMesh

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

ToOnSurface

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

ToOnXform

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

TryCopyFromOnArc

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

TryCopyToOnArc

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

ViewCaptureFromPointer

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