Esempio n. 1
0
        public Assembly(femap.model FemapModel)
        {
            FemapModel.feFileNew();
            FemapModel.feFileReadStep("C:/FemapModels/Piston.stp");
            FemapModel.feFileReadStep("C:/FemapModels/Rod.stp");
            FemapModel.feFileReadStep("C:/FemapModels/Finger.stp");
            FemapModel.feFileReadStep("C:/FemapModels/CoverRod.stp");
            FemapModel.feFileReadStep("C:/FemapModels/Crankshaft.stp");
            FemapModel.feModifyColorMultiple(zDataType.FT_SOLID, -1, zColor.FCL_GRAY130, 0, 1, 1);
            FemapModel.feModifyColorMultiple(zDataType.FT_SOLID, -2, zColor.FCL_GOLDENROD, 0, 1, 1);
            FemapModel.feModifyColorMultiple(zDataType.FT_SOLID, -3, zColor.FCL_GRAY220, 0, 1, 1);
            FemapModel.feModifyColorMultiple(zDataType.FT_SOLID, -4, zColor.FCL_GOLDENROD, 0, 1, 1);
            FemapModel.feModifyColorMultiple(zDataType.FT_SOLID, -5, zColor.FCL_DARKSEAGREEN, 0, 1, 1);

            Point[] points = new Point[100];
            for (int i = 0; i <= 10; i++)
            {
                points[i] = FemapModel.fePoint;
            }
            points[1].x = 0; points[1].y = 0; points[1].z = 0;
            points[2].x = 0; points[2].y = -51; points[3].z = 0;
            object vecDIRX, vecDIRY, vecDIRZ;

            FemapModel.feVectorAxis(-0, 0, true, out vecDIRX);
            FemapModel.feVectorAxis(-0, 2, true, out vecDIRZ);
            FemapModel.feVectorAxis(-0, 1, true, out vecDIRY);
            FemapModel.feAlignTo(zDataType.FT_SOLID, -1, points[2].xyz, vecDIRX, points[1].xyz, vecDIRZ);
            FemapModel.feAlignTo(zDataType.FT_SOLID, -1, points[0].xyz, vecDIRY, points[0].xyz, vecDIRX);
            FemapModel.Pref_WorkplaneNotVisible = true;
            FemapModel.feViewRegenerate(0);
            FemapModel.feFileSaveAs(false, "C:/FemapModels/Assembly.modfem");
        }
Esempio n. 2
0
        public void Create_Crankshaft()
        {
            Status.createStatusStr = "Построение детали";
            FemapModel.feFileNew();
            FemapModel.set_Info_WorkplaneOrigin(2, 1);
            Point[] points = new Point[1000];
            Set     feSet  = FemapModel.feSet;

            for (int i = 0; i <= 20; i++)
            {
                points[i] = FemapModel.fePoint;
            }
            points[0].x = -156; points[0].z = 1;
            points[1].z = 26 / 2;
            object x = FemapModel.feCircleCenter((double)63.5 / 2, points[0].xyz, true);

            FemapModel.feBoundaryFromCurves(-1);
            FemapModel.feSolidExtrude(0, 1, 2, 1, points[0].xyz, points[1].xyz);
            FemapModel.set_Info_WorkplaneOrigin(2, 26 / 2);
            points[2].z = 30 / 2;
            points[3].z = -26 / 2;
            FemapModel.feCircleCenter((double)72 / 2, points[0].xyz, true);
            FemapModel.feBoundaryFromCurves(-8);
            FemapModel.feSolidExtrude(0, 6, 0, 1, points[1].xyz, points[2].xyz);
            FemapModel.feGenerateReflect(zDataType.FT_SOLID, -2, points[0].xyz, points[3].xyz, 0, true);
            feSet = FemapModel.feSet;
            feSet.AddRange(1, 3, 1);
            FemapModel.feSolidAdd(feSet.ID, true);
            feSet = FemapModel.feSet;
            feSet.AddRange(4, 7, 1);
            FemapModel.feSolidChamfer(feSet.ID, 0.5);
            feSet = FemapModel.feSet;
            feSet.Add(14); feSet.Add(13); feSet.Add(20); feSet.Add(19);
            FemapModel.feSolidChamfer(feSet.ID, 2);
            FemapModel.set_Info_WorkplaneOrigin(2, 30 / 2);

            points[6].x = -156;
            points[7].x = -156; points[7].y = 30;
            points[8].x = -156 - 72 / 2;
            points[9].x = -156 - 86 / 2; points[9].y = 30;
            FemapModel.feArcAngleCenterStart(180, points[6].xyz, points[8].xyz, true);
            FemapModel.feArcAngleCenterStart(-180, points[7].xyz, points[9].xyz, true);
            object[] pointArcXYZ = new object[20];
            FemapModel.feCoordOnPoint(42, out pointArcXYZ[3]);
            FemapModel.feCoordOnPoint(38, out pointArcXYZ[4]);
            FemapModel.feLinePoints(true, pointArcXYZ[3], pointArcXYZ[4], true);
            FemapModel.feCoordOnPoint(44, out pointArcXYZ[5]);
            FemapModel.feCoordOnPoint(40, out pointArcXYZ[6]);
            FemapModel.feLinePoints(true, pointArcXYZ[5], pointArcXYZ[6], true);
            feSet.AddRange(41, 44, 1);
            FemapModel.feBoundaryFromCurves(feSet.ID);
            points[10].z = 30 / 2;
            points[11].z = 30 / 2 + 18;
            FemapModel.feSolidExtrude(0, 23, 0, 1, points[10].xyz, points[11].xyz);
            FemapModel.feGenerateReflect(zDataType.FT_SOLID, -4, points[0].xyz, points[3].xyz, 0, true);
            feSet = FemapModel.feSet;
            feSet.AddRange(1, 10, 1);
            FemapModel.feSolidAdd(feSet.ID, true);

            points[12].z = 30 / 2 + 18;
            points[13].z = 30 / 2 + 18 + 2;
            FemapModel.set_Info_WorkplaneOrigin(2, 30 / 2 + 18);
            FemapModel.feCircleCenter((double)72 / 2, points[7].xyz, true);
            FemapModel.feBoundaryFromCurves(-69);
            FemapModel.feSolidExtrude(0, 36, 0, 1, points[12].xyz, points[13].xyz);
            FemapModel.feGenerateReflect(zDataType.FT_SOLID, -6, points[0].xyz, points[3].xyz, 0, true);
            feSet = FemapModel.feSet;
            feSet.AddRange(1, 10, 1);
            FemapModel.feSolidAdd(feSet.ID, true);
            feSet.Add(73); feSet.Add(72); feSet.Add(79); feSet.Add(78);
            FemapModel.feSolidChamfer(feSet.ID, 2);

            FemapModel.set_Info_WorkplaneOrigin(2, 30 / 2 + 18 + 2);
            FemapModel.feCircleCenter((double)63.5 / 2, points[7].xyz, true);
            FemapModel.feBoundaryFromCurves(-90);
            points[14].z = 30 / 2 + 18 + 2;
            points[15].z = 30 / 2 + 18 + 2 + 26 / 2;
            FemapModel.feSolidExtrude(0, 49, 0, 1, points[14].xyz, points[15].xyz);
            FemapModel.feGenerateReflect(zDataType.FT_SOLID, -8, points[0].xyz, points[3].xyz, 0, true);
            feSet = FemapModel.feSet;
            feSet.AddRange(1, 10, 1);
            FemapModel.feSolidAdd(feSet.ID, true);

            feSet.Add(96); feSet.Add(95); feSet.Add(101); feSet.Add(102);
            FemapModel.feSolidChamfer(feSet.ID, 0.5);

            points[16].x = -156; points[16].z = 1;
            points[17].x = -156; points[17].y = 156;

            FemapModel.feRotateBy(zDataType.FT_SOLID, -1, points[16].xyz, points[17].xyz, 180, 0);

            FemapModel.set_Info_WorkplaneOrigin(2, 0);

            FemapModel.feViewRegenerate(0);
            FemapModel.feFileSaveAs(false, "C:/FemapModels/Crankshaft.modfem");
            feSet = FemapModel.feSet;
            feSet.Add(1);
            FemapModel.feFileWriteStep("C:/FemapModels/Crankshaft.stp", feSet.ID);
            Status.createStatusStr = "Готово";
            FemapModel.feAppMessage(zMessageColor.FCM_WARNING, Status.createStatusStr);
        }