Ejemplo n.º 1
0
        //--------------------------------------------------------------------------------------------------

        public static bool RenderEdge(IDrawingRenderer renderer, TopoDS_Edge edge, bool reverse, TopoDS_Face face)
        {
            var res = true;

            reverse ^= edge.Orientation() == TopAbs_Orientation.TopAbs_REVERSED;

            double first = 0, last = 0;

            if (face != null)
            {
                var curve = BRep_Tool.CurveOnSurface(edge, new Geom_Plane(Ax3.XOY), new TopLoc_Location(), ref first, ref last);
                if (curve == null)
                {
                    return(false);
                }

                res &= RenderCurve(renderer, curve, first, last, reverse);
            }
            else
            {
                if (!(edge.TShape() is BRep_TEdge tedge))
                {
                    return(res);
                }

                var curves = tedge.CurvesList();
                if (reverse)
                {
                    curves.Reverse();
                }

                foreach (var curveOnSurface in curves.OfType <BRep_CurveOnSurface>())
                {
                    var curve = curveOnSurface.PCurve();
                    first = curveOnSurface.First();
                    last  = curveOnSurface.Last();
                    res  &= RenderCurve(renderer, curve, first, last, reverse);
                }
            }

            return(res);
        }
Ejemplo n.º 2
0
        //--------------------------------------------------------------------------------------------------

        void _ExportEdge(TopoDS_Edge edge, bool reverse, TopoDS_Face face)
        {
            reverse ^= edge.Orientation() == TopAbs_Orientation.TopAbs_REVERSED;

            double first = 0, last = 0;

            if (face != null)
            {
                var curve = BRep_Tool.CurveOnSurface(edge, new Geom_Plane(Ax3.XOY), new TopLoc_Location(), ref first, ref last);
                if (curve == null)
                {
                    return;
                }

                AddCurve(curve, reverse, first, last);
            }
            else
            {
                var tedge = edge.TShape() as BRep_TEdge;
                if (tedge == null)
                {
                    return;
                }

                var curves = tedge.CurvesList();
                if (reverse)
                {
                    curves.Reverse();
                }

                foreach (var curveOnSurface in curves.Cast <BRep_CurveOnSurface>())
                {
                    var curve = curveOnSurface.PCurve();
                    first = curveOnSurface.First();
                    last  = curveOnSurface.Last();
                    AddCurve(curve, reverse, first, last);
                }
            }
        }