Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benkoshy/aa237a03b2ac02a1c2e025f2ace1102a to your computer and use it in GitHub Desktop.
Save benkoshy/aa237a03b2ac02a1c2e025f2ace1102a to your computer and use it in GitHub Desktop.
Tekla - How to select an object in the model using a Tekla Picker

This is a console application.

You will need to install the approriate dlls from Tekla. This can now be down via a Nuget package:

We want to select a single object in the model using a picker. Here is some sample code. You can of course, configure this to select model objects if you wish.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Tekla.Structures.Model;
using Tekla.Structures.Model.UI;



namespace TestSelectObject
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Picker picker = new Picker();
            ModelObject modelObject = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_OBJECT);
            
            // we can do whatever we want once we have the model object:
            Console.WriteLine($"GUID is: {modelObject.Identifier.GUID}, and then ID is: {modelObject.Identifier.ID}");           

            // from the object itself:
            // GUID is: 9651ed88 - 13e5 - 486f - 9541 - c878110c456e, and then ID is: 4144162          
            Console.ReadLine();            
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment