Sample Code
The following is a list of code samples available to HOOPS Exchange developers. These samples are short applications that demonstrate a specific functional topic. The source code for each sample is distributed as part of the HOOPS Exchange package. The sample sources are located at <exchange_install_dir>/samples/exchange/exchangesource/. Before running each sample, you must first build it. Visual Studio project files and Linux makefiles are included.
B-Rep adaptor
Cascaded attributes
Create PRC B-Rep with geometry
Create PRC cube
Drawing viewer
Write CAD features to XML file
Import-export
Incremental load
Load CAD file with multiple configurations
Import multiple PRC files
.NET wrapper
PRC to XML
Sew B-Rep
Shattered
TranslateToPkParts
Viewer
B-Rep adaptor
samples/exchange/exchangesource/BrepAdaptator
This sample demonstrates how to programmatically adapt B-Rep models to particular needs using HOOPS Exchange. The only input is the CAD file path.
- Load a CAD file
- Traverse the entire data structure
- Call A3DCopyAndAdaptBrepModel for each BrepModel
- Copy inputs BrepModels
- Selected geometrical surfaces are converted to NURBS
- Faces are split
- UV curves are computed
- New modified data are populated
- PRC is exported from the modified data
Cascaded attributes
samples/exchange/exchangesource/CascadedAttributes
This sample demonstrates how to programmatically set the mechanism of the cascaded attributes using HOOPS Exchange.
Create PRC B-Rep with geometry
samples/exchange/exchangesource/CreatePRCBrepWithGeometry
This sample demonstrates how to programmatically create a PRC file using HOOPS Exchange. The only input is the file path. The program generates a PRC file which contains a tessellated textured cube and a simple markup.
Create PRC cube
samples/exchange/exchangesource/CreatePRCCube
This sample demonstrates how to programmatically create a PRC file using HOOPS Exchange. The only input is the file path. The program generates a PRC file which contains a tessellated textured cube and a simple markup.
Drawing viewer
samples/exchange/exchangesource/DrawingViewer
This sample demonstrates how to programmatically visualize a drawing PRC file from a basic OpenGL program using HOOPS Exchange.
DumpFeatureTree
samples/exchange/exchangesource/DumpFeatureTree
This sample demonstrates how to traverse a model and capture its features in an XML file.
Import-export
samples/exchange/exchangesource/ImportExport
This sample demonstrates how to programmatically import a CAD model using HOOPS Exchange and convert it to another format.
Incremental load
samples/exchange/exchangesource/IncrementalLoad
This sample demonstrates two ways of loading a CAD file: normal loading and incremental loading (first the assembly tree, then the parts contained in the file). Using the incremental loading technique allows a more fine-grained approach, which is especially beneficial when dealing with huge files (e.g., for loading only specific items at a time rather than the whole file in one shot). The only input is the file path.
Load CAD file with multiple configurations
samples/exchange/exchangesource/LoadMultiConfigCADFile
This sample demonstrates how to programmatically load CAD files that contain multiple configurations using HOOPS Exchange. The only input is the file path.
Import multiple PRC files
samples/exchange/exchangesource/MultiplePRCFiles
This sample demonstrates how to programmatically create and read multiple PRC files from a CAD assembly using HOOPS Exchange. The input is the CAD assembly file path and a directory. The program generates multiple PRC files from this CAD assembly.
This mode is supported for the following formats: V4, V5, ProE, UG, SLDW. With other formats, only one PRC file is generated.
.NET wrapper
samples/exchange/exchangesource/NetWrapper
This sample demonstrates how to use HOOPS Exchange with a .NET wrapper by converting any CAD file to XT.
PRC to XML
samples/exchange/exchangesource/PRC2XML
Converts a PRC file to an XML representation.
Sew B-Rep
samples/exchange/exchangesource/SewBrep
This sample demonstrates how to programmatically adapt B-rep models to particular needs using HOOPS Exchange. The only input is the CAD file path.
- Load a CAD file
- Traverse the entire data structure
- Call A3DSewBrep for each B-rep model
- New modified data are populated
- PRC is exported from the modified data
Shattered
samples/exchange/exchangesource/Shattered
This sample demonstrates how to use the shattered mode in HOOPS Exchange. The input is the CAD assembly file path and a directory. The program generates multiple PRC files from this CAD assembly.
- Load a CAD assembly
- Extract all dependencies from the CAD assembly
- Convert CAD part files to PRC
- Convert CAD assembly files to PRC
- Reload the full model into memory from the previously created PRC files.
TranslateToPkParts
samples/exchange/exchangesource/TranslateToPkParts
This sample demonstrates how to use the Parasolid bridge in HOOPS Exchange to send the converted CAD data to Parasolid and then use the Parasolid APIs to perform advanced functions on the geometry, like healing, merge, simplify, sew, or accurate edges. The input is the CAD file path and a directory plus the options. The program generates a Parasolid file from this CAD file. Please note that this sample won't compile right away, specific things (detailed in the header of the source file) related to the Parasolid setup need to be done before running it.
Viewer
samples/exchange/exchangesource/Viewer
This file demonstrates how to programmatically visualize a PRC file with a basic OpenGL program using HOOPS Exchange.