コード例 #1
0
        public override bool Execute()
        {
            // Get the values of dimension and position attributes
            var firstPoint  = Dependency[0].TransformedPoint3D;
            var secondPoint = Dependency[1].TransformedPoint3D;
            var thirdPoint  = Dependency[2].TransformedPoint3D;

            var wire = OccShapeCreatorCode.BuildRectangle(firstPoint, secondPoint, thirdPoint);

            if ((wire == null) || (wire.IsNull))
            {
                return(false);
            }

            // Make also the shape axis before the shape regeneration
            var axis = new gpAx1 {
                Location = firstPoint.GpPnt
            };

            Axis = axis;

            Shape = wire;

            return(true);
        }
コード例 #2
0
        private static TopoDSFace BuildPlane(gpAx2 orientation, double rectangleLength)
        {
            var diagonalVector = new gpVec(orientation.XDirection);

            diagonalVector.Multiply(rectangleLength * Math.Sqrt(2));
            var secondPoint = GeomUtils.BuildTranslation(new Point3D(orientation.Location), diagonalVector);

            return(OccShapeCreatorCode.BuildRectangle(orientation.Location, secondPoint.GpPnt, orientation.Direction));
        }
コード例 #3
0
        /// <summary>
        ///   Builds a box receiving three points that describe the base rectangle and one being the height
        /// </summary>
        /// <param name = "axis"></param>
        /// <param name = "secondPoint"></param>
        /// <param name = "height"></param>
        /// <returns></returns>
        private static TopoDSShape MakeBox(gpAx1 axis, Point3D secondPoint, double height)
        {
            var face = OccShapeCreatorCode.BuildRectangle(axis.Location, secondPoint.GpPnt, axis.Direction);
            // Get the direction
            var dir    = GeomUtils.ExtractDirection(face);
            var vector = new gpVec(dir);

            vector.Multiply(height);

            return(new BRepPrimAPIMakePrism(face, vector, false, true).Shape);
        }
コード例 #4
0
        public override bool Execute()
        {
            var baseAxis    = Dependency[0].Axis3D;
            var firstPoint  = baseAxis.GpAxis.Location;
            var secondPoint = Dependency[1].TransformedPoint3D.GpPnt;
            var direction   = baseAxis.GpAxis.Direction;

            var wire = OccShapeCreatorCode.BuildRectangle(firstPoint, secondPoint, direction);

            if ((wire == null) || (wire.IsNull))
            {
                return(false);
            }

            // Generate also the visual shape axis before the shape regeneration
            Axis  = baseAxis.GpAxis;
            Shape = wire;

            return(true);
        }