
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tekla.Structures;
using TSM = Tekla.Structures.Model;
using T3D = Tekla.Structures.Geometry3d;
using TSUI = Tekla.Structures.Model.UI;
using Tekla.Structures.Model;
using System.Reflection;
namespace tekla001
{
internal class Program
{
static void Main(string[] args)
{
Console.ForegroundColor = ConsoleColor.Green;
TeklaHelper.CreateBeam();
TeklaHelper.CreateNbeam(10);
TeklaHelper.hello();
Console.WriteLine("OK");
Console.Read();
}
}
class TeklaHelper
{
public static void hello()
{
TSUI.GraphicsDrawer drawer = new TSUI.GraphicsDrawer();
drawer.DrawText(new T3D.Point(0, 0, 0), "hello 你好它克拉", new TSUI.Color(1, 0, 0));
}
public static void CreateBeam()
{
TSM.Model model = new TSM.Model();
if (model.GetConnectionStatus())
{
T3D.Point point1 = new T3D.Point(0, 0, 0);
T3D.Point point2 = new T3D.Point(0, 5000, 0);
TSM.Beam beam = new TSM.Beam();
beam.StartPoint = point1;
beam.EndPoint = point2;
beam.Material.MaterialString = "C30";
beam.Profile.ProfileString="600*200";
beam.Class = "3";
beam.CastUnitType = TSM.Part.CastUnitTypeEnum.PRECAST;
beam.Name = "PC-1";
beam.Insert();
model.CommitChanges();
Console.WriteLine("model.CommitChanges");
}
}
public static void CreateNbeam(int n)
{
TSM.Model model = new TSM.Model();
if (model.GetConnectionStatus())
{
for (int i = 0; i < n; i++)
{
T3D.Point point1 = new T3D.Point(1000*i, 0, 0);
T3D.Point point2 = new T3D.Point(1000*i, 9000, 0);
TSM.Beam beam = new TSM.Beam();
beam.StartPoint = point1;
beam.EndPoint = point2;
beam.Material.MaterialString = "C30"+i;
beam.Profile.ProfileString="600*200";
beam.CastUnitType = TSM.Part.CastUnitTypeEnum.PRECAST;
beam.Name = "PC-10" + i;
beam.Insert();
Console.WriteLine("model.CommitChanges");
}
}
model.CommitChanges();
}
}
}