一、代码
折弯的功能的使用一般与钣金的使用结合,代码如下:
Part.Extension.SelectByID2("前视基准面", "PLANE", 0, 0, 0, false, 0, null, 0);
Part.SketchManager.InsertSketch(true);
Part.ClearSelection2(true);
Part.SketchManager.CreateLine(-Convert.ToDouble(name2[4]) / 1000 - 0.1, Convert.ToDouble(name4[4]) / 1000, 0, Convert.ToDouble(name2[4]) / 1000 + 0.1, Convert.ToDouble(name4[4]) / 1000, 0);
Part.Extension.SelectByID2("草图2", "SKETCH", 0, 0, 0, false, 0, null, 0);
Part.Extension.SelectByRay(0, 0, 0, 0, 0, -1, 3.67553858238833E-02, 2, false, 0, 0);
Part.FeatureManager.InsertSheetMetal3dBend(((180 - Convert.ToDouble(name6[5])) / 180 * Math.PI), false, Convert.ToDouble(name6[4]) / 1000, false, 0, null);//弧度制算法 25/180 * 3.14
Part.ClearSelection2(true);
Part.Extension.SelectByID2("前视基准面", "PLANE", 0, 0, 0, false, 0, null, 0);
Part.SketchManager.InsertSketch(true);
Part.ClearSelection2(true);
Part.SketchManager.CreateLine(-Convert.ToDouble(name2[5]) / 1000 - 0.1, Convert.ToDouble(name4[5]) / 1000, 0, Convert.ToDouble(name2[5]) / 1000 + 0.1, Convert.ToDouble(name4[5]) / 1000, 0);
Part.Extension.SelectByID2("草图3", "SKETCH", 0, 0, 0, false, 0, null, 0);
Part.Extension.SelectByRay(0, 0, 0, 0, 0, -1, 3.67553858238833E-02, 2, false, 0, 0);
Part.FeatureManager.InsertSheetMetal3dBend(((180 - Convert.ToDouble(name6[5])) / 180 * Math.PI), false, Convert.ToDouble(name6[4]) / 1000, false, 0, null);//弧度制算法 25/180 * 3.14
Part.ClearSelection2(true);
Part.Extension.SelectByID2("前视基准面", "PLANE", 0, 0, 0, false, 0, null, 0);
Part.SketchManager.InsertSketch(true);
Part.ClearSelection2(true);
Part.SketchManager.CreateLine(-Convert.ToDouble(name2[4]) / 1000 - 0.1, -Convert.ToDouble(name4[4]) / 1000, 0, Convert.ToDouble(name2[4]) / 1000 + 0.1, -Convert.ToDouble(name4[4]) / 1000, 0);
Part.Extension.SelectByID2("草图4", "SKETCH", 0, 0, 0, false, 0, null, 0);
Part.Extension.SelectByRay(0, 0, 0, 0, 0, -1, 3.67553858238833E-02, 2, false, 0, 0);
Part.FeatureManager.InsertSheetMetal3dBend(((180 - Convert.ToDouble(name6[5])) / 180 * Math.PI), false, Convert.ToDouble(name6[4]) / 1000, false, 0, null);//弧度制算法 25/180 * 3.14
Part.ClearSelection2(true);
Part.Extension.SelectByID2("前视基准面", "PLANE", 0, 0, 0, false, 0, null, 0);
Part.SketchManager.InsertSketch(true);
Part.ClearSelection2(true);
Part.SketchManager.CreateLine(-Convert.ToDouble(name2[5]) / 1000 - 0.1, -Convert.ToDouble(name4[5]) / 1000, 0, Convert.ToDouble(name2[5]) / 1000 + 0.1, -Convert.ToDouble(name4[5]) / 1000, 0);
Part.Extension.SelectByID2("草图5", "SKETCH", 0, 0, 0, false, 0, null, 0);
Part.Extension.SelectByRay(0, 0, 0, 0, 0, -1, 3.67553858238833E-02, 2, false, 0, 0);
Part.FeatureManager.InsertSheetMetal3dBend(((180 - Convert.ToDouble(name6[5])) / 180 * Math.PI), false, Convert.ToDouble(name6[4]) / 1000, false, 0, null);//弧度制算法 25/180 * 3.14
Part.ClearSelection2(true);