Make CSG tree dumps more readable

git-svn-id: http://svn.clifford.at/openscad/trunk@320 b57f626f-c46c-0410-a088-ec61d464b74c
stl_dim
kintel 2010-01-15 18:36:53 +00:00
parent 71bc0ed97e
commit f97f0258a4
5 changed files with 15 additions and 15 deletions

View File

@ -305,17 +305,17 @@ QString DxfLinearExtrudeNode::dump(QString indent) const
memset(&st, 0, sizeof(struct stat));
stat(filename.toAscii().data(), &st);
text.sprintf("linear_extrude(file = \"%s\", cache = \"%x.%x\", layer = \"%s\", "
"height = %f, origin = [ %f %f ], scale = %f, center = %s, convexity = %d",
"height = %g, origin = [ %g %g ], scale = %g, center = %s, convexity = %d",
filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size,
layername.toAscii().data(), height, origin_x, origin_y, scale,
center ? "true" : "false", convexity);
if (has_twist) {
QString t2;
t2.sprintf(", twist = %f, slices = %d", twist, slices);
t2.sprintf(", twist = %g, slices = %d", twist, slices);
text += t2;
}
QString t3;
t3.sprintf(", $fn = %f, $fa = %f, $fs = %f) {\n", fn, fs, fa);
t3.sprintf(", $fn = %g, $fa = %g, $fs = %g) {\n", fn, fs, fa);
text += t3;
foreach (AbstractNode *v, children)
text += v->dump(indent + QString("\t"));

View File

@ -236,8 +236,8 @@ QString DxfRotateExtrudeNode::dump(QString indent) const
memset(&st, 0, sizeof(struct stat));
stat(filename.toAscii().data(), &st);
text.sprintf("rotate_extrude(file = \"%s\", cache = \"%x.%x\", layer = \"%s\", "
"origin = [ %f %f ], scale = %f, convexity = %d, "
"$fn = %f, $fa = %f, $fs = %f) {\n",
"origin = [ %g %g ], scale = %g, convexity = %d, "
"$fn = %g, $fa = %g, $fs = %g) {\n",
filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size,
layername.toAscii().data(), origin_x, origin_y, scale, convexity,
fn, fs, fa);

View File

@ -211,8 +211,8 @@ QString ImportNode::dump(QString indent) const
filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size, convexity);
if (type == TYPE_DXF)
text.sprintf("import_dxf(file = \"%s\", cache = \"%x.%x\", layer = \"%s\", "
"origin = [ %f %f ], scale = %f, convexity = %d, "
"$fn = %f, $fa = %f, $fs = %f);\n",
"origin = [ %g %g ], scale = %g, convexity = %d, "
"$fn = %g, $fa = %g, $fs = %g);\n",
filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size,
layername.toAscii().data(), origin_x, origin_y, scale, convexity,
fn, fs, fa);

View File

@ -509,17 +509,17 @@ QString PrimitiveNode::dump(QString indent) const
if (dump_cache.isEmpty()) {
QString text;
if (type == CUBE)
text.sprintf("cube(size = [%f, %f, %f], center = %s);\n", x, y, z, center ? "true" : "false");
text.sprintf("cube(size = [%g, %g, %g], center = %s);\n", x, y, z, center ? "true" : "false");
if (type == SPHERE)
text.sprintf("sphere($fn = %f, $fa = %f, $fs = %f, r = %f);\n", fn, fa, fs, r1);
text.sprintf("sphere($fn = %g, $fa = %g, $fs = %g, r = %g);\n", fn, fa, fs, r1);
if (type == CYLINDER)
text.sprintf("cylinder($fn = %f, $fa = %f, $fs = %f, h = %f, r1 = %f, r2 = %f, center = %s);\n", fn, fa, fs, h, r1, r2, center ? "true" : "false");
text.sprintf("cylinder($fn = %g, $fa = %g, $fs = %g, h = %g, r1 = %g, r2 = %g, center = %s);\n", fn, fa, fs, h, r1, r2, center ? "true" : "false");
if (type == POLYHEDRON)
text.sprintf("polyhedron(points = %s, triangles = %s, convexity = %d);\n", points.dump().toAscii().data(), triangles.dump().toAscii().data(), convexity);
if (type == SQUARE)
text.sprintf("square(size = [%f, %f], center = %s);\n", x, y, center ? "true" : "false");
text.sprintf("square(size = [%g, %g], center = %s);\n", x, y, center ? "true" : "false");
if (type == CIRCLE)
text.sprintf("circle($fn = %f, $fa = %f, $fs = %f, r = %f);\n", fn, fa, fs, r1);
text.sprintf("circle($fn = %g, $fa = %g, $fs = %g, r = %g);\n", fn, fa, fs, r1);
if (type == POLYGON)
text.sprintf("polygon(points = %s, paths = %s, convexity = %d);\n", points.dump().toAscii().data(), paths.dump().toAscii().data(), convexity);
((AbstractNode*)this)->dump_cache = indent + QString("n%1: ").arg(idx) + text;

View File

@ -340,11 +340,11 @@ QString TransformNode::dump(QString indent) const
if (dump_cache.isEmpty()) {
QString text;
if (m[16] >= 0 || m[17] >= 0 || m[18] >= 0 || m[19] >= 0)
text.sprintf("n%d: color([%f, %f, %f, %f])", idx,
text.sprintf("n%d: color([%g, %g, %g, %g])", idx,
m[16], m[17], m[18], m[19]);
else
text.sprintf("n%d: multmatrix([[%f, %f, %f, %f], [%f, %f, %f, %f], "
"[%f, %f, %f, %f], [%f, %f, %f, %f]])", idx,
text.sprintf("n%d: multmatrix([[%g, %g, %g, %g], [%g, %g, %g, %g], "
"[%g, %g, %g, %g], [%g, %g, %g, %g]])", idx,
m[0], m[4], m[ 8], m[12],
m[1], m[5], m[ 9], m[13],
m[2], m[6], m[10], m[14],