Search STEP Tools Web Support

Source and output

Project Files

(Right-click on projects to save)

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 collects code to do all of these things into the asmutils.h/cxx files. The stplib_classify_asms() function traverses a design and annotates the STEP data with backpointers to all the relevant pieces of an assembly. The backpointers are stored in three different RoseManager subclasses.

class StpAsmProductMgr	==> on product_definition
class StpAsmShapeRepMgr ==> on shape_representation
class StpAsmRelationMgr ==> 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 asmutils.h header file describes the classes in detail.

     product_definition * pdef
     StpAsmProductMgr * mgr;

     // retrieve assembly backpointers for product definition obj
     mgr = StpAsmProductMgr::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.

Build Instructions

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.