Tekla二次开发:如何创建螺栓群?

一、代码

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();

二、主要逻辑说明

首先使用螺栓群类,再为螺栓群类赋属性,最后创建螺栓群实体。

三、最后的开发效果

QR Code
微信扫一扫,欢迎咨询~

联系我们
武汉格发信息技术有限公司
湖北省武汉市经开区科技园西路6号103孵化器
电话:155-2731-8020 座机:027-59821821
邮件:tanzw@gofarlic.com
Copyright © 2023 Gofarsoft Co.,Ltd. 保留所有权利
遇到许可问题?该如何解决!?
评估许可证实际采购量? 
不清楚软件许可证使用数据? 
收到软件厂商律师函!?  
想要少购买点许可证,节省费用? 
收到软件厂商侵权通告!?  
有正版license,但许可证不够用,需要新购? 
联系方式 155-2731-8020
预留信息,一起解决您的问题
* 姓名:
* 手机:

* 公司名称:

姓名不为空

手机不正确

公司不为空