/// <summary> /// Copies a Rhino_DotNet curve to a RhinoCommon curve class. /// </summary> /// <param name="source"> /// RMA.OpenNURBS.IOnCurve or RMA.OpenNURBS.OnCurve. /// </param> /// <returns> /// RhinoCommon object on success. This will be an independent copy. /// </returns> /// <since>5.0</since> public static Geometry.Curve FromOnCurve(object source) { Geometry.GeometryBase g = CopyHelper(source, "RMA.OpenNURBS.OnCurve"); if (null == g) { g = CopyHelper(source, "RMA.OpenNURBS.OnArcCurve"); } if (null == g) { g = CopyHelper(source, "RMA.OpenNURBS.OnLineCurve"); } if (null == g) { g = CopyHelper(source, "RMA.OpenNURBS.OnNurbsCurve"); } if (null == g) { g = CopyHelper(source, "RMA.OpenNURBS.OnPolylineCurve"); } if (null == g) { g = CopyHelper(source, "RMA.OpenNURBS.OnPolyCurve"); } var rc = g as Geometry.Curve; return(rc); }
/// <summary> /// Copies a Rhino_DotNet mesh to a RhinoCommon mesh class. /// </summary> /// <param name="source"> /// RMA.OpenNURBS.IOnMesh or RMA.OpenNURBS.OnMesh. /// </param> /// <returns> /// RhinoCommon object on success. This will be an independent copy. /// </returns> /// <since>5.0</since> public static Geometry.Mesh FromOnMesh(object source) { Geometry.GeometryBase g = CopyHelper(source, "RMA.OpenNURBS.OnMesh"); var rc = g as Geometry.Mesh; return(rc); }
/// <summary> /// Copies a Rhino_DotNet surface to a RhinoCommon Surface class. /// </summary> /// <param name="source"> /// Any of the following in the RMA.OpenNURBS namespace are acceptable. /// IOnSurface, OnSurface, IOnPlaneSurface, OnPlaneSurface, IOnClippingPlaneSurface, /// OnClippingPlaneSurface, IOnNurbsSurface, OnNurbsSurfac, IOnRevSurface, OnRevSurface, /// IOnSumSurface, OnSumSurface. /// </param> /// <returns> /// RhinoCommon object on success. This will be an independent copy. /// </returns> /// <since>5.0</since> public static Geometry.Surface FromOnSurface(object source) { Geometry.GeometryBase g = CopyHelper(source, "RMA.OpenNURBS.OnSurface"); if (null == g) { g = CopyHelper(source, "RMA.OpenNURBS.OnPlaneSurface"); } if (null == g) { g = CopyHelper(source, "RMA.OpenNURBS.OnClippingPlaneSurface"); } if (null == g) { g = CopyHelper(source, "RMA.OpenNURBS.OnNurbsSurface"); } if (null == g) { g = CopyHelper(source, "RMA.OpenNURBS.OnRevSurface"); } if (null == g) { g = CopyHelper(source, "RMA.OpenNURBS.OnSumSurface"); } var rc = g as Geometry.Surface; return(rc); }
/// <summary> /// Copies a Rhino_DotNet brep to a RhinoCommon brep class. /// </summary> /// <param name="source"> /// RMA.OpenNURBS.IOnBrep or RMA.OpenNURBS.OnBrep. /// </param> /// <returns> /// RhinoCommon object on success. This will be an independent copy. /// </returns> /// <since>5.0</since> public static Geometry.Brep FromOnBrep(object source) { Geometry.GeometryBase g = CopyHelper(source, "RMA.OpenNURBS.OnBrep"); var rc = g as Geometry.Brep; return(rc); }
internal bool PerformGeometryMorph(Geometry.GeometryBase geometry) { // dont' copy a const geometry if we don't have to if (null == geometry || !IsMorphable(geometry)) { return(false); } IntPtr pGeometry = geometry.NonConstPointer(); NativeSpaceMorphWrapper native_wrapper = this as NativeSpaceMorphWrapper; if (native_wrapper != null) { return(UnsafeNativeMethods.ON_SpaceMorph_MorphGeometry2(pGeometry, native_wrapper.m_pSpaceMorph)); } SpaceMorph oldActive = m_active_morph; m_active_morph = this; MorphPointCallback cb = OnMorphPoint; bool rc = UnsafeNativeMethods.ON_SpaceMorph_MorphGeometry(pGeometry, m_tolerance, m_bQuickPreview, m_bPreserveStructure, cb); m_active_morph = oldActive; return(rc); }
/// <summary> /// 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. /// </summary> /// <param name="geometry">A geometry object. This can be null and in such a case <see cref="IntPtr.Zero"/> is returned.</param> /// <returns>A pointer to the non-const geometry.</returns> /// <since>5.0</since> public static IntPtr NativeGeometryNonConstPointer(Geometry.GeometryBase geometry) { IntPtr rc = IntPtr.Zero; if (geometry != null) { rc = geometry.NonConstPointer(); } return(rc); }