Hi Daver,
daver18qc wrote
Hi everyone !
I am quite a beginner at OpenSCAD but have some knowledge of programming.
I already created many things that i printed with my 3d printer using
OpenSCAD.
I am trying to create a hollow square tube on an angle.
So what i tried is this :
--------------CODE------------------
$fn = 100;
module hollow_square(){
rotate([0,90,0])
difference(){
cube([12,12,2], center=true);
cube([10,10,4], center=true);
}
}
hull(){
hollow_square();
translate([100,0,20]) hollow_square();
}
-----------END-CODE---------------
Problem is, the HULL closes the ends of my hollow cubes and thus gives me
a solid angled rectangle instead...
Is there a way to tell HULL to respect the hole i created in the cubes ??
Thanks!
Is there a way to tell HULL to respect the hole
Well that is hull()'s reason for living, so unwind the difference;
$fn = 100;
size=12;
thick=1;
module square(size,diff=false)
rotate([0,90,0])
cube([size,size,(diff) ? 0.2 : 0.01], center=true);
module square_bar(start,end,size,diff=false) {
hull() {
translate(start)
square(size,diff);
translate(end)
square(size,diff);
}
}
module square_tube(start,end,size,thick) {
difference() {
square_bar(start,end,size);
square_bar(start,end,size-2*thick,diff=true);
}
}
square_tube([0,0,0],[100,0,20],size,thick);
All the 'diff's are to cleanup the z-fighting
https://en.wikipedia.org/wiki/Z-fighting on the ends.
Admin - PM me if you need anything, or if I've done something stupid...
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Angled-Hollow-Square-Tube-tp20323p20325.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Oh thanks !
Not sure i understand all of that code yet but i'm gonna study it !
--
View this message in context: http://forum.openscad.org/Angled-Hollow-Square-Tube-tp20323p20326.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Note that I did it that way presuming you wanted the 'vertical' cuts on the
ends.
Admin - PM me if you need anything, or if I've done something stupid...
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Angled-Hollow-Square-Tube-tp20323p20329.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
For plain old square tube, this is more standard;
module square_tube2(size,thick,long) {
cut_size=size-2*thick;
translate([0,0,long/2]) // move to z=0
difference() {
cube([size,size,long],center=true);
cube([cut_size,cut_size,long+0.5],center=true);
}
}
square_tube2(size,thick,100);
Admin - PM me if you need anything, or if I've done something stupid...
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Angled-Hollow-Square-Tube-tp20323p20330.html
Sent from the OpenSCAD mailing list archive at Nabble.com.