示例#1
0
        public override void Draw(UFSession session, string filename)
        {
            DrawTool drawTool = new DrawTool(session);

            drawTool.AddNewModel(filename);
            Point origin = new Point(0, 0, 0);

            Tag[] circle    = new Tag[] { drawTool.DrawCircle(origin, nutDiam / 2) };
            Tag[] outCircle = drawTool.Extrude(circle, new double[] { 0.0, 0.0, 1.0 }, "0.0", new string[] { "0", height.ToString() }, FeatureSigns.Nullsign);

            drawTool.MakeHoleZ(holeDiam, holeHeight, 120 * Math.PI / 180, new Point(0, holeDist / 2, 0), 1);
            drawTool.MakeHoleZ(holeDiam, holeHeight, 120 * Math.PI / 180, new Point(0, -holeDist / 2, 0), 1);
            drawTool.MakeHoleZ(holeDiam, holeHeight, 120 * Math.PI / 180, new Point(holeDist / 2, 0, 0), 1);
            drawTool.MakeHoleZ(holeDiam, holeHeight, 120 * Math.PI / 180, new Point(-holeDist / 2, 0, 0), 1);

            Tag[] innerCircle = new Tag[] { drawTool.DrawCircle(origin, (threadMaxDiam - 2) / 2) };
            drawTool.Extrude(innerCircle, new double[] { 0.0, 0.0, 1.0 }, "0.0", new string[] { "0", height.ToString() }, FeatureSigns.Negative);

            Tag outputTag = outCircle[0];
            Tag model;

            session.Modl.AskFeatBody(outputTag, out model);

            Tag[] edges;
            session.Modl.AskBodyEdges(model, out edges);
            List <Tag> chamfers = new List <Tag>();
            Tag        edge;

            for (int i = 0; i < 2; i++)
            {
                session.Modl.AskListItem(edges, i, out edge);
                chamfers.Add(edge);
            }
            drawTool.MakeChamfer(chamfers.ToArray(), 45, outChamfer);

            chamfers.Clear();
            for (int i = 3; i < 10; i += 2)
            {
                session.Modl.AskListItem(edges, i, out edge);
                chamfers.Add(edge);
            }
            drawTool.MakeChamfer(chamfers.ToArray(), 45, holeChamfer);

            Tag[] facesArray;
            session.Modl.AskFeatBody(outputTag, out model);
            session.Modl.AskBodyFaces(model, out facesArray);
            Tag startFace, threadFace;

            session.Modl.AskListItem(facesArray, 11, out threadFace);
            session.Modl.AskListItem(facesArray, 1, out startFace);
            drawTool.MakeThread(threadMaxDiam, threadMaxDiam - 2, threadMaxDiam - 1, height, threadStep, threadFace, startFace);

            drawTool.MakeCylHoleZ(threadMaxDiam, 45 * Math.PI / 180, origin, 1, innerChamfer);
            drawTool.MakeCylHoleZ(threadMaxDiam, 45 * Math.PI / 180, new Point(0, 0, height), -1, innerChamfer);

            drawTool.SaveModel();
        }
示例#2
0
        public override void Draw(UFSession session, string filename)
        {
            DrawTool drawTool = new DrawTool(session);

            drawTool.AddNewModel(filename);
            Point origin = new Point(0, 0, 0);

            Tag[] circle    = new Tag[] { drawTool.DrawCircle(origin, diam / 2) };
            Tag[] outCircle = drawTool.Extrude(circle, new double[] { 0.0, 0.0, 1.0 }, "0.0", new string[] { "0", (length - pushLength).ToString() }, FeatureSigns.Nullsign);

            drawTool.MakeCylHoleZ(innerChamferDiam, innerChamferAngle * Math.PI / 180, origin, 1);

            Tag[] hexagon = drawTool.DrawHexagon(holeDiam, holeS, origin);
            drawTool.Extrude(hexagon, new double[] { 0.0, 0.0, 1.0 }, "0.0",
                             new string[] { "0", holeHexLength.ToString() }, FeatureSigns.Negative);

            drawTool.MakeHoleZ(holeS, holeTotalLength - holeHexLength, 120 * Math.PI / 180, new Point(0, 0, holeHexLength), 1);

            Tag outputTag = outCircle[0];
            Tag model;

            session.Modl.AskFeatBody(outputTag, out model);

            Tag[] facesArray;
            session.Modl.AskFeatBody(outputTag, out model);
            session.Modl.AskBodyFaces(model, out facesArray);
            Tag startFace, threadFace;

            session.Modl.AskListItem(facesArray, 1, out threadFace);
            session.Modl.AskListItem(facesArray, 3, out startFace);
            drawTool.MakeThread(diam, diam - 2, diam - 1, length - pushLength, 1.5, threadFace, startFace);

            Tag[] edgeArray;
            session.Modl.AskBodyEdges(model, out edgeArray);
            Tag edge;

            session.Modl.AskListItem(edgeArray, 8, out edge);
            drawTool.MakeChamfer(new Tag[] { edge }, outChamferAngle, outChamfer);

            drawTool.MakeSlice(new Point(0, diam / 2, length - pushLength), (diam - pushDiam) / 2, chamferAngle * Math.PI / 180, DrawTool.FunctionType.Ctg, -1, new string[] { "0", "360" }, origin);

            Tag[] pushPart = DrawPushPart(drawTool, new Point(0, 0, length - pushLength));
            drawTool.Revolve(pushPart, new string[] { "0", "360" }, origin, new double[] { 0.0, 0.0, 1.0 }, FeatureSigns.Positive);;

            session.Modl.AskFeatBody(outputTag, out model);
            session.Modl.AskBodyEdges(model, out edgeArray);
            session.Modl.AskListItem(edgeArray, 28, out edge);
            drawTool.MakeRounding(new Tag[] { edge }, roundingRadius);

            drawTool.SaveModel();
        }