mirror of https://github.com/vitalif/openscad
Make CSG tree dumps more readable
git-svn-id: http://svn.clifford.at/openscad/trunk@320 b57f626f-c46c-0410-a088-ec61d464b74cstl_dim
parent
71bc0ed97e
commit
f97f0258a4
|
@ -305,17 +305,17 @@ QString DxfLinearExtrudeNode::dump(QString indent) const
|
||||||
memset(&st, 0, sizeof(struct stat));
|
memset(&st, 0, sizeof(struct stat));
|
||||||
stat(filename.toAscii().data(), &st);
|
stat(filename.toAscii().data(), &st);
|
||||||
text.sprintf("linear_extrude(file = \"%s\", cache = \"%x.%x\", layer = \"%s\", "
|
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,
|
filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size,
|
||||||
layername.toAscii().data(), height, origin_x, origin_y, scale,
|
layername.toAscii().data(), height, origin_x, origin_y, scale,
|
||||||
center ? "true" : "false", convexity);
|
center ? "true" : "false", convexity);
|
||||||
if (has_twist) {
|
if (has_twist) {
|
||||||
QString t2;
|
QString t2;
|
||||||
t2.sprintf(", twist = %f, slices = %d", twist, slices);
|
t2.sprintf(", twist = %g, slices = %d", twist, slices);
|
||||||
text += t2;
|
text += t2;
|
||||||
}
|
}
|
||||||
QString t3;
|
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;
|
text += t3;
|
||||||
foreach (AbstractNode *v, children)
|
foreach (AbstractNode *v, children)
|
||||||
text += v->dump(indent + QString("\t"));
|
text += v->dump(indent + QString("\t"));
|
||||||
|
|
|
@ -236,8 +236,8 @@ QString DxfRotateExtrudeNode::dump(QString indent) const
|
||||||
memset(&st, 0, sizeof(struct stat));
|
memset(&st, 0, sizeof(struct stat));
|
||||||
stat(filename.toAscii().data(), &st);
|
stat(filename.toAscii().data(), &st);
|
||||||
text.sprintf("rotate_extrude(file = \"%s\", cache = \"%x.%x\", layer = \"%s\", "
|
text.sprintf("rotate_extrude(file = \"%s\", cache = \"%x.%x\", layer = \"%s\", "
|
||||||
"origin = [ %f %f ], scale = %f, convexity = %d, "
|
"origin = [ %g %g ], scale = %g, convexity = %d, "
|
||||||
"$fn = %f, $fa = %f, $fs = %f) {\n",
|
"$fn = %g, $fa = %g, $fs = %g) {\n",
|
||||||
filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size,
|
filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size,
|
||||||
layername.toAscii().data(), origin_x, origin_y, scale, convexity,
|
layername.toAscii().data(), origin_x, origin_y, scale, convexity,
|
||||||
fn, fs, fa);
|
fn, fs, fa);
|
||||||
|
|
|
@ -211,8 +211,8 @@ QString ImportNode::dump(QString indent) const
|
||||||
filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size, convexity);
|
filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size, convexity);
|
||||||
if (type == TYPE_DXF)
|
if (type == TYPE_DXF)
|
||||||
text.sprintf("import_dxf(file = \"%s\", cache = \"%x.%x\", layer = \"%s\", "
|
text.sprintf("import_dxf(file = \"%s\", cache = \"%x.%x\", layer = \"%s\", "
|
||||||
"origin = [ %f %f ], scale = %f, convexity = %d, "
|
"origin = [ %g %g ], scale = %g, convexity = %d, "
|
||||||
"$fn = %f, $fa = %f, $fs = %f);\n",
|
"$fn = %g, $fa = %g, $fs = %g);\n",
|
||||||
filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size,
|
filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size,
|
||||||
layername.toAscii().data(), origin_x, origin_y, scale, convexity,
|
layername.toAscii().data(), origin_x, origin_y, scale, convexity,
|
||||||
fn, fs, fa);
|
fn, fs, fa);
|
||||||
|
|
|
@ -509,17 +509,17 @@ QString PrimitiveNode::dump(QString indent) const
|
||||||
if (dump_cache.isEmpty()) {
|
if (dump_cache.isEmpty()) {
|
||||||
QString text;
|
QString text;
|
||||||
if (type == CUBE)
|
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)
|
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)
|
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)
|
if (type == POLYHEDRON)
|
||||||
text.sprintf("polyhedron(points = %s, triangles = %s, convexity = %d);\n", points.dump().toAscii().data(), triangles.dump().toAscii().data(), convexity);
|
text.sprintf("polyhedron(points = %s, triangles = %s, convexity = %d);\n", points.dump().toAscii().data(), triangles.dump().toAscii().data(), convexity);
|
||||||
if (type == SQUARE)
|
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)
|
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)
|
if (type == POLYGON)
|
||||||
text.sprintf("polygon(points = %s, paths = %s, convexity = %d);\n", points.dump().toAscii().data(), paths.dump().toAscii().data(), convexity);
|
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;
|
((AbstractNode*)this)->dump_cache = indent + QString("n%1: ").arg(idx) + text;
|
||||||
|
|
|
@ -340,11 +340,11 @@ QString TransformNode::dump(QString indent) const
|
||||||
if (dump_cache.isEmpty()) {
|
if (dump_cache.isEmpty()) {
|
||||||
QString text;
|
QString text;
|
||||||
if (m[16] >= 0 || m[17] >= 0 || m[18] >= 0 || m[19] >= 0)
|
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]);
|
m[16], m[17], m[18], m[19]);
|
||||||
else
|
else
|
||||||
text.sprintf("n%d: multmatrix([[%f, %f, %f, %f], [%f, %f, %f, %f], "
|
text.sprintf("n%d: multmatrix([[%g, %g, %g, %g], [%g, %g, %g, %g], "
|
||||||
"[%f, %f, %f, %f], [%f, %f, %f, %f]])", idx,
|
"[%g, %g, %g, %g], [%g, %g, %g, %g]])", idx,
|
||||||
m[0], m[4], m[ 8], m[12],
|
m[0], m[4], m[ 8], m[12],
|
||||||
m[1], m[5], m[ 9], m[13],
|
m[1], m[5], m[ 9], m[13],
|
||||||
m[2], m[6], m[10], m[14],
|
m[2], m[6], m[10], m[14],
|
||||||
|
|
Loading…
Reference in New Issue