Ejemplo n.º 1
0
        public void DrawViewportWires(IGH_PreviewArgs args)
        {
            IGH_StructureEnumerator data = this.VolatileData.AllData(true);
            Color c = args.WireColour;

            if (Attributes.Selected)
            {
                c = args.WireColour_Selected;
            }

            foreach (IMesh m in data)
            {
                if (!m.ElementTypes.Contains(-1))
                {
                    args.Display.DrawMeshWires(m.RenderMesh, c);
                }
                else
                {
                    int[]     hf;
                    Point3d[] pts;
                    foreach (IElement e in m.Elements)
                    {
                        if (e.TopologicDimension == 2)
                        {
                            pts = IRhinoGeometry.GetPointsFromElements(e.Vertices, m);
                            args.Display.DrawPolyline(pts, c);
                        }
                        else
                        {
                            if (!m.IsMultidimensionalMesh)
                            {
                                for (int i = 1; i <= e.HalfFacetsCount; i++)
                                {
                                    if (e.IsNakedSiblingHalfFacet(i))
                                    {
                                        e.GetHalfFacet(i, out hf);
                                        pts = IRhinoGeometry.GetPointsFromElements(hf, m);
                                        args.Display.DrawPolyline(pts, c);
                                    }
                                }
                            }
                            else
                            {
                                if (e.IsBoundaryElement())
                                {
                                    for (int i = 1; i <= e.HalfFacetsCount; i++)
                                    {
                                        e.GetHalfFacet(i, out hf);
                                        pts = IRhinoGeometry.GetPointsFromElements(hf, m);
                                        args.Display.DrawPolyline(pts, c);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            if (RenderMesh == null)
            {
                return;
            }

            // Check high order elements (visualization is not supported with rhino mesh)
            if (!_elementTypes.Contains(-1) && !_elementTypes.Contains(17) && !_elementTypes.Contains(18) &&
                !_elementTypes.Contains(19) && !_elementTypes.Contains(9) && !_elementTypes.Contains(16) &&
                !_elementTypes.Contains(11))
            {
                args.Pipeline.DrawMeshWires(RenderMesh, args.Color);
            }
            else
            {
                int[]     hf;
                Point3d[] pts;
                foreach (IElement e in Elements)
                {
                    if (e.TopologicDimension == 2)
                    {
                        pts = IRhinoGeometry.GetPointsFromElements(e.Vertices, this);
                        args.Pipeline.DrawPolyline(pts, args.Color);
                    }
                    else
                    {
                        if (!IsMultidimensionalMesh)
                        {
                            for (int i = 1; i <= e.HalfFacetsCount; i++)
                            {
                                if (e.IsNakedSiblingHalfFacet(i))
                                {
                                    e.GetHalfFacet(i, out hf);
                                    pts = IRhinoGeometry.GetPointsFromElements(hf, this);
                                    args.Pipeline.DrawPolyline(pts, args.Color);
                                }
                            }
                        }
                        else
                        {
                            if (e.IsBoundaryElement())
                            {
                                for (int i = 1; i <= e.HalfFacetsCount; i++)
                                {
                                    e.GetHalfFacet(i, out hf);
                                    pts = IRhinoGeometry.GetPointsFromElements(hf, this);
                                    args.Pipeline.DrawPolyline(pts, args.Color);
                                }
                            }
                        }
                    }
                }
            }
        }