private static IntPtr CRhinoObjectGrips_NurbsSurface(int serial_number) { IntPtr rc = IntPtr.Zero; CustomObjectGrips grips = FromSerialNumber(serial_number); if (grips != null) { try { Pixel.Rhino.Geometry.NurbsSurface ns = grips.NurbsSurface(); if (ns != null) { rc = ns.ConstPointer(); } } catch (Exception ex) { Pixel.Rhino.Runtime.HostUtils.ExceptionReport(ex); } } return(rc); }
static void OnDrawGeometryProc(Guid am_id, IntPtr pConstRhinoObject, IntPtr pConstGeometry, IntPtr pRhinoDisplayPipeline) { VisualAnalysisMode mode = FindLocal(am_id); if (mode != null) { var rhobj = Pixel.Rhino.DocObjects.RhinoObject.CreateRhinoObjectHelper(pConstRhinoObject); var geom = Pixel.Rhino.Geometry.GeometryBase.CreateGeometryHelper(pConstGeometry, null); if (geom != null) { geom.DoNotDestructOnDispose(); } DisplayPipeline dp = new DisplayPipeline(pRhinoDisplayPipeline); Pixel.Rhino.Geometry.Mesh mesh = geom as Pixel.Rhino.Geometry.Mesh; try { if (mesh != null) { mode.DrawMesh(rhobj, mesh, dp); return; } Pixel.Rhino.Geometry.NurbsCurve nurbscurve = geom as Pixel.Rhino.Geometry.NurbsCurve; if (nurbscurve != null) { mode.DrawNurbsCurve(rhobj, nurbscurve, dp); return; } Pixel.Rhino.Geometry.NurbsSurface nurbssurf = geom as Pixel.Rhino.Geometry.NurbsSurface; if (nurbssurf != null) { mode.DrawNurbsSurface(rhobj, nurbssurf, dp); return; } } catch (Exception) { } } }
/// <summary> /// Draws a NURBS surface. This is a good function to override /// to display object-related meshes. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="obj">A Rhino object corresponding to the surface.</param> /// <param name="surface">The surface geometry.</param> /// <param name="pipeline">The current display pipeline.</param> protected virtual void DrawNurbsSurface(Pixel.Rhino.DocObjects.RhinoObject obj, Pixel.Rhino.Geometry.NurbsSurface surface, DisplayPipeline pipeline) { }