scaddy/debug.scad
Tony Tkacik 34fb5c964c Resync
Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
2019-02-23 20:26:02 +01:00

44 lines
1 KiB
OpenSCAD

module debug(force=false) {
if($scaddy_debug || force ) {
$scaddy_debug=true;
%children();
}
}
module _debug_mesh() {
%color([1,0,0,0.4]) children();
}
module debug_points(vector) {
_debug_mesh()
for(i = [0:1:len(vector)-1])
translate(vector[i]) {
sphere(1);
text(str(i),size=4);
}
}
module xy_axis(length=20,width=0.5) {
_debug_mesh()
move((-width/2)*[1,1,0])
extrude(width) {
square([width,length]);
square([length,width]);
move(x(length)-y(1))
text("x",halign="right",valign="top",size=5);
move(y(length)-x(1))
text("y",valign="top",halign="right",size=5);
}
}
module xyz_axis(length=20,width=0.5) {
xy_axis(length,width);
_debug_mesh()
move((-width/2)*[1,1,0]) rotate(x(90))
extrude(width) {
square([width,length]);
move(y(length)-x(1))
text("z",valign="top",halign="right",size=5);
}
}