Пример #1
0
        public override bool Run(FeatureContext context)
        {
            AdvFeatureTools advTool = new AdvFeatureTools();

            // Create the evolution spline
            Primitive2dTools tool2d = new Primitive2dTools();
            float            radius = 50;
            TopoShapeGroup   group  = new TopoShapeGroup();

            group.Add(tool2d.MakeArc(new Vector2(0, radius), radius, 0, 45));
            group.Add(tool2d.MakeLine(new Vector2(radius, radius), new Vector2(radius * 2, radius)));
            TopoShape spline = tool2d.ToBSplineCurve(group);

            // Create the profile section
            TopoShape profile = GlobalInstance.BrepTools.MakeCircle(new Vector3(100, 100, 0), 1, Vector3.UNIT_Z);

            // Create the path
            List <Vector3> pts = new List <Vector3>();

            pts.Add(new Vector3(100, 100, 0));
            pts.Add(new Vector3(100, 100, 100));
            pts.Add(new Vector3(100, 200, 400));
            TopoShape path = GlobalInstance.BrepTools.MakeSpline(pts);

            // Make sweep
            TopoShape sweepBody = advTool.MakeSweep(profile, path, spline, true);

            context.ShowGeometry(sweepBody);

            return(true);
        }
        public override bool Run(FeatureContext context)
        {
            //1. Create the path
            float     radius = 100;
            TopoShape arc    = GlobalInstance.BrepTools.MakeArc(Vector3.ZERO, new Vector3(-radius, -radius, 0), new Vector3(0, -radius, 0), Vector3.UNIT_Z);
            TopoShape line   = GlobalInstance.BrepTools.MakeLine(new Vector3(-radius, -radius, 0), new Vector3(-radius, -radius * 2, 0));

            TopoShapeGroup edges = new TopoShapeGroup();

            edges.Add(arc);
            edges.Add(line);
            TopoShape wire = GlobalInstance.BrepTools.MakeWire(edges);


            Vector3 dirZ = new Vector3(1, -1, 0);

            dirZ.Normalize();
            Vector3     dirX  = dirZ.CrossProduct(Vector3.UNIT_Z);
            Coordinate3 coord = new Coordinate3(Vector3.ZERO, dirX, Vector3.UNIT_Z, dirZ);


            TopoShape path = GlobalInstance.BrepTools.Transform(wire, coord);

            context.ShowGeometry(path);

            //2. Create the profile
            List <Vector3> points = new List <Vector3>();

            points.Add(new Vector3());
            points.Add(new Vector3(200, 0, 0));
            points.Add(new Vector3(200, 200, 0));
            points.Add(new Vector3(0, 200, 0));

            TopoShape polygon = GlobalInstance.BrepTools.MakePolygon(points);

            // 3. Make body
            AdvFeatureTools advFT = new AdvFeatureTools();
            TopoShape       shape = advFT.MakeEvolved(polygon, path, 0, true);

            context.ShowGeometry(shape);

            return(true);
        }
Пример #3
0
        private void evolvedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            List<Vector3> points = new List<Vector3>();
            points.Add(new Vector3());
            points.Add(new Vector3(200, 0, 0));
            points.Add(new Vector3(200, 200, 0));
            points.Add(new Vector3(0, 200, 0));

            TopoShape polygon = GlobalInstance.BrepTools.MakePolygon(points);

            float radius = 100;
            TopoShape arc = GlobalInstance.BrepTools.MakeArc(Vector3.ZERO, new Vector3(-radius, -radius, 0), new Vector3(0, -radius, 0), Vector3.UNIT_Z);
            TopoShape line = GlobalInstance.BrepTools.MakeLine(new Vector3(-radius, -radius, 0), new Vector3(-radius, -radius * 2, 0));

            TopoShapeGroup edges = new TopoShapeGroup();
            edges.Add(arc);
            edges.Add(line);
            TopoShape wire = GlobalInstance.BrepTools.MakeWire(edges);
            

            Vector3 dirZ = new Vector3(1,-1,0);
            dirZ.Normalize();
            Vector3 dirX = dirZ.CrossProduct(Vector3.UNIT_Z);
            Coordinate3 coord = new Coordinate3(Vector3.ZERO, dirX, Vector3.UNIT_Z, dirZ);

            
            TopoShape path = GlobalInstance.BrepTools.Transform(wire, coord);
            renderView.ShowGeometry(path, ++shapeId);

            AdvFeatureTools advFT = new AdvFeatureTools();
            TopoShape shape = advFT.MakeEvolved(polygon, path, 0, true);

            renderView.ShowGeometry(shape, ++shapeId);
        }
Пример #4
0
        private void swee2ToolStripMenuItem_Click(object sender, EventArgs e)
        {




            AdvFeatureTools advTool = new AdvFeatureTools();

            {
                Coordinate3 coord = new Coordinate3();
                coord.Origion = new Vector3(-0.5f, -1, 0);
                TopoShape profile = GlobalInstance.BrepTools.MakeRectangle(1,2,0.2f, coord);

                TopoShape path = GlobalInstance.BrepTools.MakeLine(Vector3.ZERO, new Vector3(0, 0, 100));

                //define the "S" curve
                float[] S ={0,40,-80,
                            1,10,0};
                TopoShape sweepBody = advTool.MakeSweep(profile, path, S, true);
                renderView.ShowGeometry(sweepBody, ++shapeId);
            }
            {
                Primitive2dTools tool2d = new Primitive2dTools();
                float radius = 50;
                TopoShapeGroup group = new TopoShapeGroup();

                group.Add(tool2d.MakeArc(new Vector2(0, radius), radius, 0, 45));
                group.Add(tool2d.MakeLine(new Vector2(radius, radius), new Vector2(radius * 2, radius)));
                TopoShape spline = tool2d.ToBSplineCurve(group);

                TopoShape profile = GlobalInstance.BrepTools.MakeCircle(new Vector3(100, 100, 0), 1, Vector3.UNIT_Z);
                List<Vector3> pts = new List<Vector3>();
                pts.Add(new Vector3(100, 100, 0));
                pts.Add(new Vector3(100, 100, 100));
                pts.Add(new Vector3(100, 200, 400));

                TopoShape path = GlobalInstance.BrepTools.MakeSpline(pts);
                TopoShape sweepBody = advTool.MakeSweep(profile, path, spline, true);

                renderView.ShowGeometry(sweepBody, ++shapeId);
            }
        }