Analyze and Print Assembly Structure
The WALK ASSEMBLY program analyzes the products, shape representations, and relations in a STEP file to identify assembly structures. Once the structures have been identified, the program walks the structure printing a description of the key objects.
Assemblies are probably the most complex structure in STEP data sets. To process them correctly, you must look at relationships between products and relationships between shapes, watch for two different ways of describing placement of components (mapped item and context dependent shape reps), and resolve other indirections.
This sample program uses utility functions from the STIX AP Helper Library to identify the assembly structures and annotate the STEP data with backpointers to all the relevant pieces of an assembly. The stix_tag_asms function traverses the design and annotates it with three different RoseManager subclasses.
class StixMgrAsmProduct ==> on product_definition class StixMgrAsmShapeRep ==> on shape_representation class StixMgrAsmRelation ==> on shape_representation_relationship or mapped_item
Each of these contains arrays of backpointers, flags, and other information. Each also defines a static find() function that you can use to retrieve the manager for a given object. The walkasm program shows how to use this data and the STIX documentation describes the classes in detail.
stp_product_definition * pdef StixMgrAsmProduct * mgr; // retrieve assembly backpointers for product definition obj mgr = StixMgrAsmProduct::find(pdef);
Run the walkasm program on the command line. The sample dataset walkasm_in.stp contains assemblies. The walkasm program prints an indented list showing all of the assembly structures. The sample report output is shown in the file walkasm_out.txt.
In the list above, select your Visual Studio version or platform, then right click on the link to save the zipped project files to your local disk. Unpack the zipfile.
On Windows, open the enclosed project file with Visual Studio and compile the program by selecting "Build All". The project creates a Console application that you can run from the command line. When using the 64bit version of ST-Developer, change the platform from "win32" to "X64" in the Visual Studio Configuration Manager before building.
On MacOS, Linux, and other Unix systems, the project directory contains a makefile that builds the sample program. The makefile uses the ROSE, ROSE_INCLUDE, and ROSE_LIB environment variables described in the ST-Developer installation notes. Compile the program by typing "make".
The Windows projects also include a makefile that you can use by typing "nmake", but you must run vcvars32.bat (found in the Visual Studio C++ bin directory) to make sure that the C++ compiler is in the command line search path.