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

OCCT-Light: native OCCT BRep file I/O. More...

#include <stddef.h>
#include <stdint.h>
#include "occtl_core.h"
#include "occtl_topo.h"
Include dependency graph for occtl_io_brep.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  occtl_io_brep_write_options
 

Macros

#define OCCTL_IO_BREP_WRITE_OPTIONS_VERSION_1   1u
 
#define OCCTL_IO_BREP_WRITE_OPTIONS_INIT   {OCCTL_IO_BREP_WRITE_OPTIONS_VERSION_1, NULL, 1}
 

Typedefs

typedef struct occtl_io_brep_write_options occtl_io_brep_write_options_t
 

Functions

void occtl_io_brep_write_options_init (occtl_io_brep_write_options_t *options)
 
occtl_status_t occtl_io_brep_read (const char *path, occtl_graph_t **out_graph, occtl_node_id_t *out_root)
 
occtl_status_t occtl_io_brep_write (const occtl_graph_t *graph, occtl_node_id_t root, const char *path, const occtl_io_brep_write_options_t *options)
 

Detailed Description

OCCT-Light: native OCCT BRep file I/O.

Read and write .brep files via OCCT's DEBREP_Provider / DEBREP_ConfigurationNode. The provider round-trips through OCCT's internal shape representation.

Typedef Documentation

◆ occtl_io_brep_write_options_t

Options for occtl_io_brep_write. Pass NULL for defaults (binary output, triangulations included). The format flavour (binary vs ASCII) is determined by the DEBREP_Provider from its configuration — the caller can rely on OCCT's default binary encoding without setting it explicitly here.

Function Documentation

◆ occtl_io_brep_read()

occtl_status_t occtl_io_brep_read ( const char *  path,
occtl_graph_t **  out_graph,
occtl_node_id_t out_root 
)

Reads a BRep file and ingests it into a freshly-created graph.

The returned graph contains the topology rooted at out_root. Caller owns the graph and must release it via occtl_graph_free.

Parameters
[in]pathBorrows it. NUL-terminated UTF-8 path to the file.
[out]out_graphOwns it. Receives a new graph on success; NULL on failure.
[out]out_rootBorrows it. Receives the NodeId of the root entity.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTpath, out_graph, or out_root is NULL.
OCCTL_IO_ERRORFilesystem failure or unreadable file.
OCCTL_FORMAT_ERRORFile contents were not a valid BRep stream.

\par Thread Safety Yes.

See also
occtl_io_brep_write, occtl_de_read

◆ occtl_io_brep_write()

occtl_status_t occtl_io_brep_write ( const occtl_graph_t graph,
occtl_node_id_t  root,
const char *  path,
const occtl_io_brep_write_options_t options 
)

Writes the topology rooted at root to a BRep file.

Triangulation policy is taken from options; pass NULL for defaults (binary, triangulations included). The output format (binary / ASCII) is managed by the DEBREP_Provider internally.

Parameters
[in]graphBorrows it. Must be non-NULL.
[in]rootRoot node id to serialise.
[in]pathBorrows it. NUL-terminated UTF-8 path; existing file is overwritten.
[in]optionsBorrows it. May be NULL.
Return values
OCCTL_OKOn success.
OCCTL_INVALID_ARGUMENTgraph or path is NULL; or options has invalid fields (non-NULL p_next, write_triangulation not in {0,1}).
OCCTL_NOT_FOUNDroot is invalid or has been removed.
OCCTL_VERSION_MISMATCHoptions has an unsupported struct_version.
OCCTL_IO_ERRORFilesystem failure or unwritable file.

\par Thread Safety Yes (read-only on graph).

See also
occtl_io_brep_read, occtl_de_write

◆ occtl_io_brep_write_options_init()

void occtl_io_brep_write_options_init ( occtl_io_brep_write_options_t options)

Initialises options to default values matching OCCTL_IO_BREP_WRITE_OPTIONS_INIT.

NULL-tolerant.

Parameters
[out]optionsBorrows it. May be NULL (no-op).

\par Thread Safety Yes.

See also
occtl_io_brep_write