Book Contents | Previous Chapter | Next Chapter
Search STEP Tools Web Support

Overview

The P21WorkingSet class is used to either extract entities included in the working set from a STEP file or to split the file into two parts -- one containing all the entities in the working set and the other containing the rest of the entities from the original file.

The class has methods to obtain a RoseDesign object representing the design with the entities included in the working set. It also has methods that manipulate STEP files directly generating new STEP files with extracted and/or discarded entities.

The class also provides methods to manipulate the working set itself by adding and removing entities.

The working set can be specified using the extended syntax to cut out some reference chains. Normally the extraction process will take all references of the entities in the working set. Using the extended syntax some of the references can be selectively left out. The extended syntax can also be used for excluding particular types, or using entity IDs instead of type names.

P21WorkingSet Constructors

P21WorkingSet(
	RoseBoolean isa_mode = ROSE_FALSE
	);

This constructor creates an empty working set object. If the isa_mode argument is true, the object will consider complex (AND/OR) entities as having an IS-A relationship to entities in the working set. A complex entity does not have a specific type, but rather has a set of types. When this argument is ROSE_TRUE the object will take a complex entity if at least one of its types is present in the working set. If this argument is ROSE_FALSE, the object will consider only exact types, thus ignoring complex entities altogether.

P21WorkingSet(
	STR ws_file_name,
	RoseBoolean isa_mode = ROSE_FALSE
	);

This constructor creates an object and fills the working set from the given file.

P21WorkingSet(
	SetOfString* ws,
	RoseBoolean isa_mode=ROSE_FALSE
	);

This constructor creates an object and fills the working set from the given list of strings.

P21WorkingSet Destructor

~P21WorkingSet();

The destructor calls the reset() function during object clean-up.

add()

void add(
	STR entity
	);

This method adds a new entity to the working set.

The entity argument specifies the entity type or instance ID. For complete syntax specification see Working Set Syntax.

remove()

void remove(
	STR entity
	);

The remove method removes the entity from the working set. The entity argument is a string specification of the entity. It should match exactly the specification in the working set.

isaMode()

RoseBoolean isaMode();
void isaMode(
	RoseBoolean isa_mode
	);

The isaMode() functions get or set the "IS-A" mode flag.

The "IS-A" mode is used for type selection -- if this mode is set to ROSE_TRUE, the object will consider complex (AND/OR) entities that have an IS-A relationship to the entities in the working set. A complex entity does not have a specific type, but rather has a set of types. When the "IS-A" mode is on the object will take a complex entity if at least one of its types is present in the working set. If the mode is reset (ROSE_FALSE), the object will consider only exact types, thus ignoring complex entities altogether.

setSafeMode()

void setSafeMode(
	EMODE safe_mode
	);

This method is used to set the "safety level" of operation. The safe_mode argument is an enum value defined as:

    typedef enum { FAST, SAFE, SAFEST } EMODE;

When the safety level is set to FAST, the object is configured for maximum performance but some rare syntax in the Part 21 file may cause the object to behave incorrectly. Examples of such syntax include constructs that look like entity references (#<number>) inside character strings and comments within entity definitions. For example:

    #10=MY_ENITY('Name', 12, #40, 'Will break #130 here', 99.34);
    #20=ANOTHER_ONE('Untitled', /* Will break here #50 too */ 8, #100, #70);

The entity #10 will cause incorrect operation in the FAST mode, but will be processed correctly in the SAFE and the SAFEST modes. The entity #20 will be processed correctly only in the SAFEST mode.

Note

The default setting is always FAST.

reset()

void reset();

This method cleans the object by removing all entries from the working set.

findDesign()

RoseDesign* findDesign(
	STR design_name
	);

This method is an equivalent of RoseInterface::findDesign. It takes the design file name as an argument and returns a pointer to a RoseDesign object. The resulting design will only contain entities specified by the working set.

Note

the design name should be a name of a STEP Part 21 file, files in ROSE format are not supported.

useDesign()

RoseDesign* useDesign(
	STR design_name
	);

This method is an equivalent of RoseInterface::useDesign. It takes the design file name as an argument and returns a pointer to a RoseDesign object. It also makes the resulting design the current design. The resulting design will only contain entities specified by the working set.

Note

the design name should be a name of a STEP Part 21 file, files in ROSE format are not supported.

findDesignsAs()

RoseDesign* findDesignsAs(
	SetOfString* design_names,
	STR design_name
	);

This method is a merger function. It filters several Part 21 files at once, creating a combined design in memory.

The design_names argument is a set of input file names. The design_name argument is the name of the new combined design.

useDesignsAs()

RoseDesign* useDesignsAs(
	SetOfString* design_names,
	STR design_name
	);

This method performs as findDesignsAs with the only difference being that the new design will become the current rose design.

saveDesign()

void saveDesign(
	RoseDesign* design = NULL
	);
void saveDesign(
	STR design_name
	);

This saveDesign() function saves the design into the original file. This function merges the given design (or the current rose design if NULL is given) into the original file. The integrity of the original file is preserved.

The second version is the same as the first, but takes the design name instead of the pointer.

saveDesignAs()

void saveDesignAs(
	STR new_name,
	RoseDesign* design = NULL
	);
void saveDesignAs(
	STR new_name,
	STR design_name
	);

These methods are similar to the saveDesign methods but save the design under the new name.

extract()

void extract(
	STR design_name,
	STR to_name = NULL
	);

This method bypasses ROSE completely. It is useful when your application must process files without actually using any design objects. This method is similar to the findDesign method, but copies the extracted entities to the file with the name given in the to_name argument without loading any design in memory.

If the to_name argument is NULL, the new name will be <design_name>+ws.stp (Given a name of "my_design", the result will be "my_design+ws.stp").

void extract(
	SetOfString* design_names,
	STR to_name
	);

This method is an extension of the first extract method to use on a set of files rather than a single file.

split()

void split(
	STR design_name,
	STR ws_name = NULL,
	STR compl_name = NULL
	);

This method splits the file into a working set file and a complement file. The working set file contains all entities extracted according to the working set specification. The complement file contains all the entities of the original file not included in the working set file.

The design_name argument is the name of the Part 21 file to split. The ws_name argument is the name of the working set file. If this argument is NULL, the new name will be <design_name>+ws.stp (e.g. if the design_name is "my_design", the resulting working set file name will be "my_design+ws.stp"). The compl_name argument is the name of the complement file. If this argument is NULL, the new name will be <design_name>-ws.stp (e.g. if the design_name is "my_design", the resulting complement file name will be "my_design-ws.stp")

 

| Book Contents | ST-Developer Home | Previous Chapter | Next Chapter |