public void MakeBolid(AssemblyParameters parameters) { #region parameters lengthOfMainPart = 800 / 100.0; heightOfMainPart = 80 / 100.0; widthOfMainPart = 150 / 100.0; #endregion createPart(); var Part = swDoc; SketchSegment segment; SketchManager sketchManager = Part.SketchManager; FeatureManager featureManager = Part.FeatureManager; bool boolstatus; boolstatus = Part.Extension.SelectByID2("Front Plane", "PLANE", 0, 0, 0, false, 0, null, 0); Part.SketchManager.InsertSketch(true); segment = sketchManager.CreateLine(0, 0, 0, -lengthOfMainPart, 0, 0); segment = sketchManager.CreateLine(-lengthOfMainPart, 0, 0, -lengthOfMainPart, heightOfMainPart, 0); segment = sketchManager.CreateLine(-lengthOfMainPart, heightOfMainPart, 0, 0, heightOfMainPart, 0); segment = sketchManager.CreateLine(0, heightOfMainPart, 0, 0, 0, 0); Part.Extension.SelectByID2("Line1", "SKETCHSEGMENT", 0, 0, 0, false, 0, null, 0); var extrusion = featureManager.FeatureExtrusion2(true, false, false, 6, 0, widthOfMainPart, 0.01, false, false, false, false, 1.74532925199433E-02, 1.74532925199433E-02, false, false, false, false, true, true, true, 0, 0, false); sketchManager.InsertSketch(true); Part.ClearSelection(); var firstVal = -widthOfMainPart / 2.0; var secondVal = widthOfMainPart / 2.0; sketchManager.InsertSketch(false); Part.Extension.SelectByID2("", "EDGE", 0, 0.04, firstVal, true, 1, null, 1); Part.Extension.SelectByID2("", "EDGE", 0, 0.04, secondVal, true, 1, null, 1); Part.FeatureManager.InsertFeatureChamfer(4, 2, 2.5, 0, 0.6, 0, 0, 0); Part.ClearSelection2(true); Part.Extension.SelectByID2("", "EDGE", -1.60359675146537E-03, 0.468692650695658, -0.161665083159619, false, 1, null, 0); Part.Extension.SelectByID2("", "EDGE", 1.24126468108443E-05, 0.432705387515739, 0.150090293621304, true, 1, null, 0); Part.FeatureManager.FeatureFillet3(195, 0.2, 0.02, 0, 0, 0, 0, (0), (0), (0), (0), (0), (0), (0)); Part.ClearSelection2(true); //sketchManager.InsertSketch(false); Part.Extension.SelectByID2("", "EDGE", -2.50145207253843, 0.409842119252346, 0.759927555199994, true, 1, null, 0); Part.Extension.SelectByID2("", "EDGE", -2.50145207253843, 0.409842119252346, 0.759927555199994, false, 1, null, 0); Part.FeatureManager.FeatureFillet3(195, 3, 3, 0, 0, 0, 0, 0, null, null, null, null, null, null); Part.ClearSelection2(true); //sketchManager.InsertSketch(false); Part.Extension.SelectByID2("", "EDGE", -9.92190741726517E-04, 0.423385979796308, 0.156783427202669, false, 1, null, 0); Part.Extension.SelectByID2("", "EDGE", -3.0946920736028E-03, 0.461205360135011, -0.128842154520996, true, 1, null, 0); Part.FeatureManager.FeatureFillet3(195, 0.2, 3, 0, 0, 0, 0, 0, null, null, null, null, null, null); //Start creating bottom part Part.Extension.SelectByID2("Top Plane", "PLANE", 0, 0, 0, false, 0, null, 0); sketchManager.InsertSketch(true); Part.ClearSelection2(true); double distanceBetweenMainPartAndWheel = 125.0 / 100.0; double widthOFDetailThatLinksMainPartAndWheel = 60.0 / 100.0; Part.SketchManager.CreateLine(-lengthOfMainPart, -widthOfMainPart / 2, 0, -lengthOfMainPart, -widthOfMainPart / 2 - 125 / 100.0, 0); Part.SketchManager.CreateLine(-lengthOfMainPart, -widthOfMainPart / 2 - 125 / 100.0, 0, -lengthOfMainPart + widthOFDetailThatLinksMainPartAndWheel, -widthOfMainPart / 2 - distanceBetweenMainPartAndWheel, 0); Part.SketchManager.CreateLine(-lengthOfMainPart + 60 / 100.0, -widthOfMainPart / 2 - 125.0 / 100.0, 0, -lengthOfMainPart + widthOFDetailThatLinksMainPartAndWheel, (-widthOfMainPart / 2 - 125 / 100.0) + 42.57247318 / 100.0, 0); double x1ForArc1 = -lengthOfMainPart + 122.31294971 / 100.0; double y1ForArc1 = -widthOfMainPart / 2.0; double z1ForArc1 = 0.0; double x2ForArc1 = x1ForArc1 + 106.29290168 / 100.0; double y2ForArc1 = y1ForArc1 - 226.27818952 / 100.0; double z2ForArc1 = 0.0; double x3ForArc1 = -lengthOfMainPart + 60.0 / 100.0; double y3ForArc1 = -widthOfMainPart / 2.0 + (-125.0 + 42.57247318) / 100.0; double z3ForArc1 = 0.0; // Part.SketchManager.Create3PointArc(x1ForArc, y1ForArc, z1ForArc, x2ForArc, y2ForArc, z2ForArc, x3ForArc, y3ForArc, z3ForArc); Part.SketchManager.Create3PointArc(x1ForArc1, y1ForArc1, 0.0, -7.4, -1.574275, 0.0, -7.022504, -1.175317, 0.0); Part.SetPickMode(); Part.ClearSelection2(true); Part.SketchManager.CreateLine(-6.776871, -widthOfMainPart / 2.0, 0, -7.4, -widthOfMainPart / 2.0, 0); Part.SketchManager.CreateLine(-7.4, -widthOfMainPart / 2.0, 0, -7.4, -1.273082, 0); Part.SketchManager.CreateLine(-7.4, -widthOfMainPart / 2.0, 0, -lengthOfMainPart, -widthOfMainPart / 2.0, 0); Part.SketchManager.Create3PointArc(-7.017346, -widthOfMainPart / 2.0, 0, -7.4, -1.273082, 0, -7.17822, -1.06516, 0); Part.SetPickMode(); Part.ClearSelection2(true); //Wing Part.SketchManager.CreateLine(x1ForArc1, y1ForArc1, z1ForArc1, x1ForArc1 + 107.68705029 / 100.0, y1ForArc1, z1ForArc1); Part.SketchManager.CreateLine(x1ForArc1 + 107.68705029 / 100.0, y1ForArc1, z1ForArc1, x1ForArc1 + (107.68705029 + 70.0) / 100.0, y1ForArc1 - 40.0 / 100, z1ForArc1); Part.SketchManager.CreateLine(x1ForArc1 + (107.68705029 + 70.0) / 100.0, y1ForArc1 - 40.0 / 100, z1ForArc1, x1ForArc1 + (107.68705029 + 70.0) / 100.0, y1ForArc1 - 90.0 / 100, z1ForArc1); double x1ForArc3 = Math.Round((x1ForArc1 + (107.68705029 + 70.0 + 240.0) / 100.0), 1); double y1ForArc3 = Math.Round(y1ForArc1 - (90.0 - 23.32770382) / 100.00, 1); double z1FForArc3 = 0.0; //Part.SketchManager.CreateLine(x1ForArc1 + (107.68705029 + 70.0) / 100.0, y1ForArc1 - 90.0 / 100, z1ForArc1, x1ForArc3, y1ForArc3, z1FForArc3); Part.SketchManager.Create3PointArc(x1ForArc3, y1ForArc3, z1FForArc3, -5, -1.65, 0, -3.988716, -1.938586, 0); double x1ForArc4 = x1ForArc3 + 110.0 / 100; double y1ForArc4 = y1ForArc3 + 78.15763134 / 100.0; double z1ForArc4 = 0.0; //Part.SketchManager.CreateLine(x1ForArc3, y1ForArc3, z1FForArc3, x1ForArc4, y1ForArc4, z1ForArc4); Part.SketchManager.Create3PointArc(x1ForArc4, y1ForArc4, z1ForArc4, x1ForArc3, y1ForArc3, z1FForArc3, -2.114926, -0.999068, 0); double x1ForArc5 = x1ForArc4 + 70.0 / 100.0; double y1ForArc5 = y1ForArc4 - 130.82992752 / 100.0; double z1ForArc5 = 0.0; //Part.SketchManager.CreateLine(x1ForArc4, y1ForArc4, z1ForArc4, x1ForArc5, y1ForArc5, z1ForArc5); Part.SketchManager.Create3PointArc(x1ForArc5, y1ForArc5, z1ForArc5, x1ForArc4, y1ForArc4, z1ForArc4, -1.047119, -1.215711, 0); double x2ForArc6 = x1ForArc4 + 13.58 / 100.0; double y2ForArc6 = y1ForArc4 + 7.03 / 100.0; double z2ForArc6 = 0.0; double x1ForArc6 = x1ForArc5; double y1ForArc6 = y1ForArc5 + 43.1674111 / 100.0; double z1ForArc6 = 0.0; //Part.SketchManager.CreateLine(x1ForArc6, y1ForArc6, z1ForArc6, x2ForArc6, y2ForArc6, z2ForArc6); Part.SketchManager.Create3PointArc(x1ForArc6, y1ForArc6, z1ForArc6, x2ForArc6, y2ForArc6, z2ForArc6, -1.004515, -0.966642, 0); double x2ForLine = x1ForArc6; double y2ForLine = y1ForArc6 + 110.0 / 100.0; double z2ForLine = 0.0; Part.SketchManager.CreateLine(x1ForArc6, y1ForArc6, z1ForArc6, x2ForLine, y2ForLine, z2ForLine); Part.SketchManager.Create3PointArc(x2ForArc6, y2ForArc6, z2ForArc6, x2ForLine, y2ForLine, z2ForLine, -1.097502, -0.462248, 0); double x2ForBackWing1 = 0; double y2ForBackWing1 = y1ForArc5; double z2ForBackWing1 = 0; Part.SketchManager.CreateLine(x1ForArc5, y1ForArc5, z1ForArc5, x2ForBackWing1, y2ForBackWing1, z2ForBackWing1); double halfOFLengthOFBackWing = 192.904 / 100.0; double x2ForBackWing2 = 0; double y2ForBackWIng2 = y2ForBackWing1 + halfOFLengthOFBackWing; double z2ForBackWing2 = 0; Part.SketchManager.CreateLine(x2ForBackWing1, y2ForBackWing1, z2ForBackWing1, x2ForBackWing2, y2ForBackWIng2, z2ForBackWing2); double x2ForBackWing3 = 0; double y2ForBackWing3 = y2ForBackWIng2 + halfOFLengthOFBackWing; double z2ForBackWIng3 = 0; Part.SketchManager.CreateLine(x2ForBackWing2, y2ForBackWIng2, z2ForBackWing2, x2ForBackWing3, y2ForBackWing3, z2ForBackWIng3); double x2ForBackWing4 = x1ForArc5; double y2ForBackWing4 = y2ForBackWing3; double z2ForBackWing4 = 0; Part.SketchManager.CreateLine(x2ForBackWing3, y2ForBackWing3, z2ForBackWIng3, x2ForBackWing4, y2ForBackWing4, z2ForBackWing4); //The same but another side of bolide double x2ForCorpseToWheelLine1 = -lengthOfMainPart; double y2ForCorpseToWheelLine1 = widthOfMainPart / 2 + distanceBetweenMainPartAndWheel; double z2ForCorpseToWheelLine1 = 0.0; Part.SketchManager.CreateLine(-lengthOfMainPart, widthOfMainPart / 2, 0, x2ForCorpseToWheelLine1, y2ForCorpseToWheelLine1, z2ForCorpseToWheelLine1); double x2ForCorpseToWheelLine2 = x2ForCorpseToWheelLine1 + widthOFDetailThatLinksMainPartAndWheel; double y2ForCoprseToWheelLine2 = y2ForCorpseToWheelLine1; double z2ForCoprseToWheelLine2 = z2ForCorpseToWheelLine1; Part.SketchManager.CreateLine(x2ForCorpseToWheelLine1, y2ForCorpseToWheelLine1, z2ForCorpseToWheelLine1, x2ForCorpseToWheelLine2, y2ForCoprseToWheelLine2, z2ForCoprseToWheelLine2); double x2ForCorpseToWheelLine3 = x2ForCorpseToWheelLine2; double y2ForCoprseToWheelLine3 = y2ForCorpseToWheelLine1 - 42.57247318 / 100.0; double z2ForCoprseToWheelLine3 = z2ForCoprseToWheelLine2; Part.SketchManager.CreateLine(x2ForCorpseToWheelLine2, y2ForCoprseToWheelLine2, z2ForCoprseToWheelLine2, x2ForCorpseToWheelLine3, y2ForCoprseToWheelLine3, z2ForCoprseToWheelLine3); double x1ForCorpseToWheelArc1 = x1ForArc1; double y1ForCorpseToWheelArc1 = -y1ForArc1; double z1ForCorpseToWheelArc1 = 0; Part.SketchManager.Create3PointArc(x2ForCorpseToWheelLine3, y2ForCoprseToWheelLine3, z2ForCoprseToWheelLine3, x1ForCorpseToWheelArc1, y1ForCorpseToWheelArc1, z1ForCorpseToWheelArc1, -7.02437, 1.177213, 0); double x2ForCorpseToWheelLine4 = -lengthOfMainPart + 60.0 / 100.0; double y2ForCorpseToWheelLine4 = widthOfMainPart / 2.0; double z2ForCorpseToWheelLine4 = 0; Part.SketchManager.CreateLine(x1ForCorpseToWheelArc1, y1ForCorpseToWheelArc1, z1ForCorpseToWheelArc1, x2ForCorpseToWheelLine4, y2ForCorpseToWheelLine4, z2ForCorpseToWheelLine4); double x2ForCoprseToWheelLine5 = x2ForCorpseToWheelLine4; double y2ForCorpseToWheelLine5 = widthOfMainPart / 2 + 52.3082 / 100.0; double z2ForCorpseToWheelLine5 = 0; Part.SketchManager.CreateLine(x2ForCorpseToWheelLine4, y2ForCorpseToWheelLine4, z2ForCorpseToWheelLine4, x2ForCoprseToWheelLine5, y2ForCorpseToWheelLine5, z2ForCorpseToWheelLine5); double x1ForCorpseToWheelArc2 = -lengthOfMainPart + 98.2654 / 100.0; double y1ForCorpseToWheelArc2 = y1ForCorpseToWheelArc1; double z1ForCorpseToWheelArc2 = z1ForCorpseToWheelArc1; Part.SketchManager.CreateLine(x2ForCorpseToWheelLine4, y2ForCorpseToWheelLine4, z2ForCorpseToWheelLine4, -lengthOfMainPart, widthOfMainPart / 2.0, z2ForCoprseToWheelLine2); Part.SketchManager.Create3PointArc(x2ForCoprseToWheelLine5, y2ForCorpseToWheelLine5, z2ForCorpseToWheelLine5, x1ForCorpseToWheelArc2, y1ForCorpseToWheelArc2, z1ForCorpseToWheelArc2, -7.169033, 0.997835, 0); double x2ForCorpseLine1 = x1ForArc1 + 107.68705029 / 100.0; double y2ForCorpseLine1 = widthOfMainPart / 2.0; double z2ForCorpseLine1 = 0; Part.SketchManager.CreateLine(x1ForCorpseToWheelArc2, y1ForCorpseToWheelArc2, z1ForCorpseToWheelArc2, x2ForCorpseLine1, y2ForCorpseLine1, z2ForCorpseLine1); double x2ForCorpseLine2 = x2ForCorpseLine1 + 70.0 / 100.0; double y2ForCorpseLine2 = y2ForCorpseLine1 + 40.0 / 100.0; double z2ForCorpseLine2 = 0.0; Part.SketchManager.CreateLine(x2ForCorpseLine1, y2ForCorpseLine1, z2ForCorpseLine1, x2ForCorpseLine2, y2ForCorpseLine2, z2ForCorpseLine2); double x2ForCorpseLine3 = x2ForCorpseLine2; double y2ForCorpseLine3 = y2ForCorpseLine2 + 50.0 / 100.0; double z2ForCorpseLIne3 = 0.0; Part.SketchManager.CreateLine(x2ForCorpseLine2, y2ForCorpseLine2, z2ForCorpseLine2, x2ForCorpseLine3, y2ForCorpseLine3, z2ForCorpseLIne3); double x2ForCorpseArc1 = x1ForArc3; double y2ForCorpseArc1 = -y1ForArc3; double z2ForCorpseArc1 = z1FForArc3; Part.SketchManager.Create3PointArc(x2ForCorpseLine3, y2ForCorpseLine3, z2ForCorpseLIne3, x2ForCorpseArc1, y2ForCorpseArc1, z2ForCorpseArc1, -3.563352, 1.899428, 0); double x2ForCorpseArc2 = x1ForArc4; double y2ForCorpseArc2 = -y1ForArc4; double z2ForCorpseArc2 = z1ForArc4; Part.SketchManager.Create3PointArc(x2ForCorpseArc1, y2ForCorpseArc1, z2ForCorpseArc1, x2ForCorpseArc2, y2ForCorpseArc2, z2ForCorpseArc2, -2.025267, 0.941125, 0); double x2ForCorpseArc3 = x2ForBackWing4; double y2ForCorpseArc3 = y2ForBackWing4; double z2ForCorpseArc3 = z2ForBackWing4; Part.SketchManager.Create3PointArc(x2ForCorpseArc2, y2ForCorpseArc2, z2ForCorpseArc2, x2ForCorpseArc3, y2ForCorpseArc3, z2ForCorpseArc3, -1.158409, 1.11352, 0); double x2ForCorpseArc4 = x2ForArc6; double y2ForCorpseArc4 = -y2ForArc6; double z2ForCorpseArc4 = z2ForArc6; double x1ForCorpseArc4 = x1ForArc6; double y1ForCorpseArc4 = -y1ForArc6; double z1ForCorpseArc4 = z1ForArc6; Part.SketchManager.Create3PointArc(x1ForCorpseArc4, y1ForCorpseArc4, z1ForCorpseArc4, x2ForCorpseArc4, y2ForCorpseArc4, z2ForCorpseArc4, -1.058286, 0.989618, 0); double x2ForCorpseLine4 = x2ForLine; double y2ForCorpseLine4 = -y2ForLine; double z2ForCorpseLine4 = z2ForLine; Part.SketchManager.CreateLine(x2ForCorpseArc4, y2ForCorpseArc4, z2ForCorpseArc4, x2ForCorpseLine4, y2ForCorpseLine4, z2ForCorpseLine4); Part.SketchManager.CreateLine(x1ForCorpseArc4, y1ForCorpseArc4, z1ForCorpseArc4, x2ForCorpseLine4, y2ForCorpseLine4, z2ForCorpseLine4); //close needed counturs Part.SketchManager.CreateLine(-8, 0.75, 0, -2.5, 0.75, 0); Part.SketchManager.CreateLine(-2.5, 0.75, 0, 0, 0.15, 0); Part.SketchManager.CreateLine(0, 0.15, 0, 0, 0.007679, 0); Part.SketchManager.CreateLine(-0.042941, -0.116145, 0, -0.153325, -0.186798, 0); Part.SketchManager.CreateLine(-0.153325, -0.186798, 0, -2.502459, -0.729218, 0); Part.SketchManager.CreateLine(-2.502459, -0.729218, 0, -2.85496, -0.75, 0); Part.SketchManager.CreateLine(-2.85496, -0.75, 0, -5.7, -0.75, 0); Part.SketchManager.CreateLine(-8, -0.75, 0, -8, 0.75, 0); Thread.Sleep(100); Part.SetPickMode(); Part.SelectionManager.EnableContourSelection = true; Part.Extension.SelectByID2("Sketch2", "SKETCHREGION", -3.9841093791155, 1.92165359018481E-02, -1.11273181579067, true, 4, null, 0); Part.Extension.SelectByID2("Sketch2", "SKETCHREGION", -6.90010975425287, 1.05342333640838, 1.97602960993305, true, 0, null, 0); Part.Extension.SelectByID2("Sketch2", "SKETCHREGION", -6.21591444832203, 2.1019999157831, -0.191076915736342, true, 0, null, 0); Part.Extension.SelectByID2("Sketch2", "SKETCHREGION", -4.3896245678695, -0.268919542014907, 1.3356196563234, true, 0, null, 0); Part.FeatureManager.FeatureExtrusion2(true, false, true, 0, 0, 0.4, 0.4, false, false, false, false, 1.74532925199433E-02, 1.74532925199433E-02, false, false, false, false, true, true, true, 0, 0, false); Part.SelectionManager.EnableContourSelection = false; frontLoft(); driverSit(); backWing(parameters); frontWing(parameters); partEnhancing(); bool saved = swDoc.SaveAs("C:\\Users\\jungl\\Documents\\bilide2\\mainPart.sldprt"); if (!saved) { MessageBox.Show("Solidworks не зміг зберегти корпус боліда. Потрібно перезапустити Solidworks"); } }