Print Spatial Structure
The PRINT_SPATIAL sample program recursively prints the spatial structure defined in an IFC file, beginning with the IfcProject root. Use this as the starting point for a more sophisticated program.
This program reads an IFC Part 21 file called "output_file.ifc", although you can easily modify the code to read other files. This is a text file, so you can look at it with a text editor or the STEP Part 21 file browser to see how the information is represented.
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.
Java Build Instructions
Right click on the link for the Java Version and save the project zipfile to your local disk. Unpack the zipfile.
You can build and run from the command line or with an IDE like Eclipse. In either case, you must add the jars for the base ST-Developer classes and the IFC schema classes to your classpath.
On the command line, you can find these jars through the ROSE environment variable as shown below:
# windows > javac -cp "%ROSE%\lib\java\stdev.jar;%ROSE%\lib\java\ifc2x3lib.jar" PrintSpatial.java > java -cp "%ROSE%\lib\java\stdev.jar;%ROSE%\lib\java\ifc2x3lib.jar;." PrintSpatial # unix > javac -cp "$ROSE/lib/java/stdev.jar;$ROSE/lib/java/ifc2x3lib.jar" PrintSpatial.java > java -cp "$ROSE/lib/java/stdev.jar;$ROSE/lib/java/ifc2x3lib.jar;." PrintSpatial
When using Eclipse, we suggest setting a classpath variable called ROSE_JAVA that points to the ST-Developer jar directory, so you can refer to jars in a portable way.
In the properties dialog under Project | Properties, select Java Build Path and the Libraries tab. Then use Add Variable | Configure Variables | New to create a classpath variable called ROSE_JAVA that points to the ST-Developer jar folder. To reference each jar, select Add Variable, choose ROSE_JAVA and use Extend to pick the stdev.jar or ifc2x3.jar files.