要连接Tekla模型数据库,需要在C#中添加“Tekla.Structures.Model”的引用,按钮下代码如下(C#):
private void button1_Click(object sender, EventArgs e)
{
Model M = new Model();
if (M.GetConnectionStatus())//判断是否获取了Tekla进程
{
Tekla.Structures.Point Pt1 =
new Tekla.Structures.Point(0,0,0);
Tekla.Structures.Point Pt2 =
new Tekla.Structures.Point(6000,0,0);
Tekla.Structures.Point Pt3 =
new Tekla.Structures.Point(6000, 3000, 0);
Tekla.Structures.Point Pt4 =
new Tekla.Structures.Point(0, 3000, 0);
Tekla.Structures.Point Pt5 =
new Tekla.Structures.Point(0, 0, 3000);
Tekla.Structures.Point Pt6 =
new Tekla.Structures.Point(6000, 0, 3000);
Tekla.Structures.Point Pt7 =
new Tekla.Structures.Point(6000, 3000, 3000);
Tekla.Structures.Point Pt8=
new Tekla.Structures.Point(0,3000, 3000);
Beam C1 = new Beam(Pt1,Pt5);
Beam C2 = new Beam(Pt2,Pt6);
Beam C3 = new Beam(Pt3,Pt7);
Beam C4 = new Beam(Pt4, Pt8);
C1.Profile.ProfileString = "HM440*300*11*18";
C2.Profile.ProfileString = "HM440*300*11*18";
C3.Profile.ProfileString = "HM440*300*11*18";
C4.Profile.ProfileString = "HM440*300*11*18";
C1.Material.MaterialString = "Q235B";
C2.Material.MaterialString = "Q235B";
C3.Material.MaterialString = "Q235B";
C4.Material.MaterialString = "Q235B";
C1.Name = "Column";
C2.Name = "Column";
C3.Name = "Column";
C4.Name = "Column";
C1.Position.Depth = Position.DepthEnum.MIDDLE;
C2.Position.Depth = Position.DepthEnum.MIDDLE;
C3.Position.Depth = Position.DepthEnum.MIDDLE;
C4.Position.Depth = Position.DepthEnum.MIDDLE;
Beam B1 = new Beam(Pt5, Pt6);
Beam B2 = new Beam(Pt6, Pt7);
Beam B3 = new Beam(Pt7, Pt8);
Beam B4 = new Beam(Pt8, Pt5);
B1.Profile.ProfileString = "HN400*200*8*13";
B2.Profile.ProfileString = "HN400*200*8*13";
B3.Profile.ProfileString = "HN400*200*8*13";
B4.Profile.ProfileString = "HN400*200*8*13";
B1.Material.MaterialString = "Q235B";
B2.Material.MaterialString = "Q235B";
B3.Material.MaterialString = "Q235B";
B4.Material.MaterialString = "Q235B";
B1.Name = "Beam";
B2.Name = "Beam";
B3.Name = "Beam";
B4.Name = "Beam";
C1.Insert();//插入梁到模型数据库
C2.Insert();
C3.Insert();
C4.Insert();
B1.Insert();
B2.Insert();
B3.Insert();
B4.Insert();
M.CommitChanges();
}运行截面:

示例程序下载:点击下载