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

Overview

The ST-Developer for Java programming environment consists of a EXPRESS compiler that can generate Java classes (express2java), and a set of foundation classes (stdev.jar) that provide services such as reading writing instances to STEP Part 21 exchange files.

You can build a Java application around any EXPRESS information model. The express2java compiler generates pure Java classes for every definition in the model, which you can then use to create and manipulate data sets. ST-Developer includes pre-generated classes for all STEP Application Protocols (ap203.jar, ap214.jar, etc), and other common models (IFC, CIS/2), so you may not even need the compiler to get started.

All of the generated classes that are pure Java, so they will work on any platform with a JVM. To use them, you need to add the stdev.jar, plus the appropriate EXPRESS class library into your classpath.

Below are some simple examples and following chapters describe the interface in more detail. Reading, Writing, and Traversing Data describes how instance data is grouped in memory and how to control the reading and writing of files. From EXPRESS to Java Classes describes how EXPRESS constructs are represented in the generated Java classes, how to get and set values, and other operations on the instance data.

A Simple Example

This is a Java version of the "tutorial1" demo included with the ST-Developer C++ API. This creates a small data set based on a simple "picture" schema with points and lines.

    import java.io.IOException;

    import com.steptools.stdev.*;
    import com.steptools.stdev.p21.Part21Writer;
    import com.steptools.schemas.picture.*;

    public class tutorial1 {
        public static void main (String[] args) throws IOException {
        
            Model mod = new Model(Schema.SCHEMA);
            Population pop = (Population)mod.getPopulation();
        
         /* Create a point using the default constructor
          *  and use the update methods to set its values. */
            Point point1 = pop.newPoint();
            point1.setX(1.0);
            point1.setY(0.0);

            Point point2 = pop.newPoint ();
            point2.setX(2.5);
            point2.setY(4.0);
            
            Point point3 = pop.newPoint ();
            point3.setX(5.0);
            point3.setY(0.0);
            
            
            /* Create a Line Object */
            Line line = pop.newLine();      
            line.setEnda(point1);
            line.setEndb(point2);
         
            /* Create a Circle with Center (0,0), radius 1.5 */
            Point point4 = pop.newPoint();
            point4.setX(0.0);
            point4.setY(0.0);

            Circle circle1 = pop.newCircle ();
            circle1.setRadius(1.5);
            circle1.setCenter(point4);

            /* Create a Text Object centered at point3 */
            Text text = pop.newText ();
            text.setLabel ("A Little Picture");
            text.setCenter(point3);
         
            /* Create another Circle Object */
            Circle circle2 = pop.newCircle();
            circle2.setRadius(1.5);
            circle2.setCenter(point2);

            Part21Writer writer = new Part21Writer();
            writer.write("tutorial1.stp", mod);
        }
    }

To compile, you will need the location of the stdev.jar file. All jar files provided with ST-Developer are located in the installation "lib/java" directory. The ROSE environment variable is normally set to the ST-Developer installation directory, so we can use $ROSE/lib/java or %ROSE%\lib\java when setting our class path.

Our sample EXPRESS schema is in picture.exp. Call the EXPRESS compiler to generate the Java source files. The *.java source files will be put in the java_classes subdirectory:

    > express2java picture.exp

Next we will compile the source files with the Java compiler to create *.class files. Create a directory called obj to hold the output. Note that the source files are under a special namespace for the "picture" schema.

    > mkdir java_objs
    > javac -classpath "%ROSE%"\lib\java\stdev.jar -d java_objs \
          tutorial1.java \
          java_classes\com\steptools\schemas\picture\*.java

Run the application. We need to set the class path to find both the ST-Developer base classes (stdev.jar) and the classes for our schema.

    > java -classpath "%ROSE%"\lib\java\stdev.jar;java_objs tutorial1

The demos directory includes two sample applications that demonstrate how to use the interface. See the README.txt for tutorial1 for instructions on how to compile and run that sample application

Pre-installed Application Protocols

In the previous example, we generated the Java classes for our own example schema, but when you build your applications, you are more likely to work against one of the STEP application protocols, like AP203 or AP214. ST-Developer ships with pre-built Java libraries for the common APs and other models like CIS/2 and IFC.

You can start programming immediately, just by adding the appropriate library to your classpath, such as ap203lib.jar, ap214lib.jar, or others. The ST-Developer online documentation has the complete list of APs available as well as class listings, browsable EXPRESS definitions, recommended practices and more. Some of the schemas are shown below:

    ap201lib.jar  com.steptools.schemas.explicit_draughting
    ap202lib.jar  com.steptools.schemas.associative_draughting
    ap203lib.jar  com.steptools.schemas.config_control_design
    ap209lib.jar  com.steptools.schemas.structural_analysis_design
    ap214lib.jar  com.steptools.schemas.automotive_design
    ap215lib.jar  com.steptools.schemas.ship_arrangement_schema
    ap216lib.jar  com.steptools.schemas.ship_moulded_form_schema
    ap218lib.jar  com.steptools.schemas.ship_structures_schema
    ap224lib.jar  com.steptools.schemas.feature_based_process_planning
    ap225lib.jar  com.steptools.schemas.building_design_schema
    ap227lib.jar  com.steptools.schemas.plant_spatial_configuration
    ap232lib.jar  com.steptools.schemas.technical_data_packaging
    ap238lib.jar  com.steptools.schemas.integrated_cnc_schema
    cislib.jar    com.steptools.schemas.structural_frame_schema
    ifc2x3lib.jar com.steptools.schemas.ifc2x3
| Book Contents | ST-Developer Home | Previous Chapter | Next Chapter |