00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "dxfPoints.h"
00016 #include "pystub.h"
00017
00018
00019
00020
00021
00022
00023 DXFPoints::
00024 DXFPoints() :
00025 WithOutputFile(true, true, false)
00026 {
00027
00028
00029 _preferred_extension = ".txt";
00030
00031 set_program_description
00032 ("This program reads an AutoCAD .dxf file and generates a simple "
00033 "list of all the points contained within it, one per line, to a "
00034 "text file, or to standard output.");
00035
00036 clear_runlines();
00037 add_runline("[opts] input.dxf > output.txt");
00038 add_runline("[opts] -o output.txt input.dxf");
00039 add_runline("[opts] input.dxf output.txt");
00040 }
00041
00042
00043
00044
00045
00046
00047
00048 void DXFPoints::
00049 run() {
00050
00051 process(_input_filename);
00052 }
00053
00054
00055
00056
00057
00058
00059
00060
00061 void DXFPoints::
00062 done_entity() {
00063 if (_entity == EN_point) {
00064 get_output() << _p << "\n";
00065
00066 } else if (_entity == EN_insert) {
00067 ocs_2_wcs();
00068 get_output() << _p << "\n";
00069 }
00070 }
00071
00072
00073
00074
00075
00076
00077 bool DXFPoints::
00078 handle_args(ProgramBase::Args &args) {
00079 if (args.empty()) {
00080 nout << "You must specify the .dxf file to read on the command line.\n";
00081 return false;
00082
00083 } else if (args.size() != 1) {
00084 nout << "You must specify only one .dxf file to read on the command line.\n";
00085 return false;
00086 }
00087
00088 _input_filename = args[0];
00089
00090 return true;
00091 }
00092
00093
00094 int main(int argc, char *argv[]) {
00095
00096 pystub();
00097
00098 DXFPoints prog;
00099 prog.parse_command_line(argc, argv);
00100 prog.run();
00101 return 0;
00102 }