dxfToEgg.cxx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file dxfToEgg.cxx
  10. * @author drose
  11. * @date 2004-05-04
  12. */
  13. #include "dxfToEgg.h"
  14. #include "dxfToEggConverter.h"
  15. /**
  16. *
  17. */
  18. DXFToEgg::
  19. DXFToEgg() :
  20. SomethingToEgg("DXF", ".dxf")
  21. {
  22. add_units_options();
  23. add_normals_options();
  24. add_transform_options();
  25. set_program_brief("convert AutoCAD .dxf files to .egg files");
  26. set_program_description
  27. ("This program converts DXF (AutoCAD interchange format) to egg. It "
  28. "only converts polygon data, with no fancy tricks. DXF does not support "
  29. "hierarchical databases, so dxf2egg creates a single group at the root "
  30. "level for each layer in the DXF file.");
  31. redescribe_option
  32. ("cs",
  33. "Specify the coordinate system of the input " + _format_name +
  34. " file. Normally, this is z-up.");
  35. _coordinate_system = CS_zup_right;
  36. }
  37. /**
  38. *
  39. */
  40. void DXFToEgg::
  41. run() {
  42. nout << "Reading " << _input_filename << "\n";
  43. _data->set_coordinate_system(_coordinate_system);
  44. DXFToEggConverter converter;
  45. converter.set_egg_data(_data);
  46. converter._allow_errors = _allow_errors;
  47. apply_parameters(converter);
  48. if (!converter.convert_file(_input_filename)) {
  49. nout << "Errors in conversion.\n";
  50. exit(1);
  51. }
  52. write_egg_file();
  53. nout << "\n";
  54. }
  55. int main(int argc, char *argv[]) {
  56. DXFToEgg prog;
  57. prog.parse_command_line(argc, argv);
  58. prog.run();
  59. return 0;
  60. }