Exemplo n.º 1
0
        /***************************************************/

        public static void RenderRhinoWires(RHG.Plane plane, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            pipeline.DrawConstructionPlane(new Rhino.DocObjects.ConstructionPlane()
            {
                Plane = plane, ThickLineColor = bhColour, ThinLineColor = Color.Black, GridLineCount = 10
            });
        }
Exemplo n.º 2
0
        /***************************************************/

        public static void RenderRhinoMeshes(this List <object> geometry, Rhino.Display.DisplayPipeline pipeline, DisplayMaterial material)
        {
            foreach (object geo in geometry)
            {
                RenderRhinoMeshes(geo as dynamic, pipeline, material);
            }
        }
Exemplo n.º 3
0
        /***************************************************/

        public static void RenderRhinoWires(this List <object> geometry, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            foreach (object geo in geometry)
            {
                RenderRhinoWires(geo as dynamic, pipeline, bhColour, thickness);
            }
        }
Exemplo n.º 4
0
        /***************************************************/

        public static void RenderRhinoWires(RHG.PolylineCurve polyline, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            RHG.Polyline poly;
            if (polyline.TryGetPolyline(out poly))
            {
                pipeline.DrawPolyline(poly, bhColour, thickness);
            }
        }
Exemplo n.º 5
0
        /***************************************************/

        public static void RenderMeshes(BHG.PolySurface polySurface, Rhino.Display.DisplayPipeline pipeline, DisplayMaterial material)
        {
            List <BHG.ISurface> surfaces = polySurface.Surfaces;

            for (int i = 0; i < surfaces.Count; i++)
            {
                pipeline.DrawBrepShaded(RHG.Brep.CreateFromSurface((RHG.Surface)surfaces[i].IToRhino()), material);
            }
        }
Exemplo n.º 6
0
        /***************************************************/

        public static void RenderMeshes(BHG.NurbsSurface surface, Rhino.Display.DisplayPipeline pipeline, DisplayMaterial material)
        {
            RHG.GeometryBase geometry = surface.ToRhino();
            if (geometry is RHG.Surface)
            {
                geometry = RHG.Brep.CreateFromSurface((RHG.Surface)geometry);
            }

            pipeline.DrawBrepShaded((RHG.Brep)geometry, material);
        }
Exemplo n.º 7
0
        /***************************************************/
        /**** Public Methods  - Mesh                    ****/
        /***************************************************/

        public static void RenderRhinoWires(RHG.Mesh mesh, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            if (mesh.VertexColors.Count == 0)
            {
                pipeline.DrawMeshWires(mesh, bhColour);
            }
            else if (GH.CentralSettings.PreviewMeshEdges)
            {
                pipeline.DrawMeshWires(mesh, bhColour);
            }
        }
Exemplo n.º 8
0
        /***************************************************/
        /**** Public Methods  - Mesh                    ****/
        /***************************************************/

        public static void RenderRhinoMeshes(RHG.Mesh mesh, Rhino.Display.DisplayPipeline pipeline, DisplayMaterial material)
        {
            if (mesh.VertexColors.Count > 0)
            {
                pipeline.DrawMeshFalseColors(mesh);
            }
            else
            {
                pipeline.DrawMeshShaded(mesh, material);
            }
        }
Exemplo n.º 9
0
        /***************************************************/

        public static void RenderMeshes(BHG.CompositeGeometry composite, Rhino.Display.DisplayPipeline pipeline, DisplayMaterial material)
        {
            if (composite.Elements.Count == 0)
            {
                return;
            }
            foreach (BHG.IGeometry geom in composite.Elements)
            {
                try
                {
                    RenderMeshes(geom as dynamic, pipeline, material);
                }
                catch (Exception) { }
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// Draws one brep. Override this method to add your custom behavior.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="brep">A brep object.</param>
 /// <param name="pipeline">The current display pipeline.</param>
 protected virtual void DrawBrepObject(Rhino.DocObjects.BrepObject brep, DisplayPipeline pipeline )
 {
 }
Exemplo n.º 11
0
 /// <summary>
 /// If Style==Wireframe, then the default decomposes the curve object into
 /// nurbs curve segments and calls the virtual DrawNurbsCurve for each segment.
 /// </summary>
 /// <param name="curve">A document curve object.</param>
 /// <param name="pipeline">The drawing pipeline.</param>
 protected virtual void DrawCurveObject(Rhino.DocObjects.CurveObject curve, DisplayPipeline pipeline )
 {
   IntPtr pConstThis = ConstPointer();
   IntPtr pConstCurve = curve.ConstPointer();
   IntPtr pPipeline = pipeline.NonConstPointer();
   UnsafeNativeMethods.CRhinoVisualAnalysisMode_DrawCurveObject(pConstThis, pConstCurve, pPipeline);
 }
Exemplo n.º 12
0
        /***************************************************/

        public static void RenderMeshes(BHG.PlanarSurface surface, Rhino.Display.DisplayPipeline pipeline, DisplayMaterial material)
        {
            pipeline.DrawBrepShaded(surface.ToRhino(), material);
        }
Exemplo n.º 13
0
        /***************************************************/
        /**** Public Methods  - Representations         ****/
        /***************************************************/

        public static void RenderRhinoWires(Text3d text3D, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            pipeline.Draw3dText(text3D, bhColour, text3D.TextPlane);
        }
Exemplo n.º 14
0
        /***************************************************/

        public static void RenderRhinoWires(RHG.Sphere sphere, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            pipeline.DrawSphere(sphere, bhColour);
        }
Exemplo n.º 15
0
        /***************************************************/
        /**** Public Methods  - Curves                  ****/
        /***************************************************/

        public static void RenderMeshes(BHG.Arc arc, Rhino.Display.DisplayPipeline pipeline, DisplayMaterial material)
        {
            return;
        }
Exemplo n.º 16
0
        /***************************************************/

        public static void RenderMeshes(BHG.CoordinateSystem.Cartesian coordinateSystem, Rhino.Display.DisplayPipeline pipeline, DisplayMaterial material)
        {
            return;
        }
Exemplo n.º 17
0
        /***************************************************/
        /**** Public Methods  - Miscellanea             ****/
        /***************************************************/

        public static void RenderMeshes(BHG.BoundingBox bbBox, Rhino.Display.DisplayPipeline pipeline, DisplayMaterial material)
        {
            pipeline.DrawBrepShaded(RHG.Brep.CreateFromBox(bbBox.ToRhino()), material);
        }
Exemplo n.º 18
0
        /***************************************************/
        /**** Public Methods  - Mesh                    ****/
        /***************************************************/

        public static void RenderMeshes(BHG.Mesh mesh, Rhino.Display.DisplayPipeline pipeline, DisplayMaterial material)
        {
            RHG.Mesh rMesh = mesh.ToRhino();
            pipeline.DrawMeshShaded(rMesh, material);
        }
Exemplo n.º 19
0
 /// <summary>
 /// Draws a NURBS curve. This is a good function to override for
 /// analysis modes like curvature hair display.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="obj">A Rhino object corresponding to the curve.</param>
 /// <param name="curve">The curve geometry.</param>
 /// <param name="pipeline">The current display pipeline.</param>
 protected virtual void DrawNurbsCurve(Rhino.DocObjects.RhinoObject obj, Rhino.Geometry.NurbsCurve curve, DisplayPipeline pipeline)
 {
 }
Exemplo n.º 20
0
 /// <summary>
 /// Draws a mesh.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="obj">A Rhino object corresponding to the surface.</param>
 /// <param name="mesh">The mesh geometry.</param>
 /// <param name="pipeline">The current display pipeline.</param>
 protected virtual void DrawMesh(Rhino.DocObjects.RhinoObject obj, Rhino.Geometry.Mesh mesh, DisplayPipeline pipeline )
 {
 }
Exemplo n.º 21
0
        /***************************************************/

        public static void RenderRhinoWires(RHG.ArcCurve arc, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            pipeline.DrawArc(arc.Arc, bhColour, thickness);
        }
Exemplo n.º 22
0
        /***************************************************/

        public static void RenderRhinoWires(RHG.Cylinder cylinder, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            pipeline.DrawCylinder(cylinder, bhColour);
        }
Exemplo n.º 23
0
        /***************************************************/

        public static void RenderRhinoWires(RHG.Circle circle, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            pipeline.DrawCircle(circle, bhColour, thickness);
        }
Exemplo n.º 24
0
        /***************************************************/

        public static void RenderRhinoWires(RHG.Torus torus, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            pipeline.DrawTorus(torus, bhColour);
        }
Exemplo n.º 25
0
        /***************************************************/
        /**** Private Methods  - Fallback               ****/
        /***************************************************/

        private static void RenderRhinoWires(this object fallback, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            // fallback in case no method is found for the provided runtime type
            return;
        }
Exemplo n.º 26
0
        /***************************************************/

        public static void RenderRhinoWires(RHG.Box box, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            pipeline.DrawBox(box, bhColour, thickness);
        }
Exemplo n.º 27
0
        private static void DrawPlane(DisplayPipeline di, RhinoViewport vp, Plane plane)
        {
            double num;

            if (!vp.GetWorldToScreenScale(plane.Origin, out num))
                return;

            var unit = 10.0;

            if ((unit * num) < 20.0)
                unit = 20.0 / num;

            unit *= 0.2;

            var min = -5;
            var max = 5;

            for (var x = min; x <= max; x++)
            {
                var p0 = plane.PointAt(min * unit, x * unit);
                var p1 = plane.PointAt(max * unit, x * unit);

                if (x == 0)
                {
                    var origin = plane.Origin;
                    di.DrawLine(p0, origin, Color.Gray);
                    di.DrawLine(origin, p1, Color.DarkRed, 3);
                    di.DrawArrowHead(p1, p1 - origin, Color.DarkRed, 0.0, 1.0 * unit);
                }
                else
                {
                    di.DrawLine(p0, p1, Color.Gray);
                }
            }

            for (var y = min; y <= max; y++)
            {
                var p0 = plane.PointAt(y * unit, min * unit);
                var p1 = plane.PointAt(y * unit, max * unit);

                if (y == 0)
                {
                    var origin = plane.Origin;
                    di.DrawLine(p0, origin, Color.Gray);
                    di.DrawLine(origin, p1, Color.DarkGreen, 3);
                    di.DrawArrowHead(p1, p1 - origin, Color.DarkGreen, 0.0, 1.0 * unit);
                }
                else
                {
                    di.DrawLine(p0, p1, Color.Gray);
                }
            }
        }
Exemplo n.º 28
0
        /***************************************************/

        public static void RenderRhinoWires(RHG.Ellipse ellipse, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            pipeline.DrawCurve(ellipse.ToNurbsCurve(), bhColour, thickness);
        }
Exemplo n.º 29
0
 static void OnDrawRhinoObjectProc(Guid am_id, IntPtr pConstRhinoObject, IntPtr pRhinoDisplayPipeline)
 {
   VisualAnalysisMode mode = FindLocal(am_id);
   if (mode != null)
   {
     var rhobj = Rhino.DocObjects.RhinoObject.CreateRhinoObjectHelper(pConstRhinoObject);
     DisplayPipeline dp = new DisplayPipeline(pRhinoDisplayPipeline);
     try
     {
       Rhino.DocObjects.BrepObject brep = rhobj as Rhino.DocObjects.BrepObject;
       if (brep != null)
       {
         mode.DrawBrepObject(brep, dp);
         return;
       }
       Rhino.DocObjects.CurveObject curve = rhobj as Rhino.DocObjects.CurveObject;
       if (curve != null)
       {
         mode.DrawCurveObject(curve, dp);
         return;
       }
       Rhino.DocObjects.MeshObject mesh = rhobj as Rhino.DocObjects.MeshObject;
       if (mesh != null)
       {
         mode.DrawMeshObject(mesh, dp);
         return;
       }
       Rhino.DocObjects.PointCloudObject pointcloud = rhobj as Rhino.DocObjects.PointCloudObject;
       if (pointcloud != null)
       {
         mode.DrawPointCloudObject(pointcloud, dp);
         return;
       }
       Rhino.DocObjects.PointObject pointobj = rhobj as Rhino.DocObjects.PointObject;
       if (pointobj != null)
       {
         mode.DrawPointObject(pointobj, dp);
         return;
       }
     }
     catch (Exception) { }
   }
 }
Exemplo n.º 30
0
        /***************************************************/
        /**** Public Methods  - Vectors                 ****/
        /***************************************************/

        public static void RenderRhinoWires(RHG.Point3d point, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            pipeline.DrawPoint(point, bhColour);
        }
Exemplo n.º 31
0
        /***************************************************/

        public static void RenderRhinoWires(RHG.LineCurve line, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            pipeline.DrawLine(line.Line, bhColour, thickness);
        }
Exemplo n.º 32
0
 internal sealed override void Draw(DisplayPipeline pipeline, System.Drawing.Color color, int thickness)
 {
   IntPtr pDisplayPipeline = pipeline.NonConstPointer();
   int argb = color.ToArgb();
   IntPtr pCurveDisplay = CurveDisplay();
   UnsafeNativeMethods.CurveDisplay_Draw(pCurveDisplay, pDisplayPipeline, argb, thickness);
 }
Exemplo n.º 33
0
        /***************************************************/

        public static void RenderRhinoWires(RHG.NurbsCurve curve, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            pipeline.DrawCurve(curve, bhColour, thickness);
        }
Exemplo n.º 34
0
 static void OnDrawGeometryProc(Guid am_id, IntPtr pConstRhinoObject, IntPtr pConstGeometry, IntPtr pRhinoDisplayPipeline)
 {
   VisualAnalysisMode mode = FindLocal(am_id);
   if (mode != null)
   {
     var rhobj = Rhino.DocObjects.RhinoObject.CreateRhinoObjectHelper(pConstRhinoObject);
     var geom = Rhino.Geometry.GeometryBase.CreateGeometryHelper(pConstGeometry, null);
     if (geom != null)
       geom.DoNotDestructOnDispose();
     DisplayPipeline dp = new DisplayPipeline(pRhinoDisplayPipeline);
     Rhino.Geometry.Mesh mesh = geom as Rhino.Geometry.Mesh;
     try
     {
       if (mesh != null)
       {
         mode.DrawMesh(rhobj, mesh, dp);
         return;
       }
       Rhino.Geometry.NurbsCurve nurbscurve = geom as Rhino.Geometry.NurbsCurve;
       if (nurbscurve != null)
       {
         mode.DrawNurbsCurve(rhobj, nurbscurve, dp);
         return;
       }
       Rhino.Geometry.NurbsSurface nurbssurf = geom as Rhino.Geometry.NurbsSurface;
       if (nurbssurf != null)
       {
         mode.DrawNurbsSurface(rhobj, nurbssurf, dp);
         return;
       }
     }
     catch (Exception) { }
   }
 }
Exemplo n.º 35
0
        /***************************************************/

        public static void RenderRhinoWires(RHG.Polyline polyline, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            pipeline.DrawPolyline(polyline, bhColour, thickness);
        }
Exemplo n.º 36
0
 /// <summary>
 /// Draws one mesh. Override this method to add your custom behavior.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="mesh">A mesh object.</param>
 /// <param name="pipeline">The current display pipeline.</param>
 protected virtual void DrawMeshObject(Rhino.DocObjects.MeshObject mesh, DisplayPipeline pipeline )
 {
 }
Exemplo n.º 37
0
        /***************************************************/

        public static void RenderRhinoWires(RHG.NurbsSurface surface, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            pipeline.DrawSurface(surface, bhColour, thickness);
        }
Exemplo n.º 38
0
 /// <summary>
 /// Draws one point cloud. Override this method to add your custom behavior.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="pointCloud">A point cloud object.</param>
 /// <param name="pipeline">The current display pipeline.</param>
 protected virtual void DrawPointCloudObject(Rhino.DocObjects.PointCloudObject pointCloud, DisplayPipeline pipeline )
 {
 }
Exemplo n.º 39
0
        /***************************************************/

        public static void RenderRhinoWires(RHG.Brep brep, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            pipeline.DrawBrepWires(brep, bhColour, 0);
        }
Exemplo n.º 40
0
 /// <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(Rhino.DocObjects.RhinoObject obj, Rhino.Geometry.NurbsSurface surface, DisplayPipeline pipeline)
 {
 }
Exemplo n.º 41
0
        /***************************************************/
        /**** Public Methods - Solids                   ****/
        /***************************************************/

        public static void RenderRhinoWires(RHG.Cone cone, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            pipeline.DrawCone(cone, bhColour);
        }
 internal override void Draw(DisplayPipeline pipeline, System.Drawing.Color color, int thickness)
 {
   IntPtr ptr = ConstPointer();
   IntPtr pDisplayPipeline = pipeline.NonConstPointer();
   int argb = color.ToArgb();
   UnsafeNativeMethods.ON_LineCurve_Draw(ptr, pDisplayPipeline, argb, thickness);
 }
 internal DisplayPipelineAttributes(DisplayPipeline parent)
 {
   m_parent = parent;
 }