Skip to content

Instantly share code, notes, and snippets.

@benkoshy
Last active May 25, 2026 08:21
Show Gist options
  • Select an option

  • Save benkoshy/6387fd57f6fb1d06d9c34500c9b169bb to your computer and use it in GitHub Desktop.

Select an option

Save benkoshy/6387fd57f6fb1d06d9c34500c9b169bb to your computer and use it in GitHub Desktop.
Get All Profiles with a Height Property - using the Tekla Open API
public static List<string> getProfiles()
        {
            List<string> profiles = new List<string>();
            CatalogHandler catalogHandler = new CatalogHandler();

            if (catalogHandler.GetConnectionStatus())
            {
                ProfileItemEnumerator profileItemEnumerator = catalogHandler.GetLibraryProfileItems();

                while (profileItemEnumerator.MoveNext())
                {
                    LibraryProfileItem libraryProfileItem = profileItemEnumerator.Current as LibraryProfileItem;

                    if (libraryProfileItem != null)
                    {
                        if (IsHeightPropertyOnProfile(libraryProfileItem))
                        {
                            var message =
                                new Markup(
                                    $"[yellow]Loading:[/] [bold blue]{libraryProfileItem.ProfileName.ToString()}[/]");
                            AnsiConsole.Write(message);
                            profiles.Add(libraryProfileItem.ProfileName);
                        }
                        else
                        {
                            var message =
                                new Markup(
                                    $"\n[Red]Skip:[/] [white]{libraryProfileItem.ProfileName.ToString()} does not have a height parameter[/]");
                            AnsiConsole.Write(message);
                        }
                    }
                }
            }


            return profiles;
        }
        
// www.tek1.com.au for more information
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment