using System;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;
using Tekla.Structures;
using Tekla.Structures.Catalogs;
using Tekla.Structures.Drawing;
using Tekla.Structures.Filtering;
using Tekla.Structures.Filtering.Categories;
using Tekla.Structures.Geometry3d;
using Tekla.Structures.Model;
using Part = Tekla.Structures.Model.Part;
namespace Exercise
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
MyModel = new Model();
}
private readonly Model MyModel;
private void button2_Click(object sender, EventArgs e)
{
if (MyModel.GetConnectionStatus())
{
if (MyModel.GetConnectionStatus())
{
ModelObjectEnumerator.AutoFetch = true;
var beams = MyModel.GetModelObjectSelector().GetAllObjectsWithType(new Type[] { typeof(Beam) });
int i = 0;
while (beams.MoveNext())
{
var beam = beams.Current as Beam;
Console.WriteLine("Beam: ");
Console.WriteLine(beam.Name);
Console.WriteLine(beam.Profile.ProfileString);
Console.WriteLine(beam.StartPoint);
Console.WriteLine($"AssemblyNumber:{beam.AssemblyNumber.Prefix}-{beam.AssemblyNumber.StartNumber}");
Console.WriteLine();
i++;
if (i == 5) break;
}
}
}
}
}