ShapeItem Class

The Shape class contains information about the shapes in the Tekla Structures shape catalog.
Inheritance Hierarchy
SystemObject
  Tekla.Structures.CatalogsShapeItem

Namespace:  Tekla.Structures.Catalogs
Assembly:  Tekla.Structures.Catalogs (in Tekla.Structures.Catalogs.dll) Version: 2023.0.3
Syntax
[SerializableAttribute]
public class ShapeItem

The ShapeItem type exposes the following members.

Constructors
  NameDescription
Public methodShapeItem
Creates a new shape instance.
Top
Properties
  NameDescription
Public propertyBrepType
Defines BrepType of shapes. @see enum BrepType
Public propertyExtrema
The extrema of the shape as an axis-aligned bounding box, as opposed to object-aligned
Public propertyFingerprint
A fingerprint value calculated by Tekla Structures to provide quick comparison of geometries to avoid inserting same shape multiple times to the catalog. More rigorous comparison is done only for geometries that result in identical fingerprints.
Public propertyGeometryGuid
A unique identifier of the shape geometry, given initially by BrepStorage. This GUID is used as the body of the filename for the shape geometry information found in the ShapeGeometries directory
Public propertyGeometryHash
This obsolete property can still be used to store and externally provided unique hash value identifying the shape. However, Tekla Structures does not use this value internally for anything. It is strongly recommended to use the newer Fingerprint property for future implementations. That value is automatically calculated by Tekla Structures for all inserted shapes and is used internally for shape identification.
Public propertyGuid
A unique identifier of the actual shape, given initially by the ShapeCatalog. This GUID is used as the body of the filename for the shape information found in the Shape directory
Public propertyHandlePoints
Defines handle points of the shape.
Public propertyIsSolid
Set to true if the shape is detected by TS Core to be a valid solid
Public propertyName
The shape Name
Public propertyShapeFacetedBrep
The data structure containing the geometric information of the shape as a FacetedBRep
Public propertyUpAxis
The direction defining what is understood as "up" in the shape that the API user is providing. Typically this is the z-axis, if the data is in global coordinates, coming from a system where Z-axis points to global up direction. Possible values are: Undefined = 0, X_Axis = 1, Y_Axis = 2, Z_Axis = 3. It is highly recommendable to orient shapes in the Tekla Structures native way, that is x-axis on the extrusion line and Y-axis pointing up. NOTE: Specifying UpAxis to be ShapeUpAxis.Undefined may throw a ‘System.ArgumentOutOfRangeException’ exception in certain operations, because the system can not proceed without that information.
Top
Methods
  NameDescription
Public methodCleanAndModify
Cleans and stores the brep into the shape catalog
Public methodDelete
Deletes a shape from shape catalog based on the shape name.
Public methodCode exampleExport
Exports the shape item in *.tsc-format to the to given file name. If path is not given shape is exported to model folder. If filename is empty shape name is used as filename.
Public methodCode exampleGetInstanceCount
Get the number of instances used in the model of a shape
Public methodCode exampleInsert
Inserts a shape to the shape catalog based on the shape geometry (does not allow duplicate geometry).
Public methodCode exampleInsertUsingNormals
Inserts a shape to the shape catalog using the shape geometry. Uses vertex normals to determine edge visibility. If the normal vectors of the vertices belonging to one geometrical location are close enough, the edge will be considered smooth and will be marked as hidden.
Public methodCode exampleInsertUsingNormalsAllowDuplicates
Inserts a shape to the shape catalog using the shape geometry allowing duplicates. Uses vertex normals to determine edge visibility. If the normal vectors of the vertices belonging to one geometrical location are close enough, the edge will be considered smooth and will be marked as hidden.
Public methodCode exampleModify
Modifies a shape in the shape catalog based on the shape name or if not found, based on shape guid.
Public methodCode exampleRename
Renames a shape in the shape catalog with the given shape name.
Public methodSelect
Selects the shape from the database based on the name given in this instance.
Public methodSelect(String)
Selects the shape based on the given name from the database.
Public methodCode exampleSetHandlePoints
Set the Shape item's Handle Points
Top
Examples
public class Example
{
    using System;
    using Tekla.Structures.Catalogs;
    using Tekla.Structures.Geometry3d;
    using Tekla.Structures.Model;

    public void CheckAllShapes()
    {
        ModelObjectEnumerator moe = new Model().GetModelObjectSelector().GetAllObjectsWithType(ModelObject.ModelObjectEnum.BREP);

        while (moe.MoveNext())
        {
            Brep myBrep = moe.Current as Brep;
            if (myBrep == null) continue;
            ShapeItem myShape = new ShapeItem();
            myShape.Name = myBrep.Profile.ProfileString;
            bool result = myShape.Select();

            if (!result)
            {
                myShape.ShapeFacetedBrep = CreateBrepCube(1000);
                myShape.Insert();
            }
        }
    }

    public FacetedBrep CreateBrepCube(double length)
    {
        var vertices = new[]
        {
                new Vector(0.0,     0.0,    0.0), // 0
                new Vector(length,  0.0,    0.0), // 1
                new Vector(length,  length, 0.0), // 2
                new Vector(0.0,     length, 0.0), // 3
                new Vector(0.0,     0.0,    length), // 4
                new Vector(length,  0.0,    length), // 5
                new Vector(length,  length, length), // 6
                new Vector(0.0,     length, length), // 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[][]}
        {
        };

        return new FacetedBrep(vertices, outloop, innerLoop);
    }
}
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