Tekla Open API

Detailed and full API reference helps you master Tekla Open API

This is the most recent version of Tekla Open API.
For older versions, please visit Tekla Warehouse.

ShapeItem Class

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

Namespace:  Tekla.Structures.Catalogs
Assembly:  Tekla.Structures.Catalogs (in Tekla.Structures.Catalogs.dll) Version: 2019.0.0.0 (2019.0.0.0)
public class ShapeItem

The ShapeItem type exposes the following members.

  Name Description
Public method ShapeItem
Creates a new shape instance.
  Name Description
Public property Extrema
The extrema of the shape as an axis-aligned bounding box, as opposed to object-aligned
Public property Fingerprint
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 property GeometryGuid
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 property GeometryHash
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 property Guid
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 property IsSolid
Set to true if the shape is detected by TS Core to be a valid solid
Public property Name
The shape Name
Public property ShapeFacetedBrep
The data structure containing the geometric information of the shape as a FacetedBRep
Public property UpAxis
The direction defining what is understood as "up" in the shape. Typically this is z. 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
  Name Description
Public method CleanAndModify
Cleans and stores the brep into the shape catalog
Public method Delete
Deletes a shape from shape catalog based on the shape name.
Public methodCode example Export
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 example Insert
Inserts a shape to the shape catalog based on the shape geometry.
Public methodCode example InsertUsingNormals
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 example Modify
Modifies a shape in the shape catalog based on the shape name or if not found, based on shape guid.
Public method Select
Selects the shape from the database based on the name given in this instance.
Public method Select(String)
Selects the shape based on the given name from the database.
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);

    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