一、代码
ContourPlate cp1 = new ContourPlate();
cp1.AddContourPoint(new ContourPoint(new TSG.Point(0, 250, 5), null));
cp1.AddContourPoint(new ContourPoint(new TSG.Point(500, 250, 5), null));
cp1.AddContourPoint(new ContourPoint(new TSG.Point(500, -250, 5), null));
cp1.AddContourPoint(new ContourPoint(new TSG.Point(0, -250, 5), null));
cp1.Profile.ProfileString = "PL10";
ContourPlate cp2 = new ContourPlate();
cp2.AddContourPoint(new ContourPoint(new TSG.Point(0, 250, 15), null));
cp2.AddContourPoint(new ContourPoint(new TSG.Point(500, 250, 15), null));
cp2.AddContourPoint(new ContourPoint(new TSG.Point(500, -250, 15), null));
cp2.AddContourPoint(new ContourPoint(new TSG.Point(0, -250, 15), null));
cp2.Profile.ProfileString = "PL10";
if (!cp1.Insert()) Console.WriteLine("ContourPlate Insert failed!");
if (!cp2.Insert()) Console.WriteLine("ContourPlate1 Insert failed!");
BoltArray B = new BoltArray();
ModelObject m1 = cp2 as ModelObject;
ModelObject m2 = cp2 as ModelObject;
Part p1 = m1 as Part;
Part p2 = m2 as Part;
B.PartToBoltTo = p1;
B.PartToBeBolted = p2;
B.FirstPosition = new TSG.Point(50, 0, 0);
B.SecondPosition = new TSG.Point(250, 0, 0);
B.BoltSize = 20;
B.Tolerance = 3.00;
B.BoltStandard = "HS10.9";
B.BoltType = BoltGroup.BoltTypeEnum.BOLT_TYPE_WORKSHOP;
B.CutLength = 105;
B.Length = 100;
B.ExtraLength = 0;
B.ThreadInMaterial = BoltGroup.BoltThreadInMaterialEnum.THREAD_IN_MATERIAL_YES;
B.Position.Depth = Position.DepthEnum.MIDDLE;
B.Position.Plane = Position.PlaneEnum.MIDDLE;
B.Position.Rotation = Position.RotationEnum.FRONT;
B.Bolt = true;
B.Washer3 = true;
B.Nut1 = true;
B.AddBoltDistX(100);
B.AddBoltDistX(90);
B.AddBoltDistX(80);
B.AddBoltDistY(70);
B.AddBoltDistY(60);
B.AddBoltDistY(50);
B.Insert();
二、主要逻辑说明
首先使用螺栓群类,再为螺栓群类赋属性,最后创建螺栓群实体。
三、最后的开发效果