|
OCCT-Light 0.1
C ABI and C++ veneer for multi-language CAD workflows
|
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"

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 |
OCCT-Light: analytic primitive solid construction API.
| #define OCCTL_PRIM_BOX_INFO_INIT |
| #define OCCTL_PRIM_CONE_INFO_INIT |
| #define OCCTL_PRIM_CYLINDER_INFO_INIT |
| #define OCCTL_PRIM_SPHERE_INFO_INIT |
| #define OCCTL_PRIM_TORUS_INFO_INIT |
| #define OCCTL_PRIM_WEDGE_INFO_INIT |
| typedef struct occtl_prim_box_info 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.
| typedef struct occtl_prim_cone_info 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.
| typedef struct occtl_prim_cylinder_info 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.
| typedef struct occtl_prim_halfspace_info 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.
| typedef struct occtl_prim_sphere_info 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.
| typedef struct occtl_prim_torus_info 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).
| typedef struct occtl_prim_wedge_info 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].
| 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.
| [out] | info | Borrows it. NULL-tolerant; no-op when NULL. |
\par Thread Safety Yes.
| 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.
| [out] | info | Borrows it. NULL-tolerant; no-op when NULL. |
\par Thread Safety Yes.
| 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.
| [out] | info | Borrows it. NULL-tolerant; no-op when NULL. |
\par Thread Safety Yes.
| 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.
| [out] | info | Borrows it. NULL-tolerant; no-op when NULL. |
\par Thread Safety Yes.
| 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).
| [in,out] | graph | Borrows it. Must be non-NULL. |
| [in] | info | Borrows it. Must be non-NULL with a recognised struct_version and strictly positive dx / dy / dz. |
| [out] | out_solid | Borrows it (caller-allocated slot). Must be non-NULL. On success receives the new Solid NodeId; on failure set to OCCTL_NODE_ID_INVALID. |
| OCCTL_OK | On success. |
| OCCTL_INVALID_ARGUMENT | Any pointer argument is NULL, p_next is non-NULL. |
| OCCTL_VERSION_MISMATCH | struct_version is unrecognised. |
| OCCTL_GEOMETRY_INVALID | Any dimension is non-positive or below the library's geometric precision. |
| OCCTL_TOPOLOGY_INVALID | The resulting topology was rejected. |
| OCCTL_INTERNAL | An unexpected internal error occurred. |
\par Thread Safety No — mutates graph.
| 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.
| [in,out] | graph | Borrows it. Must be non-NULL. |
| [in] | info | Borrows it. Must be non-NULL with a recognised struct_version. |
| [out] | out_solid | Borrows it. Must be non-NULL. On success receives the new Solid NodeId; on failure set to OCCTL_NODE_ID_INVALID. |
| OCCTL_OK | On success. |
| OCCTL_INVALID_ARGUMENT | Any pointer argument is NULL. |
| OCCTL_VERSION_MISMATCH | struct_version is unrecognised. |
| OCCTL_GEOMETRY_INVALID | Inputs are degenerate (e.g. r1 == r2 == 0, height non-positive, half-angle out of range). |
| OCCTL_TOPOLOGY_INVALID | The resulting topology was rejected. |
| OCCTL_INTERNAL | An unexpected internal error occurred. |
\par Thread Safety No.
| 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.
| [in,out] | graph | Borrows it. Must be non-NULL. |
| [in] | info | Borrows it. Must be non-NULL with a recognised struct_version. |
| [out] | out_solid | Borrows it. Must be non-NULL. On success receives the new Solid NodeId; on failure set to OCCTL_NODE_ID_INVALID. |
| OCCTL_OK | On success. |
| OCCTL_INVALID_ARGUMENT | Any pointer argument is NULL, p_next is non-NULL. |
| OCCTL_VERSION_MISMATCH | struct_version is unrecognised. |
| OCCTL_GEOMETRY_INVALID | radius or height is non-positive. |
| OCCTL_TOPOLOGY_INVALID | The resulting topology was rejected. |
| OCCTL_INTERNAL | An unexpected internal error occurred. |
\par Thread Safety No.
| 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.
| [in,out] | graph | Borrows it. Must be non-NULL. |
| [in] | info | Borrows it. Must be non-NULL with a recognised struct_version. |
| [out] | out_solid | Borrows it. Must be non-NULL. On success receives the new Solid NodeId; on failure set to OCCTL_NODE_ID_INVALID. |
| OCCTL_OK | On success. |
| OCCTL_INVALID_ARGUMENT | Any pointer argument is NULL, p_next is non-NULL, or reference_point contains a non-finite component. |
| OCCTL_VERSION_MISMATCH | struct_version is unrecognised. |
| OCCTL_NOT_FOUND | face refers to a removed or absent node. |
| OCCTL_WRONG_KIND | face is not of kind OCCTL_KIND_FACE. |
| OCCTL_GEOMETRY_INVALID | Construction failed (reference point on the face surface, etc.). |
| OCCTL_TOPOLOGY_INVALID | The resulting topology was rejected. |
| OCCTL_INTERNAL | An unexpected internal error occurred. |
\par Thread Safety No.
| 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.
| [in,out] | graph | Borrows it. Must be non-NULL. |
| [in] | info | Borrows it. Must be non-NULL with a recognised struct_version. |
| [out] | out_solid | Borrows it. Must be non-NULL. |
| OCCTL_OK | On success. |
| OCCTL_INVALID_ARGUMENT | Any pointer argument is NULL, p_next is non-NULL. |
| OCCTL_VERSION_MISMATCH | struct_version is unrecognised. |
| OCCTL_GEOMETRY_INVALID | radius is non-positive or angles are outside the legal range. |
| OCCTL_TOPOLOGY_INVALID | The resulting topology was rejected. |
| OCCTL_INTERNAL | An unexpected internal error occurred. |
\par Thread Safety No.
| 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.
| [in,out] | graph | Borrows it. Must be non-NULL. |
| [in] | info | Borrows it. Must be non-NULL with a recognised struct_version. |
| [out] | out_solid | Borrows it. Must be non-NULL. On success receives the new Solid NodeId; on failure set to OCCTL_NODE_ID_INVALID. |
| OCCTL_OK | On success. |
| OCCTL_INVALID_ARGUMENT | Any pointer argument is NULL. |
| OCCTL_VERSION_MISMATCH | struct_version is unrecognised. |
| OCCTL_GEOMETRY_INVALID | Radii are degenerate (r2 >= r1 or non-positive), or angles are outside the legal range. |
| OCCTL_TOPOLOGY_INVALID | The resulting topology was rejected. |
| OCCTL_INTERNAL | An unexpected internal error occurred. |
\par Thread Safety No.
| 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.
| [in,out] | graph | Borrows it. Must be non-NULL. |
| [in] | info | Borrows it. Must be non-NULL with a recognised struct_version. |
| [out] | out_solid | Borrows it. Must be non-NULL. On success receives the new Solid NodeId; on failure set to OCCTL_NODE_ID_INVALID. |
| OCCTL_OK | On success. |
| OCCTL_INVALID_ARGUMENT | Any pointer argument is NULL. |
| OCCTL_VERSION_MISMATCH | struct_version is unrecognised. |
| OCCTL_GEOMETRY_INVALID | Inputs are degenerate (any size non-positive, ltx outside [0, dx]). |
| OCCTL_TOPOLOGY_INVALID | The resulting topology was rejected. |
| OCCTL_INTERNAL | An unexpected internal error occurred. |
\par Thread Safety No.
| 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.
| [out] | info | Borrows it. NULL-tolerant; no-op when NULL. |
\par Thread Safety Yes.
| 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.
| [out] | info | Borrows it. NULL-tolerant; no-op when NULL. |
\par Thread Safety Yes.
| 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.
| [out] | info | Borrows it. NULL-tolerant; no-op when NULL. |
\par Thread Safety Yes.