-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathp21mini.cpp
45 lines (35 loc) · 1.32 KB
/
p21mini.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <sc_cf.h>
extern void SchemaInit( class Registry & );
#include <sdai.h>
#include <STEPfile.h>
#include <STEPattribute.h>
#include <ExpDict.h>
#include <Registry.h>
#include <errordesc.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
int main( int argc, char * argv[] ) {
// the registry contains information about types present in the current schema; SchemaInit
// is a function in the schema-specific SDAI library
Registry registry(SchemaInit);
//the InstMgr holds instances that have been created or that have been loaded from a file
InstMgr instance_list;
// STEPfile takes care of reading and writing Part 21 files
STEPfile sfile(registry, instance_list, "", false);
// read a file, using the name from the command line
sfile.ReadExchangeFile(argv[1]);
// check for errors; exit if they are particularly severe
if( sfile.Error().severity() < SEVERITY_USERMSG ) {
sfile.Error().PrintContents( cout );
}
if( sfile.Error().severity() <= SEVERITY_INCOMPLETE ) {
exit(1);
}
// write to "file.out", then check for write errors. The write operation overwrites any
// errors caused by previous operations.
sfile.WriteExchangeFile("file.out");
if( sfile.Error().severity() < SEVERITY_USERMSG ) {
sfile.Error().PrintContents(cout);
}
}