1.1 Overview
The Part 21 Working Set library is a ROSE library extension for extracting and processing data from very large STEP files. The library contains several C++ classes and functions that can be used to perform the following operations:
- Obtaining statistical information about a STEP Part 21 file.
- Retrieving entity IDs for a set of entity types.
- Finding types of particular entity instances.
- Finding references of the given entity instances.
- Extracting a subset of entities, called the "working set," from a file according to your specification.
- Loading the specified working set into the memory as a RoseDesign object.
- Merging the modified working set into the original file.
- Splitting a large STEP file into several smaller files, each containing a separately specified subset of entities.
These operations are done "out-of-memory;" the original large file is never loaded into memory as C++ objects. Operations are done on the file as a text stream, and can run quickly. For simple operations on large files, this technique can be faster than reading the entire file into memory. On files less than a few megabytes in size, or with more complex operations, the ROSE library will outperform the Part 21 Working Set library.
The working set descriptions can be used to cut out some dependency branches. Normally the extraction process will take all dependents of the entities in the working set. Using the extended syntax some of the dependents can be selectively left out. The extended syntax can also be used for excluding particular types, or using entity IDs instead of type names.
1.2 Example
The following example extracts a geometric shape from an AP-203 file given as the first program argument:
#include <WorkingSet.h>
void main(int argc, char* argv[]) {
RoseDesign * design;
P21WorkingSet WS;
WS.add("advanced_brep_shape_representation");
design = WS.useDesign(argv[1]);
design-> saveAs("shape");
}
The first statement creates a working set object. The working set associated with this object is initially empty.
P21WorkingSet WS;
The next statement adds a single entry to the working set. All entities of the type advanced_brep_shape_representation and all entities that they refer to will be loaded into memory by the useDesign() function.
WS.add("advanced_brep_shape_representation");
design = WS.useDesign(argv[1]);
The working set useDesign() function uses the same arguments as the RoseInterface::useDesign function. The last statement saves the extracted RoseDesign object in a new file named "shape.stp."
design-> saveAs("shape");