ShapeItemGetInstanceCount Method

Get the number of instances used in the model of a shape

Namespace:  Tekla.Structures.Catalogs
Assembly:  Tekla.Structures.Catalogs (in Tekla.Structures.Catalogs.dll) Version: 2023.0.3
Syntax
public int GetInstanceCount()

Return Value

Type: Int32
The number of shape instances
Examples
This sample shows how to call the GetInstanceCount method to detect shapes without instances thus can be removed.
public List<string> CheckShapeInstancesTest()
{
    var shapeEnumerator = CatalogHandler.GetShapeItems();
    var removedShapes = new List<String>();

    shapeEnumerator.Reset();
    while (shapeEnumerator.MoveNext())
    {
        var shape = shapeEnumerator.Current;

        if (shape.GetInstanceCount() == 0)
        {
            removedShapes.Add(shape.Name);
        }
    }

    return removedShapes;
}
See Also
Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.
Previous
Next