Overview
The iges2step application is a simple wrapper around the igeslib library. The source code below shows the basic structure of the program.
#include <igeslib.h> static void usage (const char * name) { fprintf (stderr, "Usage: %s [options] <igsfile>\n", name); exit (1); } #define NEXT_ARG(i,argc,argv) ((i<argc)? argv[i++]: 0) int main (int argc, char ** argv) { int i=1; char * outfile = 0; char * arg; ROSE.quiet(1); igeslib_force_load(); igeslib_create_builtin_schemas(); /* must have at least two args */ if (argc < 2) usage(argv[0]); /* get remaining keyword arguments */ while ((arg=NEXT_ARG(i,argc,argv)) != 0) { /* command line options */ if (!strcmp (arg, "-o")) { outfile = NEXT_ARG(i,argc,argv); if (!outfile) { fprintf (stderr, "option: -o <file>\n"); exit (1); } } else break; } if (!arg) { fprintf (stderr, "ERROR: missing input file name\n"); usage(argv[0]); } while (arg) { RoseDesign * d = new RoseDesign(); igs_iges_file * f = pnewIn(d) igs_iges_file; f->read(arg); // parse IGES file if (outfile && *outfile) { d-> path(outfile); // use path given by user } else { d-> path(arg); d-> fileExtension(0); // use default step extension d-> fileDirectory(0); // write to current directory } d-> format("step"); d-> save(); outfile = 0; /* only save the first as outfile */ arg = NEXT_ARG(i,argc,argv); } return 0; }
Copyright © 2024 STEP Tools Inc. All Rights Reserved.