OCCT-Light 0.1
C ABI and C++ veneer for multi-language CAD workflows
Loading...
Searching...
No Matches
occtl_prim_solid.h File Reference

OCCT-Light: analytic primitive solid construction API. More...

#include "occtl_core.h"
#include "occtl_curves2d.h"
#include "occtl_geom.h"
#include "occtl_surfaces.h"
#include "occtl_topo.h"
Include dependency graph for occtl_prim_solid.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  occtl_prim_box_info
 
struct  occtl_prim_sphere_info
 
struct  occtl_prim_cylinder_info
 
struct  occtl_prim_cone_info
 
struct  occtl_prim_torus_info
 
struct  occtl_prim_wedge_info
 
struct  occtl_prim_halfspace_info
 

Macros

#define OCCTL_PRIM_BOX_INFO_VERSION_1   1u
 
#define OCCTL_PRIM_BOX_INFO_INIT
 
#define OCCTL_PRIM_SPHERE_INFO_VERSION_1   1u
 
#define OCCTL_PRIM_SPHERE_INFO_INIT
 
#define OCCTL_PRIM_CYLINDER_INFO_VERSION_1   1u
 
#define OCCTL_PRIM_CYLINDER_INFO_INIT
 
#define OCCTL_PRIM_CONE_INFO_VERSION_1   1u
 
#define OCCTL_PRIM_CONE_INFO_INIT
 
#define OCCTL_PRIM_TORUS_INFO_VERSION_1   1u
 
#define OCCTL_PRIM_TORUS_INFO_INIT
 
#define OCCTL_PRIM_WEDGE_INFO_VERSION_1   1u
 
#define OCCTL_PRIM_WEDGE_INFO_INIT
 
#define OCCTL_PRIM_HALFSPACE_INFO_VERSION_1   1u
 
#define OCCTL_PRIM_HALFSPACE_INFO_INIT    {OCCTL_PRIM_HALFSPACE_INFO_VERSION_1, NULL, OCCTL_NODE_ID_INVALID, {0.0, 0.0, 0.0}}
 

Typedefs

typedef struct occtl_prim_box_info occtl_prim_box_info_t
 
typedef struct occtl_prim_sphere_info occtl_prim_sphere_info_t
 
typedef struct occtl_prim_cylinder_info occtl_prim_cylinder_info_t
 
typedef struct occtl_prim_cone_info occtl_prim_cone_info_t
 
typedef struct occtl_prim_torus_info occtl_prim_torus_info_t
 
typedef struct occtl_prim_wedge_info occtl_prim_wedge_info_t
 
typedef struct occtl_prim_halfspace_info occtl_prim_halfspace_info_t
 

Functions

void occtl_prim_box_info_init (occtl_prim_box_info_t *info)
 
occtl_status_t occtl_prim_make_box (occtl_graph_t *graph, const occtl_prim_box_info_t *info, occtl_node_id_t *out_solid)
 
void occtl_prim_sphere_info_init (occtl_prim_sphere_info_t *info)
 
occtl_status_t occtl_prim_make_sphere (occtl_graph_t *graph, const occtl_prim_sphere_info_t *info, occtl_node_id_t *out_solid)
 
void occtl_prim_cylinder_info_init (occtl_prim_cylinder_info_t *info)
 
occtl_status_t occtl_prim_make_cylinder (occtl_graph_t *graph, const occtl_prim_cylinder_info_t *info, occtl_node_id_t *out_solid)
 
void occtl_prim_cone_info_init (occtl_prim_cone_info_t *info)
 
occtl_status_t occtl_prim_make_cone (occtl_graph_t *graph, const occtl_prim_cone_info_t *info, occtl_node_id_t *out_solid)
 
void occtl_prim_torus_info_init (occtl_prim_torus_info_t *info)
 
occtl_status_t occtl_prim_make_torus (occtl_graph_t *graph, const occtl_prim_torus_info_t *info, occtl_node_id_t *out_solid)
 
void occtl_prim_wedge_info_init (occtl_prim_wedge_info_t *info)
 
occtl_status_t occtl_prim_make_wedge (occtl_graph_t *graph, const occtl_prim_wedge_info_t *info, occtl_node_id_t *out_solid)
 
void occtl_prim_halfspace_info_init (occtl_prim_halfspace_info_t *info)
 
occtl_status_t occtl_prim_make_halfspace (occtl_graph_t *graph, const occtl_prim_halfspace_info_t *info, occtl_node_id_t *out_solid)
 

Detailed Description

OCCT-Light: analytic primitive solid construction API.

Macro Definition Documentation

◆ OCCTL_PRIM_BOX_INFO_INIT

#define OCCTL_PRIM_BOX_INFO_INIT
Value:
{OCCTL_PRIM_BOX_INFO_VERSION_1, \
NULL, \
{{0.0, 0.0, 0.0}, {0.0, 0.0, 1.0}, {1.0, 0.0, 0.0}}, \
0.0, \
0.0, \
0.0}

◆ OCCTL_PRIM_CONE_INFO_INIT

#define OCCTL_PRIM_CONE_INFO_INIT
Value:
{OCCTL_PRIM_CONE_INFO_VERSION_1, \
NULL, \
{{0.0, 0.0, 0.0}, {0.0, 0.0, 1.0}, {1.0, 0.0, 0.0}}, \
0.0, \
0.0, \
0.0, \
#define OCCTL_TWO_PI
Definition occtl_core.h:42

◆ OCCTL_PRIM_CYLINDER_INFO_INIT

#define OCCTL_PRIM_CYLINDER_INFO_INIT
Value:
{OCCTL_PRIM_CYLINDER_INFO_VERSION_1, \
NULL, \
{{0.0, 0.0, 0.0}, {0.0, 0.0, 1.0}, {1.0, 0.0, 0.0}}, \
0.0, \
0.0, \

◆ OCCTL_PRIM_SPHERE_INFO_INIT

#define OCCTL_PRIM_SPHERE_INFO_INIT
Value:
{OCCTL_PRIM_SPHERE_INFO_VERSION_1, \
NULL, \
{{0.0, 0.0, 0.0}, {0.0, 0.0, 1.0}, {1.0, 0.0, 0.0}}, \
0.0, \
#define OCCTL_PI_OVER_TWO
Definition occtl_core.h:45

◆ OCCTL_PRIM_TORUS_INFO_INIT

#define OCCTL_PRIM_TORUS_INFO_INIT
Value:
{OCCTL_PRIM_TORUS_INFO_VERSION_1, \
NULL, \
{{0.0, 0.0, 0.0}, {0.0, 0.0, 1.0}, {1.0, 0.0, 0.0}}, \
0.0, \
0.0, \
0.0, \

◆ OCCTL_PRIM_WEDGE_INFO_INIT

#define OCCTL_PRIM_WEDGE_INFO_INIT
Value:
{OCCTL_PRIM_WEDGE_INFO_VERSION_1, \
NULL, \
{{0.0, 0.0, 0.0}, {0.0, 0.0, 1.0}, {1.0, 0.0, 0.0}}, \
0.0, \
0.0, \
0.0, \
0.0}

Typedef Documentation

◆ occtl_prim_box_info_t

Info for occtl_prim_make_box.

Constructs an axis-aligned parallelepiped of size dx by dy by dz with one corner at placement.location and edges aligned to the frame axes derived from placement. The default placement is the global XOY frame (origin at (0,0,0), Z up, X along +x), so casual callers can construct an axis-aligned box at the origin by editing only the three dimensions.

◆ occtl_prim_cone_info_t

Info for occtl_prim_make_cone.

Builds a truncated cone (frustum) of height height between two parallel circular faces of radius r1 at z = 0 and r2 at z = height, with both circles centred on the Z axis of placement. Setting one of r1 / r2 to 0 produces a sharp cone. angle < 2*pi yields a partial cone.

◆ occtl_prim_cylinder_info_t

Info for occtl_prim_make_cylinder.

The cylinder axis is the Z axis of placement; the base sits at placement.location and the cap at placement.location + height * Z. angle < 2*pi yields a partial cylinder.

◆ occtl_prim_halfspace_info_t

Info for occtl_prim_make_halfspace.

A half-space is an infinite solid bounded by one face. Given a face face from the graph and a reference point reference_point not on the face's surface, the half-space is the side of the face containing reference_point. Typical use is as a cutting tool for Booleans.

◆ occtl_prim_sphere_info_t

Info for occtl_prim_make_sphere.

A full sphere has angle1 = -pi/2, angle2 = +pi/2, and angle = 2*pi (the defaults set by OCCTL_PRIM_SPHERE_INFO_INIT). Truncating angle1 / angle2 yields a spherical segment; truncating angle yields a longitudinal wedge.

◆ occtl_prim_torus_info_t

Info for occtl_prim_make_torus.

r1 is the major radius (centreline of the ring); r2 is the minor radius (pipe). angle1 / angle2 trim the pipe in its v parameter (defaulting to 0 / 2*pi — a full pipe); angle trims the ring in its u parameter (defaulting to 2*pi — a full torus).

◆ occtl_prim_wedge_info_t

Info for occtl_prim_make_wedge.

Builds a STEP right-angular wedge — a box of size dx by dy by dz with the +y face shrunk in X from dx to ltx. ltx must be in [0, dx].

Function Documentation

◆ occtl_prim_box_info_init()

void occtl_prim_box_info_init ( occtl_prim_box_info_t info)

Runtime initialiser for occtl_prim_box_info_t.

Sets all fields to OCCTL_PRIM_BOX_INFO_INIT.

Parameters
[out]infoBorrows it. NULL-tolerant; no-op when NULL.

\par Thread Safety Yes.

See also
occtl_prim_make_box

◆ occtl_prim_cone_info_init()

void occtl_prim_cone_info_init ( occtl_prim_cone_info_t info)

Runtime initialiser for occtl_prim_cone_info_t.

Sets all fields to OCCTL_PRIM_CONE_INFO_INIT.

Parameters
[out]infoBorrows it. NULL-tolerant; no-op when NULL.

\par Thread Safety Yes.

See also
occtl_prim_make_cone

◆ occtl_prim_cylinder_info_init()

void occtl_prim_cylinder_info_init ( occtl_prim_cylinder_info_t info)

Runtime initialiser for occtl_prim_cylinder_info_t.

Sets all fields to OCCTL_PRIM_CYLINDER_INFO_INIT.

Parameters
[out]infoBorrows it. NULL-tolerant; no-op when NULL.

\par Thread Safety Yes.

See also
occtl_prim_make_cylinder

◆ occtl_prim_halfspace_info_init()

void occtl_prim_halfspace_info_init ( occtl_prim_halfspace_info_t info)

Runtime initialiser for occtl_prim_halfspace_info_t.

Sets all fields to OCCTL_PRIM_HALFSPACE_INFO_INIT.

Parameters
[out]infoBorrows it. NULL-tolerant; no-op when NULL.

\par Thread Safety Yes.

See also
occtl_prim_make_halfspace

◆ occtl_prim_make_box()

occtl_status_t occtl_prim_make_box ( occtl_graph_t graph,
const occtl_prim_box_info_t info,
occtl_node_id_t out_solid 
)

Builds an axis-aligned box solid and inserts it into graph.

The result is appended as a bare Solid root (no enclosing Product wrapper).

Parameters
[in,out]graphBorrows it. Must be non-NULL.
[in]infoBorrows it. Must be non-NULL with a recognised struct_version and strictly positive dx / dy / dz.
[out]out_solidBorrows it (caller-allocated slot). Must be non-NULL. On success receives the new Solid NodeId; on failure set to OCCTL_NODE_ID_INVALID.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTAny pointer argument is NULL, p_next is non-NULL.
OCCTL_VERSION_MISMATCHstruct_version is unrecognised.
OCCTL_GEOMETRY_INVALIDAny dimension is non-positive or below the library's geometric precision.
OCCTL_TOPOLOGY_INVALIDThe resulting topology was rejected.
OCCTL_INTERNALAn unexpected internal error occurred.

\par Thread Safety No — mutates graph.

See also
occtl_prim_make_sphere, occtl_prim_make_cylinder

◆ occtl_prim_make_cone()

occtl_status_t occtl_prim_make_cone ( occtl_graph_t graph,
const occtl_prim_cone_info_t info,
occtl_node_id_t out_solid 
)

Builds a cone or truncated cone solid.

Parameters
[in,out]graphBorrows it. Must be non-NULL.
[in]infoBorrows it. Must be non-NULL with a recognised struct_version.
[out]out_solidBorrows it. Must be non-NULL. On success receives the new Solid NodeId; on failure set to OCCTL_NODE_ID_INVALID.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTAny pointer argument is NULL.
OCCTL_VERSION_MISMATCHstruct_version is unrecognised.
OCCTL_GEOMETRY_INVALIDInputs are degenerate (e.g. r1 == r2 == 0, height non-positive, half-angle out of range).
OCCTL_TOPOLOGY_INVALIDThe resulting topology was rejected.
OCCTL_INTERNALAn unexpected internal error occurred.

\par Thread Safety No.

See also
occtl_prim_cone_info_init

◆ occtl_prim_make_cylinder()

occtl_status_t occtl_prim_make_cylinder ( occtl_graph_t graph,
const occtl_prim_cylinder_info_t info,
occtl_node_id_t out_solid 
)

Builds a cylinder or partial-cylinder solid.

Parameters
[in,out]graphBorrows it. Must be non-NULL.
[in]infoBorrows it. Must be non-NULL with a recognised struct_version.
[out]out_solidBorrows it. Must be non-NULL. On success receives the new Solid NodeId; on failure set to OCCTL_NODE_ID_INVALID.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTAny pointer argument is NULL, p_next is non-NULL.
OCCTL_VERSION_MISMATCHstruct_version is unrecognised.
OCCTL_GEOMETRY_INVALIDradius or height is non-positive.
OCCTL_TOPOLOGY_INVALIDThe resulting topology was rejected.
OCCTL_INTERNALAn unexpected internal error occurred.

\par Thread Safety No.

See also
occtl_prim_cylinder_info_init

◆ occtl_prim_make_halfspace()

occtl_status_t occtl_prim_make_halfspace ( occtl_graph_t graph,
const occtl_prim_halfspace_info_t info,
occtl_node_id_t out_solid 
)

Builds a half-space solid bounded by info->face on the side of info->reference_point.

Parameters
[in,out]graphBorrows it. Must be non-NULL.
[in]infoBorrows it. Must be non-NULL with a recognised struct_version.
[out]out_solidBorrows it. Must be non-NULL. On success receives the new Solid NodeId; on failure set to OCCTL_NODE_ID_INVALID.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTAny pointer argument is NULL, p_next is non-NULL, or reference_point contains a non-finite component.
OCCTL_VERSION_MISMATCHstruct_version is unrecognised.
OCCTL_NOT_FOUNDface refers to a removed or absent node.
OCCTL_WRONG_KINDface is not of kind OCCTL_KIND_FACE.
OCCTL_GEOMETRY_INVALIDConstruction failed (reference point on the face surface, etc.).
OCCTL_TOPOLOGY_INVALIDThe resulting topology was rejected.
OCCTL_INTERNALAn unexpected internal error occurred.

\par Thread Safety No.

See also
occtl_prim_halfspace_info_init

◆ occtl_prim_make_sphere()

occtl_status_t occtl_prim_make_sphere ( occtl_graph_t graph,
const occtl_prim_sphere_info_t info,
occtl_node_id_t out_solid 
)

Builds a sphere or spherical wedge solid and inserts it into graph.

Parameters
[in,out]graphBorrows it. Must be non-NULL.
[in]infoBorrows it. Must be non-NULL with a recognised struct_version.
[out]out_solidBorrows it. Must be non-NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTAny pointer argument is NULL, p_next is non-NULL.
OCCTL_VERSION_MISMATCHstruct_version is unrecognised.
OCCTL_GEOMETRY_INVALIDradius is non-positive or angles are outside the legal range.
OCCTL_TOPOLOGY_INVALIDThe resulting topology was rejected.
OCCTL_INTERNALAn unexpected internal error occurred.

\par Thread Safety No.

See also
occtl_prim_sphere_info_init, occtl_prim_make_box

◆ occtl_prim_make_torus()

occtl_status_t occtl_prim_make_torus ( occtl_graph_t graph,
const occtl_prim_torus_info_t info,
occtl_node_id_t out_solid 
)

Builds a torus or torus segment solid.

Parameters
[in,out]graphBorrows it. Must be non-NULL.
[in]infoBorrows it. Must be non-NULL with a recognised struct_version.
[out]out_solidBorrows it. Must be non-NULL. On success receives the new Solid NodeId; on failure set to OCCTL_NODE_ID_INVALID.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTAny pointer argument is NULL.
OCCTL_VERSION_MISMATCHstruct_version is unrecognised.
OCCTL_GEOMETRY_INVALIDRadii are degenerate (r2 >= r1 or non-positive), or angles are outside the legal range.
OCCTL_TOPOLOGY_INVALIDThe resulting topology was rejected.
OCCTL_INTERNALAn unexpected internal error occurred.

\par Thread Safety No.

See also
occtl_prim_torus_info_init

◆ occtl_prim_make_wedge()

occtl_status_t occtl_prim_make_wedge ( occtl_graph_t graph,
const occtl_prim_wedge_info_t info,
occtl_node_id_t out_solid 
)

Builds a right-angular wedge solid.

Parameters
[in,out]graphBorrows it. Must be non-NULL.
[in]infoBorrows it. Must be non-NULL with a recognised struct_version.
[out]out_solidBorrows it. Must be non-NULL. On success receives the new Solid NodeId; on failure set to OCCTL_NODE_ID_INVALID.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTAny pointer argument is NULL.
OCCTL_VERSION_MISMATCHstruct_version is unrecognised.
OCCTL_GEOMETRY_INVALIDInputs are degenerate (any size non-positive, ltx outside [0, dx]).
OCCTL_TOPOLOGY_INVALIDThe resulting topology was rejected.
OCCTL_INTERNALAn unexpected internal error occurred.

\par Thread Safety No.

See also
occtl_prim_wedge_info_init

◆ occtl_prim_sphere_info_init()

void occtl_prim_sphere_info_init ( occtl_prim_sphere_info_t info)

Runtime initialiser for occtl_prim_sphere_info_t.

Sets all fields to OCCTL_PRIM_SPHERE_INFO_INIT.

Parameters
[out]infoBorrows it. NULL-tolerant; no-op when NULL.

\par Thread Safety Yes.

See also
occtl_prim_make_sphere

◆ occtl_prim_torus_info_init()

void occtl_prim_torus_info_init ( occtl_prim_torus_info_t info)

Runtime initialiser for occtl_prim_torus_info_t.

Sets all fields to OCCTL_PRIM_TORUS_INFO_INIT.

Parameters
[out]infoBorrows it. NULL-tolerant; no-op when NULL.

\par Thread Safety Yes.

See also
occtl_prim_make_torus

◆ occtl_prim_wedge_info_init()

void occtl_prim_wedge_info_init ( occtl_prim_wedge_info_t info)

Runtime initialiser for occtl_prim_wedge_info_t.

Sets all fields to OCCTL_PRIM_WEDGE_INFO_INIT.

Parameters
[out]infoBorrows it. NULL-tolerant; no-op when NULL.

\par Thread Safety Yes.

See also
occtl_prim_make_wedge