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: 2024.0.0+a110b435391768740483e3032720a566518c9a63
Syntax
The ShapeItem type exposes the following members.
Constructors
Properties
Name | Description | |
---|---|---|
BrepType |
Defines BrepType of shapes.
@see enum BrepType
| |
Extrema |
The extrema of the shape as an axis-aligned bounding box, as opposed to object-aligned
| |
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.
| |
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
| |
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.
| |
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
| |
HandlePoints |
Defines handle points of the shape.
| |
IsSolid |
Set to true if the shape is detected by TS Core to be a valid solid
| |
Name |
The shape Name
| |
ShapeFacetedBrep |
The data structure containing the geometric information of the shape as a FacetedBRep
| |
UpAxis |
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.
|
Methods
Name | Description | |
---|---|---|
CleanAndModify |
Cleans and stores the brep into the shape catalog
| |
Delete |
Deletes a shape from shape catalog based on the shape name.
| |
DeleteMetadata |
Delete the Shape item's metadata.
| |
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.
| |
GetAllMetadataKeys |
Get the Shape item's metadata keys.
| |
GetInstanceCount |
Get the number of instances used in the model of a shape
| |
GetMetadata |
Get the Shape item's metadata.
| |
Insert |
Inserts a shape to the shape catalog based on the shape geometry (does not allow duplicate geometry).
| |
InsertOrGetGuidsOfShapesWithMatchingGeometry |
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.
| |
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.
| |
InsertUsingNormalsAllowDuplicates |
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.
| |
Modify |
Modifies a shape in the shape catalog based on the shape name or if not found, based on shape guid.
| |
Rename |
Renames a shape in the shape catalog with the given shape name.
| |
Select |
Selects the shape from the database based on the name given in this instance.
| |
Select(String) |
Selects the shape based on the given name from the database.
| |
SetHandlePoints |
Set the Shape item's Handle Points
| |
SetMetadata |
Set the Shape item's metadata. Inserts the metadata if key is not found, otherwise modifies existing data.
|
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