Hi All,
Is it possible to read a profile property with Grasshopper? I am trying to read the value of B2H from a custom profile in Tekla.
Thanks.
Hi All,
Is it possible to read a profile property with Grasshopper? I am trying to read the value of B2H from a custom profile in Tekla.
Thanks.
Hi Mario,
Here’s a script you can use in a C# component to get the profile item from the db:
private void RunScript(string ProfileName, ref object ProfileItem)
{
var name = ProfileName;
var penum = new Tekla.Structures.Catalogs.CatalogHandler().GetProfileItems();
while(penum.MoveNext())
{
var profileItem = penum.Current;
if (profileItem is Tekla.Structures.Catalogs.LibraryProfileItem && ((Tekla.Structures.Catalogs.LibraryProfileItem) profileItem).ProfileName == name
|| profileItem is Tekla.Structures.Catalogs.ParametricProfileItem && ((Tekla.Structures.Catalogs.ParametricProfileItem) profileItem).ProfilePrefix == string.Concat(name.TakeWhile(c => c < '0' || c > '9')))
{
ProfileItem = profileItem;
return;
}
}
Print("Profile not found");
}
Remember to add a reference to the Tekla.Structures.Catalogs.dll (in the bin folder of the Tekla version you’re using). Or download the example below.
Then you can expand the profile item and read the aProfileItemParameters values.
The above example definition here (dynamic script so you don’t even need Tekla references):
GetProfileProperties.gh (12.0 KB)
Cheers,
-b
Beautiful! It worked like a charmed!
You are a life saver as always Sebastian. Thanks heaps!