예제 #1
0
        public static FaceIntersectionLineResult IntersectLine(this TopoDS_Face face, TopoDS_Face other, double tol)
        {
            var s1   = face.Surface();
            var s2   = other.Surface();
            var a    = new GeomAPI_IntSS(s1, s2, tol);
            var C    = a.Line(1);
            var edge = new BRepBuilderAPI_MakeEdge(C, C.FirstParameter(), C.LastParameter());
            var v1   = edge.Vertex1();
            var v2   = edge.Vertex2();
            var i1   = BRep_Tool.Pnt(v1);
            var i2   = BRep_Tool.Pnt(v2);

            return(new FaceIntersectionLineResult(C, new Line3D(i1.ToVector3D(), i2.ToVector3D())));
        }
예제 #2
0
        public static TopoDS_Face Offset(this TopoDS_Face face, double off, Vector3D sideRefPt = null)
        {
            var surface = face.Surface();
            var props   = surface.LProp_SLProps(face.UVBounds());
            var normal  = props.Normal();

            var offFact = 1.0;

            if (sideRefPt != null)
            {
                if (!sideRefPt.Normalized().Concordant(Constants.NormalizedLengthTolerance, normal.ToVector3D()))
                {
                    offFact *= -1;
                }
            }

            return(new BRepOffset_Offset(face, off * offFact).Face());
        }