![]() |
Open CASCADE Technology 7.9.0
|
This guide explains how to use the Data Exchange Wrapper (DE Wrapper). It provides basic directions on setup, usage and file creation via DE_Wrapper.
The Data Exchange Wrapper (DE Wrapper) module allows reading and writing supported CAD formats to shape objects or special XDE documents, setting up the transfer process for all CAD files.
It is also possible to add support for new CAD formats by prototyping existing tools.
The DE Wrapper component requires XDE toolkit for operation.
This guide mainly explains how to convert CAD files to Open CASCADE Technology (OCCT) shapes and vice versa. This guide principally deals with the following OCCT classes:
CAD format | Extensions | RW support | Thread Safety | Presentation | Package |
---|---|---|---|---|---|
STEP | .stp, .step .stepz | RW | No | BRep, Mesh | STEPCAFControl |
XCAF | .xbf | RW | Yes | BRep, Mesh | DEXCAFCascade |
BREP | .brep | RW | Yes | BRep, Mesh | DEBRepCascade |
IGES | .igs, .iges | RW | No | BRep | IGESCAFControl |
OBJ | .obj | RW | Yes | Mesh | RWObj |
STL | .stl | RW | Yes | Mesh | RWStl |
PLY | .ply | W | Yes | Mesh | RWPly |
GLTF | .glTF .glb | RW | Yes | Mesh | RWGltf |
VRML | .wrl .vrml | RW | Yes | Mesh | Vrml |
Note :
Any providers can have their own read/write parameters. The transfer process is set up using DE configuration nodes, which hold all relevant parameters. There are two ways to change the parameter values: directly from code or by an external resource file/string. The session is a global or static DE_Wrapper object that stores registered DE configuration nodes and wraps DE commands to work with them. It has some configuration parameters of its own and also keeps track of loaded nodes and specilal global parameters.
Working with a DE session requires a DE_Wrapper object to be loaded or created first.
Getting the global DE_Wrapping object:
Creating a local DE_Wrapper:
It is recommended to create a local one-time copy to work with the session, if no global changes are intended.
Configuration resource is an external file or string of the following format:
The resource should be loaded after the registration of all providers that should be configured. The resource only impacts registered parameters. To configure a new registered provider it is necessary to load the resource again. Parameters not present in the resource will remain unchanged.
There are two ways to check what parameters are available:
There are two options for loading a resource: recursive and global parameters only. Recursive is the default option to configure all global parameters (units, priority, enable status) and all registered providers. Non-recursive configures only global parameters and ignores all provider settings. This option is the best for updating provider priority.
Configuring using a resource string:
Configuring using a resource file:
Configuring using a resource string:
Configuring using a resource file:
Saving the configuration of a DE Session involves dumping all parameters of registered providers. If a parameter did not change during the session, its value remains as default.
There are two ways to save a resource: recursive and global parameters only. Recursive is the way to dump all registered provider information. Non-recursive dumps only global parameters, for example, save priority of vendors or the length unit.
It is possible to filter what vendors or providers to save by providing the correct name of the vendor or provider.
Dump to resource string. If the vendors list is empty, saves all vendors. If the providers list is empty, saves all providers of valid vendors.
Configure using a resource file. If the vendors list is empty, saves all vendors. If the providers list is empty, saves all providers of valid vendors.
Dump configuration to string. If no list of vendors is passed or it is empty, all vendors are saved. If no providers list is passed or it is empty, all providers of valid vendors are saved.
Dump configuration to file. If no vendors list are set as an argument or it is empty, saves all vendors. If no providers list as argument or it is empty, saves all providers of valid vendors:
To transfer a CAD file using DE Wrapper, it is necessary to register a CAD provider. The provider contains internal and global parameters that have default values in the creation stage. All registered providers are set to the map with information about its vendor and kept as smart handles. Therefore, it is possible to change the values via handle from external code.
It is necessary to register only one ConfigurationNode for all needed formats.
Use DRAW with all providers registered by the following command:
It is possible to change a parameter from code using a smart pointer.
DE session is able to work with several vendors with the same supported CAD format. To choose the preferred vendor for each format, use a special priority list.
If the high priority vendor's provider is not supported, a transfer operation is needed (write/read), then the next vendor will be chosen.
It is recommended to disable recursion and update only global parameters.
To transfer from a CAD file to OCC or from OCC to a CAD file, it is necessary to use a configured DE_Wrapper object. It can be local, one-time or global. Global configuration of DE_Wrapper propagates to all nodes via transfer. There are two options for transferring: using OCC shape or XCAF document. It is possible to work only with real path to/from the file. Streaming is not supported (yet).
The format of input/output file is automatically determined by its extension or contents.
Reading STEP file to Shape.
Writing Shape to STEP file.
Reading STEP file into XCAF document.
Writing XCAF document into STEP.
Reading a STEP file into a Shape.
Writing a Shape into STEP.
Reading STEP into XCAF document.
Writing XCAF document into STEP.
It is possible to read and write CAD files directly from a special provider.
It is possible to change the configuration of only one transfer operation. To avoid changing parameters in a session, one-time clone of the session can be created and used for transfer. This way is recommended for use in multithreaded mode.
Code sample to configure via transfer.
Code sample to configure via transfer within DRAW command.
Code sample to configure via transfer as variable.