Overview
The STEP Ship Schema Library merges the definitions from AP215, AP216, AP218, and AP203 into a single EXPRESS schema and generated C++ class library. This allows applications to use C++ classes and easily read and write files from any of these APs.
- Merged schema in a browsable form, as well as the EXPRESS source listing.
- Working set file.
A installer for the STEP Merged Ship Schema Library is available at the URL below. This installer is for use with ST-Developer v12 on the Win32 platform. Contact us if you have ST-Developer v12 and need a version for a different platform.
ftp://ftp.steptools.com/pub/stdev/stpship_12_0_win32.msi
Using the Library
The stpship class library is installed as shown below:
- Include File: stp_schema.h
- Include Path: $(ROSE_INCLUDE)/stpship
- Library Path: $(ROSE_LIB) with stpship.lib or -lstpship
- Class List
The classes belong to the "step_ship_schema" schema so we have added functions that query the AP that a file was read as and control the AP that a file identifies itself as when writing. You must call stpship_init() at the start of your application to initialize handling of STEP files with the merged schema.
void stpship_init();Example:
#include <stp_schema.h>
int main(int argc, char* argv[])
{
stp_schema_force_load();
stpship_init();
// body of program
}
Writing Files
When you create a new file, call the stpship_put_schema()
function to identify the schema that should be written in the P21
header. If you do not call this, the file will identify its schema as
"STEP_SHIP_SCHEMA", which no other application will recognize.
These schema control functions use the StpShipSchemaType enum to identify the APs. The stpship_schema_none value is used to indicate a design has just been created and not assigned an AP.
enum StpShipSchemaType {
stpship_schema_none, // new file, no schema set
stpship_schema_ap203,
stpship_schema_ap215,
stpship_schema_ap216,
stpship_schema_ap218,
stpship_schema_other,
};
void stpship_put_schema (
RoseDesign * design,
StpShipSchemaType schema_code
);
The sample program below creates a design containing a single
cartesian point and writes it out using each of the possible schemas:
#include <stp_schema.h>
void main()
{
stp_schema_force_load();
stpship_init();
RoseDesign *d = new RoseDesign ("foo");
stp_cartesian_point * p = pnewIn(d) stp_cartesian_point;
// no proper AP, just step_ship_schema
d-> saveAs ("test_default.stp");
stpship_put_schema (d, stpship_schema_ap203);
d-> saveAs ("test_ap203.stp");
stpship_put_schema (d, stpship_schema_ap215);
d-> saveAs ("test_ap215.stp");
stpship_put_schema (d, stpship_schema_ap216);
d-> saveAs ("test_ap216.stp");
stpship_put_schema (d, stpship_schema_ap218);
d-> saveAs ("test_ap218.stp");
}
The complete set of types are available to you, so it is possible to
create files containing instances that are not appropriate for an AP,
such as a non_manifold_surface_shape_representation in an AP203 file.
To help, we have annotated the EXPRESS to indicate which APs support
each definition.
Reading Files
When reading files, use the stpship_get_schema() function to
query the schema that a file was read as. If the type is "other", the
stpship_get_schema_name can be used to get schema name.
StpShipSchemaType stpship_get_schema (
RoseDesign * design
);
char * stpship_get_schema_name (
RoseDesign * design
);
The code below reads the files written by the previous example and
prints out some identifying schema information:
#include <stp_schema.h>
void print_info (RoseDesign *d)
{
printf ("==> schemaname: %s\n", stpship_get_schema_name (d));
switch (stpship_get_schema (d)) {
case stpship_schema_none: printf ("==> no schema set\n"); break;
case stpship_schema_ap203: printf ("==> AP203 file\n"); break;
case stpship_schema_ap215: printf ("==> AP215 file\n"); break;
case stpship_schema_ap216: printf ("==> AP216 file\n"); break;
case stpship_schema_ap218: printf ("==> AP218 file\n"); break;
case stpship_schema_other: printf ("==> Other type of file\n"); break;
}
}
void main()
{
stp_schema_force_load();
stpship_init();
printf ("Using null pointer\n");
print_info (0);
printf ("Using new design\n");
print_info (new RoseDesign ("foo"));
print_info (ROSE.findDesign ("test_default.stp"));
print_info (ROSE.findDesign ("test_ap203.stp"));
print_info (ROSE.findDesign ("test_ap215.stp"));
print_info (ROSE.findDesign ("test_ap216.stp"));
print_info (ROSE.findDesign ("test_ap218.stp"));
}
The code will print the following output:
Using null pointer ==> schemaname: step_ship_schema ==> no schema set Using new design ==> schemaname: step_ship_schema ==> no schema set Reading: .\test_default.stp ==> schemaname: STEP_SHIP_SCHEMA ==> Other type of file Reading: .\test_ap203.stp ==> schemaname: CONFIG_CONTROL_DESIGN ==> AP203 file Reading: .\test_ap215.stp ==> schemaname: SHIP_ARRANGEMENT_SCHEMA ==> AP215 file Reading: .\test_ap216.stp ==> schemaname: SHIP_MOULDED_FORM_SCHEMA ==> AP216 file Reading: .\test_ap218.stp ==> schemaname: SHIP_STRUCTURES_SCHEMA ==> AP218 file