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.

ShellEnumerator Class

The ShellEnumerator class is used to enumerate the shells of a solid.
Inheritance Hierarchy
SystemObject
  Tekla.Structures.SolidShellEnumerator

Namespace:  Tekla.Structures.Solid
Assembly:  Tekla.Structures (in Tekla.Structures.dll) Version: 2018.1.0.0 (2018.1.0.0)
Syntax
public sealed class ShellEnumerator : IEnumerator

The ShellEnumerator type exposes the following members.

Properties
  Name Description
Public property Current
Gets the current shell.
Top
Methods
  Name Description
Public method MoveNext
Moves to the next item in the enumerator.
Public method Reset
Resets the enumerator to the beginning.
Top
Examples
using Tekla.Structures.Model;
using Tekla.Structures.Solid;
using Tekla.Structures.Geometry3d;

public class Example
{

    private static Beam CreateBeam(Point p1, Point p2, String profileName, bool SetAsOperativeClass)
    {
        Beam beam1 = new Beam
        {
            StartPoint = p1,
            EndPoint = p2,
            Profile = { ProfileString = profileName },
            Finish = "PAINT",
            Material = { MaterialString = "S235JR" },
            Position = { Depth = Position.DepthEnum.MIDDLE },
            Class = SetAsOperativeClass ? BooleanPart.BooleanOperativeClassName : "1"
        };

        return beam1;
    }

    public void Example1()
    {
        Beam beam1 = CreateBeam(new Point(1000.0, 1000.0, 0.0), new Point(1000.0, 2000.0, 0.0), "500*500", false);
        Beam beam2 = CreateBeam(new Point(500.0, 1500.0, 250.0), new Point(1500.0, 1500.0, 250.0), "500*500", true);
        BooleanPart cut = new BooleanPart { Father = beam1 };
        cut.SetOperativePart(beam2);

        Solid solid1 = beam1.GetSolid(Solid.SolidCreationTypeEnum.RAW);
        Solid solid2 = beam1.GetSolid(Solid.SolidCreationTypeEnum.NORMAL);

        ShellEnumerator shells = solid1.GetCutPart(solid2);

        int shellCount = 0;
        var faceCounts = new List<int>();

        while (shells.MoveNext())
        {
            var shell = shells.Current as Shell;
            if (shell != null)
            {
                FaceEnumerator faces = shell.GetFaceEnumerator();
                faceCounts.Insert(shellCount, 0); 
                while(faces.MoveNext())
                {
                    faceCounts[shellCount]++; 
                }
            }
            shellCount++;
        }
    }
}
See Also