When I F5 this code:
sd = 5; // snoot diameter
th = 3;
inches = 25.4;
ht = 5 * inches;
oid = 3 * inches;
ood = oid + 2 * th;
module torus(id, r)
rotate_extrude(convexity = 10, $fn = 100)
translate([id, 0, 0])
circle(r = 1, $fn = 100);
module snoot(sd) {
translate([ood/2 + sd, 0, 0])
cylinder(h = ht/2, d = sd);
translate([ood, 0, ht/2])
rotate([90, 0, 0])
torus(oid, sd);
}
snoot();
I get this error:
WARNING: undefined operation (number + undefined) in file , line 14
WARNING: Unable to convert translate([undef, 0, 0]) parameter to a vec3
or vec2 of numbers in file , line 14
If anything, "sd" is OVER defined, since I've defined it twice.
Can anyone see what is going wrong?
Thanks!
Jon
Never mind. I failed to supply the required parameter. I wish the
error message was less cryptic.
Sorry for the interruption.
On 2/19/2022 9:26 AM, jon wrote:
When I F5 this code:
sd = 5; // snoot diameter
th = 3;
inches = 25.4;
ht = 5 * inches;
oid = 3 * inches;
ood = oid + 2 * th;
module torus(id, r)
rotate_extrude(convexity = 10, $fn = 100)
translate([id, 0, 0])
circle(r = 1, $fn = 100);
module snoot(sd) {
translate([ood/2 + sd, 0, 0])
cylinder(h = ht/2, d = sd);
translate([ood, 0, ht/2])
rotate([90, 0, 0])
torus(oid, sd);
}
snoot();
I get this error:
WARNING: undefined operation (number + undefined) in file , line 14
WARNING: Unable to convert translate([undef, 0, 0]) parameter to a
vec3 or vec2 of numbers in file , line 14
If anything, "sd" is OVER defined, since I've defined it twice.
Can anyone see what is going wrong?
Thanks!
Jon
OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org
You can’t “overdefine”. The idea doesn’t make sense.
“module snoot(sd)” is likely the issue. You should to set a passing
variable to a default. In this case you are redefining sd, it isn’t the
same variable inside the module as what you defined at the top of the file.
There are a couple of things to do here. You don’t HAVE to, but I’d suggest
using a different variable name for sd inside the snoot module. It can save
you from the confusion you now face.
Next, set it to a default (not sure this is required, but is a good idea).
Make the default way different from a value you ever expect to use. This
helps debug if you forget to pass a value later.
Then, pass sd when you invoke snoot.
Since you redefine sd in the snoot module and don’t give it a default,
snoot() results in sd being undefined.
On Sat, Feb 19, 2022 at 08:27 jon jon@jonbondy.com wrote:
When I F5 this code:
sd = 5; // snoot diameter
th = 3;
inches = 25.4;
ht = 5 * inches;
oid = 3 * inches;
ood = oid + 2 * th;
module torus(id, r)
rotate_extrude(convexity = 10, $fn = 100)
translate([id, 0, 0])
circle(r = 1, $fn = 100);
module snoot(sd) {
translate([ood/2 + sd, 0, 0])
cylinder(h = ht/2, d = sd);
translate([ood, 0, ht/2])
rotate([90, 0, 0])
torus(oid, sd);
}
snoot();
I get this error:
WARNING: undefined operation (number + undefined) in file , line 14
WARNING: Unable to convert translate([undef, 0, 0]) parameter to a vec3 or
vec2 of numbers in file , line 14
If anything, "sd" is OVER defined, since I've defined it twice.
Can anyone see what is going wrong?
Thanks!
Jon
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Changing the declaration to "module snoot(sd = sd) {" does what you want I
think - if a parameter is specified, it uses it, otherwise it defaults to
whatever "sd" is in scope (the global declaration at the top)
On Sat, Feb 19, 2022 at 10:04 AM FF Systems joeh@rollanet.org wrote:
You can’t “overdefine”. The idea doesn’t make sense.
“module snoot(sd)” is likely the issue. You should to set a passing
variable to a default. In this case you are redefining sd, it isn’t the
same variable inside the module as what you defined at the top of the file.
There are a couple of things to do here. You don’t HAVE to, but I’d
suggest using a different variable name for sd inside the snoot module. It
can save you from the confusion you now face.
Next, set it to a default (not sure this is required, but is a good idea).
Make the default way different from a value you ever expect to use. This
helps debug if you forget to pass a value later.
Then, pass sd when you invoke snoot.
Since you redefine sd in the snoot module and don’t give it a default,
snoot() results in sd being undefined.
On Sat, Feb 19, 2022 at 08:27 jon jon@jonbondy.com wrote:
When I F5 this code:
sd = 5; // snoot diameter
th = 3;
inches = 25.4;
ht = 5 * inches;
oid = 3 * inches;
ood = oid + 2 * th;
module torus(id, r)
rotate_extrude(convexity = 10, $fn = 100)
translate([id, 0, 0])
circle(r = 1, $fn = 100);
module snoot(sd) {
translate([ood/2 + sd, 0, 0])
cylinder(h = ht/2, d = sd);
translate([ood, 0, ht/2])
rotate([90, 0, 0])
torus(oid, sd);
}
snoot();
I get this error:
WARNING: undefined operation (number + undefined) in file , line 14
WARNING: Unable to convert translate([undef, 0, 0]) parameter to a vec3
or vec2 of numbers in file , line 14
If anything, "sd" is OVER defined, since I've defined it twice.
Can anyone see what is going wrong?
Thanks!
Jon
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org