ShapeItemInsertOrGetGuidsOfShapesWithMatchingGeometry Method

Inserts a shape to the shape catalog based on the shape geometry (does not allow duplicate geometry). If, based on fingerprint, the geometry already exists it populates a list of Guids of shapes using that same geometry.

Namespace:  Tekla.Structures.Catalogs
Assembly:  Tekla.Structures.Catalogs (in Tekla.Structures.Catalogs.dll) Version: 2026.0.0-alpha00057080+93cd22c410a086ecc356b7088d4daaf2e12907eb
Syntax
public bool InsertOrGetGuidsOfShapesWithMatchingGeometry(
	out List<string> existingShapeGuids
)

Parameters

existingShapeGuids
Type: System.Collections.GenericListString
A list of guids of any shapes with matching geometry fingerprints.

Return Value

Type: Boolean
Returns true on success; false if not successful.
Exceptions
ExceptionCondition
InvalidOperationExceptionThrown if Insert failed due to an internal reason.
ArgumentExceptionThrown if the shape data is invalid (see message for more specific cause).
ArgumentOutOfRangeExceptionThrown if an implementation error occurred.
Examples
using System;
using Tekla.Structures.Catalogs;

public class Example
{
    var vertices = new[]
    {
        new Vector(  0.0,   0.0,   0.0), // 0
        new Vector(300.0,   0.0,   0.0), // 1
        new Vector(300.0, 300.0,   0.0), // 2
        new Vector(  0.0, 300.0,   0.0), // 3
        new Vector(  0.0,   0.0, 300.0), // 4
        new Vector(300.0,   0.0, 300.0), // 5
        new Vector(300.0, 300.0, 300.0), // 6
        new Vector(  0.0, 300.0, 300.0), // 7
    };
    var outloop = new[] { new[] { 0, 3, 2, 1 },
                  new[] { 0, 1, 5, 4 },
                  new[] { 1, 2, 6, 5 },
                  new[] { 2, 3, 7, 6 },
                  new[] { 3, 0, 4, 7 },
                  new[] { 4, 5, 6, 7 }};

    var innerLoop = new Dictionary{int, int[][]}
    {
    };

    var brep = new FacetedBrep(vertices, outloop, innerLoop);
    var shapeItem1 = new ShapeItem
    {
         Name = "MyNiceCubeBrep1",
         ShapeFacetedBrep = brep,
         UpAxis = ShapeUpAxis.Z_Axis
    };

    var result = shapeItem1.Insert();
    System.Diagnostics.Debug.Assert(result, $"Failed to insert {shapeItem1.Name}.");

    var shapeItem2 = new ShapeItem
    {
         Name = "MyNiceCubeBrep2",
         ShapeFacetedBrep = brep,
         UpAxis = ShapeUpAxis.Z_Axis
    };

    List{string} existingGuids;
    result = shapeItem2.InsertOrGetGuidsOfShapesWithMatchingGeometry(out existingGuids);
    System.Diagnostics.Debug.Assert(!result, $"Should have failed to insert {shapeItem2.Name}.");
    System.Diagnostics.Debug.Assert(
        existingGuids.Contains(shapeItem1.Guid),
        $"{nameof(existingGuids)} should have conatined{shapeItem1.Guid}.");
}
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