diff --git a/common.scad b/common.scad index db4f3bb..570ff8e 100644 --- a/common.scad +++ b/common.scad @@ -353,6 +353,7 @@ function segs(r) = // Arguments: // $children = number of children the module has. module no_children(count) { + assert($children==0, "Module no_children() does not support child modules"); assert(count==0, str("Module ",parent_module(1),"() does not support child modules")); } @@ -377,6 +378,7 @@ function _valstr(x) = // expected = The value that was expected. // info = Extra info to print out to make the error clearer. module assert_approx(got, expected, info) { + no_children($children); if (!approx(got, expected)) { echo(); echo(str("EXPECT: ", _valstr(expected))); @@ -404,6 +406,7 @@ module assert_approx(got, expected, info) { // expected = The value that was expected. // info = Extra info to print out to make the error clearer. module assert_equal(got, expected, info) { + no_children($children); if (got != expected || (is_nan(got) && is_nan(expected))) { echo(); echo(str("EXPECT: ", _valstr(expected))); diff --git a/strings.scad b/strings.scad index cc0713b..5e34fd9 100644 --- a/strings.scad +++ b/strings.scad @@ -701,7 +701,9 @@ function str_format(fmt, vals, use_nbsp=false) = // echofmt("{:-10s}{:.3f}", ["plecostamus",27.43982]); // ECHO: "plecostamus27.440" // echofmt("{:-10.9s}{:.3f}", ["plecostamus",27.43982]); // ECHO: "plecostam 27.440" function echofmt(fmt, vals, use_nbsp=false) = echo(str_format(fmt,vals,use_nbsp)); -module echofmt(fmt, vals, use_nbsp=false) echo(str_format(fmt,vals,use_nbsp)); - +module echofmt(fmt, vals, use_nbsp=false) { + no_children($children); + echo(str_format(fmt,vals,use_nbsp)); +} // vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap diff --git a/structs.scad b/structs.scad index e7effb4..1e9f321 100644 --- a/structs.scad +++ b/structs.scad @@ -101,6 +101,7 @@ function struct_echo(struct,name="") = undef; module struct_echo(struct,name="") { + no_children($children); dummy = struct_echo(struct,name); } diff --git a/version.scad b/version.scad index d10b338..b37d43f 100644 --- a/version.scad +++ b/version.scad @@ -49,6 +49,7 @@ function bosl_version_str() = version_to_str(BOSL_VERSION); // Description: // Given a version as a list, number, or string, asserts that the currently installed BOSL library is at least the given version. module bosl_required(target) { + no_children($children); assert( version_cmp(bosl_version(), target) >= 0, str( diff --git a/vnf.scad b/vnf.scad index 05fd82f..edf00e4 100644 --- a/vnf.scad +++ b/vnf.scad @@ -341,9 +341,16 @@ function vnf_vertex_array( // Arguments: // vnf = A VNF structure, or list of VNF structures. // convexity = Max number of times a line could intersect a wall of the shape. -module vnf_polyhedron(vnf, convexity=2) { +module vnf_polyhedron(vnf, + convexity=10,anchor="origin",cp, + spin=0, orient=UP, extent=false +) +{ vnf = is_vnf_list(vnf)? vnf_merge(vnf) : vnf; - polyhedron(vnf[0], vnf[1], convexity=convexity); + attachable(anchor=anchor, spin=spin, orient=orient, vnf=vnf, extent=extent, cp=is_def(cp) ? cp : vnf_centroid(vnf)){ + polyhedron(vnf[0], vnf[1], convexity=convexity); + children(); + } }