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: 2024.0.0+a110b435391768740483e3032720a566518c9a63
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: BooleanReturns true on success; false if not successful.
Exceptions
Exception | Condition |
---|---|
InvalidOperationException | Thrown if Insert failed due to an internal reason. |
ArgumentException | Thrown if the shape data is invalid (see message for more specific cause). |
ArgumentOutOfRangeException | Thrown 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