API Reference

Geometry

namespace Geometry

Functions

std::optional<TopoDS_Shape> MakeSphere(double radius)

Create a sphere of the given radius centred at the origin.

Returns:

the shape, or std::nullopt if OCCT reports a build failure.

std::optional<TopoDS_Shape> MakeBox(double dx, double dy, double dz)

Create an axis-aligned box with one corner at the origin.

Returns:

the shape, or std::nullopt if OCCT reports a build failure.

std::optional<BoundingBox> GetBoundingBox(const TopoDS_Shape &shape)

Compute the axis-aligned bounding box of a shape.

Returns:

nullopt if the shape is null or degenerate.

std::string ShapeTypeString(const TopoDS_Shape &shape)

Human-readable name for the top-level shape type (e.g. “Solid”, “Shell”).

struct BoundingBox
#include <OcctUtils.hpp>

Axis-aligned bounding box with named accessors.

Public Functions

inline std::tuple<double, double, double> Extents() const noexcept

Returns (dx, dy, dz) — positive extents in each axis.

I/O

class StepExporter

Public Functions

void AddShape(const TopoDS_Shape &shape, const std::string &label = "")

Stage a shape with an optional label (used in the STEP product name).

void Write(const std::filesystem::path &path) const

Write all staged shapes to path.

Throws:

std::runtime_error – on OCCT write failure.

class StlExporter

Public Functions

inline void SetLinearDeflection(double deflection) noexcept

Linear deflection controls triangle density (smaller = finer mesh).

Default: 0.1

inline void SetAngularDeflection(double radians) noexcept

Angular deflection in radians. Default: 0.5.

void Write(const TopoDS_Shape &shape, const std::filesystem::path &path) const

Mesh and write shape to path.

Throws:

std::runtime_error – on OCCT write failure.