|
OCCT-Light 0.1
C ABI and C++ veneer for multi-language CAD workflows
|
OCCT-Light: STEP file I/O (ISO 10303-21). More...


Go to the source code of this file.
Classes | |
| struct | occtl_io_step_read_options |
| struct | occtl_io_step_write_options |
Macros | |
| #define | OCCTL_IO_STEP_READ_OPTIONS_VERSION_1 1u |
| #define | OCCTL_IO_STEP_WRITE_OPTIONS_VERSION_1 1u |
| #define | OCCTL_IO_STEP_READ_OPTIONS_INIT {OCCTL_IO_STEP_READ_OPTIONS_VERSION_1, NULL, 1, 1, 1} |
| #define | OCCTL_IO_STEP_WRITE_OPTIONS_INIT |
Typedefs | |
| typedef enum occtl_io_step_length_unit | occtl_io_step_length_unit_t |
| typedef enum occtl_io_step_schema | occtl_io_step_schema_t |
| typedef struct occtl_io_step_read_options | occtl_io_step_read_options_t |
| typedef struct occtl_io_step_write_options | occtl_io_step_write_options_t |
Enumerations | |
| enum | occtl_io_step_length_unit { OCCTL_IO_STEP_UNIT_MM = 0 , OCCTL_IO_STEP_UNIT_M = 1 , OCCTL_IO_STEP_UNIT_INCH = 2 , OCCTL_IO_STEP_UNIT_RESERVED_FUTURE = 0x7fffffff } |
| enum | occtl_io_step_schema { OCCTL_IO_STEP_SCHEMA_AP203 = 0 , OCCTL_IO_STEP_SCHEMA_AP214 = 1 , OCCTL_IO_STEP_SCHEMA_AP242 = 2 , OCCTL_IO_STEP_SCHEMA_RESERVED_FUTURE = 0x7fffffff } |
Functions | |
| void | occtl_io_step_read_options_init (occtl_io_step_read_options_t *options) |
| void | occtl_io_step_write_options_init (occtl_io_step_write_options_t *options) |
| occtl_status_t | occtl_io_step_read (const char *path, occtl_graph_t **out_graph, occtl_node_id_t *out_root, const occtl_io_step_read_options_t *options) |
| occtl_status_t | occtl_io_step_read_memory (const uint8_t *data, size_t size, occtl_graph_t **out_graph, occtl_node_id_t *out_root, const occtl_io_step_read_options_t *options) |
| occtl_status_t | occtl_io_step_write (const occtl_graph_t *graph, occtl_node_id_t root, const char *path, const occtl_io_step_write_options_t *options) |
| occtl_status_t | occtl_io_step_write_memory (const occtl_graph_t *graph, occtl_node_id_t root, const occtl_io_step_write_options_t *options, uint8_t *out_data, size_t capacity, size_t *out_size) |
OCCT-Light: STEP file I/O (ISO 10303-21).
Reads and writes STEP AP203 / AP214 / AP242 files via OCCT's DESTEP_Provider / DESTEP_ConfigurationNode. OCAF is linked privately and never reaches the public surface.
UIDs are not preserved across the round-trip — the STEP file format has its own entity-id metadata. Use occtl_uid_to_bytes / occtl_uid_from_bytes for an out-of-band UID handshake if persistent identity is required.
| #define OCCTL_IO_STEP_WRITE_OPTIONS_INIT |
| typedef enum occtl_io_step_length_unit occtl_io_step_length_unit_t |
Length unit for STEP file I/O.
| typedef struct occtl_io_step_read_options occtl_io_step_read_options_t |
Options for occtl_io_step_read. Pass NULL for defaults.
| typedef enum occtl_io_step_schema occtl_io_step_schema_t |
STEP schema version for write.
| typedef struct occtl_io_step_write_options occtl_io_step_write_options_t |
Options for occtl_io_step_write. Pass NULL for defaults.
| enum occtl_io_step_schema |
| occtl_status_t occtl_io_step_read | ( | const char * | path, |
| occtl_graph_t ** | out_graph, | ||
| occtl_node_id_t * | out_root, | ||
| const occtl_io_step_read_options_t * | options | ||
| ) |
Reads a STEP file and ingests it into a freshly-created graph.
| [in] | path | Borrows it. NUL-terminated UTF-8 path to the file. Must be non-NULL. |
| [out] | out_graph | Owns it. Receives a new graph on success; NULL on failure. |
| [out] | out_root | Borrows it. Receives the NodeId of the root entity. |
| [in] | options | Borrows it. May be NULL for defaults. |
| OCCTL_OK | On success. |
| OCCTL_INVALID_ARGUMENT | path, out_graph, or out_root is NULL; or options has invalid fields (non-NULL p_next, non-0/1 flags). |
| OCCTL_VERSION_MISMATCH | options has an unsupported struct_version. |
| OCCTL_IO_ERROR | File not found or unreadable. |
| OCCTL_FORMAT_ERROR | File contents were not a valid STEP stream. |
\par Thread Safety Yes.
| occtl_status_t occtl_io_step_read_memory | ( | const uint8_t * | data, |
| size_t | size, | ||
| occtl_graph_t ** | out_graph, | ||
| occtl_node_id_t * | out_root, | ||
| const occtl_io_step_read_options_t * | options | ||
| ) |
Reads a STEP payload from caller-owned memory into a freshly-created graph.
Caller owns the returned graph and must release it via occtl_graph_free.
| [in] | data | Borrows it. Readable byte buffer containing STEP data. Must be non-NULL when size is non-zero. |
| [in] | size | Number of bytes available at data. Must be > 0. |
| [out] | out_graph | Owns it. Receives a new graph on success; NULL on failure. |
| [out] | out_root | Borrows it. Receives the NodeId of the root entity. |
| [in] | options | Borrows it. May be NULL for defaults. |
| OCCTL_OK | On success. |
| OCCTL_INVALID_ARGUMENT | data, out_graph, or out_root is NULL, or size is zero; or options has invalid fields (non-NULL p_next, non-0/1 flags). |
| OCCTL_VERSION_MISMATCH | options has an unsupported struct_version. |
| OCCTL_IO_ERROR | Temporary stream failure. |
| OCCTL_FORMAT_ERROR | Payload contents were not a valid STEP stream. |
| OCCTL_TOPOLOGY_INVALID | Payload decoded but could not be ingested into BRepGraph. |
\par Thread Safety Yes.
| void occtl_io_step_read_options_init | ( | occtl_io_step_read_options_t * | options | ) |
Initialises options to default values matching OCCTL_IO_STEP_READ_OPTIONS_INIT.
NULL-tolerant.
| [out] | options | Borrows it. May be NULL (no-op). |
\par Thread Safety Yes.
| occtl_status_t occtl_io_step_write | ( | const occtl_graph_t * | graph, |
| occtl_node_id_t | root, | ||
| const char * | path, | ||
| const occtl_io_step_write_options_t * | options | ||
| ) |
Writes the topology rooted at root to a STEP file.
| [in] | graph | Borrows it. Must be non-NULL. |
| [in] | root | Root node id to serialise. |
| [in] | path | Borrows it. NUL-terminated UTF-8 path; existing file is overwritten. |
| [in] | options | Borrows it. May be NULL for defaults. |
| OCCTL_OK | On success. |
| OCCTL_INVALID_ARGUMENT | graph or path is NULL; or options has invalid fields (non-NULL p_next, non-0/1 flags). |
| OCCTL_NOT_FOUND | root is invalid or has been removed. |
| OCCTL_VERSION_MISMATCH | options has an unsupported struct_version. |
| OCCTL_OUT_OF_RANGE | options has unsupported unit or schema enum. |
| OCCTL_IO_ERROR | Filesystem failure or unwritable file. |
\par Thread Safety Yes (read-only on graph).
| occtl_status_t occtl_io_step_write_memory | ( | const occtl_graph_t * | graph, |
| occtl_node_id_t | root, | ||
| const occtl_io_step_write_options_t * | options, | ||
| uint8_t * | out_data, | ||
| size_t | capacity, | ||
| size_t * | out_size | ||
| ) |
Writes the topology rooted at root to caller-owned memory.
Two-call buffer pattern: call with out_data == NULL and capacity == 0 to learn the required byte count in out_size, allocate a buffer, then call again with capacity at least out_size.
| [in] | graph | Borrows it. Must be non-NULL. |
| [in] | root | Root node id to serialise. |
| [in] | options | Borrows it. May be NULL for defaults. |
| [out] | out_data | Borrows it. Writable output buffer, or NULL for sizing. |
| [in] | capacity | Size of out_data in bytes. |
| [out] | out_size | Borrows it. Receives the required byte count. |
| OCCTL_OK | On success. |
| OCCTL_INVALID_ARGUMENT | graph or out_size is NULL; or options has invalid fields (non-NULL p_next, non-0/1 flags). |
| OCCTL_NOT_FOUND | root is invalid or has been removed. |
| OCCTL_VERSION_MISMATCH | options has an unsupported struct_version. |
| OCCTL_OUT_OF_RANGE | options has unsupported unit or schema enum. |
| OCCTL_BUFFER_TOO_SMALL | out_data is non-NULL and capacity is smaller than out_size. |
| OCCTL_IO_ERROR | OCCT failed to serialise the shape. |
\par Thread Safety Yes (read-only on graph).
| void occtl_io_step_write_options_init | ( | occtl_io_step_write_options_t * | options | ) |
Initialises options to default values matching OCCTL_IO_STEP_WRITE_OPTIONS_INIT.
NULL-tolerant.
| [out] | options | Borrows it. May be NULL (no-op). |
\par Thread Safety Yes.