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

SolidGetCutPart Method

Returns a shell enumerator for the solid th at results cutting this solid with the given solid.

Namespace:  Tekla.Structures.Model
Assembly:  Tekla.Structures.Model (in Tekla.Structures.Model.dll) Version: 2019.0.0.0 (2019.0.0.0)
Syntax
public ShellEnumerator GetCutPart(
	Solid CuttingPart
)

Parameters

CuttingPart
Type: Tekla.Structures.ModelSolid
The solid to use for cutting.

Return Value

Type: ShellEnumerator
An shell enumerator to enumerate through the resulting solid's shells.
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;
        List<int> 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