16 #include "eggPolygon.h"
29 set_binary_output(
true);
30 set_program_brief(
"convert .egg files to AutoCAD .dxf files");
31 set_program_description
32 (
"This program converts files from egg format to AutoCAD DXF format. "
33 "Since DXF does not support nested hierarchies, vertex normals, or any "
34 "fancy stuff you are probably used to, there is some information lost "
39 "Use POLYLINE to represent polygons instead of the default, 3DFACE.",
40 &EggToDXF::dispatch_none, &_use_polyline);
42 _coordinate_system = CS_zup_right;
43 _got_coordinate_system =
true;
54 if (_layers.empty()) {
55 nout <<
"Egg file contains no polygons. Output file not written.\n";
75 nout <<
"An error occurred while writing.\n";
89 bool has_polys =
false;
93 EggGroupNode::iterator ci;
94 for (ci = group->begin(); ci != group->end(); ++ci) {
96 if (child->
is_of_type(EggPolygon::get_class_type())) {
102 }
else if (child->
is_of_type(EggGroupNode::get_class_type())) {
108 layer.choose_overall_color();
109 _layers.push_back(layer);
123 write_tables(ostream &out) {
124 out <<
"0\nSECTION\n"
128 <<
"70\n" << _layers.size() <<
"\n";
130 EggToDXFLayers::iterator li;
131 for (li = _layers.begin(); li != _layers.end(); ++li) {
132 (*li).write_layer(out);
146 write_entities(ostream &out) {
147 out <<
"0\nSECTION\n"
150 EggToDXFLayers::iterator li;
151 for (li = _layers.begin(); li != _layers.end(); ++li) {
152 (*li).write_entities(out);
155 out <<
"0\nENDSEC\n";
160 int main(
int argc,
char *argv[]) {
LColor get_color() const
Returns the color set on this particular attribute.
virtual void parse_command_line(int argc, char **argv)
Dispatches on each of the options on the command line, and passes the remaining parameters to handle_...
A base class for nodes in the hierarchy that are not leaf nodes.
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated type.
ostream & get_output()
Returns an output stream that corresponds to the user's intended egg file output–either stdout...
This is the general base class for a file-converter program that reads some model file format and gen...
A base class for things that may be directly added into the egg hierarchy.
A program to read an egg file and write a DXF file.
A single layer in the DXF file to be written by EggToDXF.