00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "dxfToEgg.h"
00016
00017 #include "dxfToEggConverter.h"
00018 #include "pystub.h"
00019
00020
00021
00022
00023
00024
00025 DXFToEgg::
00026 DXFToEgg() :
00027 SomethingToEgg("DXF", ".dxf")
00028 {
00029 add_units_options();
00030 add_normals_options();
00031 add_transform_options();
00032
00033 set_program_description
00034 ("This program converts DXF (AutoCAD interchange format) to egg. It "
00035 "only converts polygon data, with no fancy tricks. DXF does not support "
00036 "hierarchical databases, so dxf2egg creates a single group at the root "
00037 "level for each layer in the DXF file.");
00038
00039 redescribe_option
00040 ("cs",
00041 "Specify the coordinate system of the input " + _format_name +
00042 " file. Normally, this is z-up.");
00043
00044 _coordinate_system = CS_zup_right;
00045 }
00046
00047
00048
00049
00050
00051
00052 void DXFToEgg::
00053 run() {
00054 nout << "Reading " << _input_filename << "\n";
00055
00056 _data->set_coordinate_system(_coordinate_system);
00057
00058 DXFToEggConverter converter;
00059 converter.set_egg_data(_data);
00060 converter._allow_errors = _allow_errors;
00061
00062 apply_parameters(converter);
00063
00064 if (!converter.convert_file(_input_filename)) {
00065 nout << "Errors in conversion.\n";
00066 exit(1);
00067 }
00068
00069 write_egg_file();
00070 nout << "\n";
00071 }
00072
00073
00074 int main(int argc, char *argv[]) {
00075
00076 pystub();
00077
00078 DXFToEgg prog;
00079 prog.parse_command_line(argc, argv);
00080 prog.run();
00081 return 0;
00082 }