Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

1.1 KB
Raw Blame
using Aetheris.Forge;
using Aetheris.Kernel.Core.Brep;
using Aetheris.Kernel.Core.Results;

namespace Aetheris.Kernel.StandardLibrary;

public static class StandardLibraryPrimitives
{
    public static KernelResult<BrepBody> CreateRoundedCornerBox(double width, double depth, double height, double cornerRadius, int cornerSegments = 8)
    {
        var profile = ForgeAtomics.RoundedRectangle(width, depth, cornerRadius, cornerSegments);
        if (!profile.IsSuccess)
        {
            return KernelResult<BrepBody>.Failure(profile.Diagnostics);
        }

        return ForgeAtomics.ExtrudeCentered(profile.Value, height);
    }

    public static KernelResult<BrepBody> CreateSlotCut(double length, double width, double height, double cornerRadius, int cornerSegments = 8)
    {
        var profile = ForgeAtomics.RoundedRectangle(length, width, cornerRadius, cornerSegments);
        if (!profile.IsSuccess)
        {
            return KernelResult<BrepBody>.Failure(profile.Diagnostics);
        }

        return ForgeAtomics.ExtrudeCentered(profile.Value, height);
    }
}