使用Tekla API创建Tekla模型

  在Tekla的安装目录(D:\TeklaStructures\13.0\nt\bin\plugins\)中为我们提供了.Net API接口,利用这些接口,可以实现对Tekla模型的控制和修改操作。本贴将讲述一个最简单的在Tekla中创建梁对象的示例,通过一个按钮在运行的Tekla进程中快速创建模型。需要注意的是,运行此示例程序时Tekla程度需要打开一个模型。 要连接Tekla模型数据库,需要在C#中添加“Tekla.Structures.Model”的引用,按钮下代码如下(C#): [CODE=csharp]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(); }[/CODE] 运行截面:
Tekla 二次开发示例 示例程序下载:点击下载