/* Sample piece for wooden texture options - uses overhang options and Minkowski*/ /* v2 2022-09-28 translation to English to ease support of OpenSCAD Mailinglist*/ l=100; w=2; h=80; eh=0.5; pseudo_3d=0.001; base_layer_height=0.15; warp_protect_distance=4; module cone($fn=20){ cylinder(r1=1,r2=0,h=1); } module wooden_texture_2d(){ intersection(){ translate([l,0,0]) scale([1/10,1/10]) import("holztextur.svg",center=true); square([l,h]); } } module antiwarp(){ wpd=warp_protect_distance; linear_extrude(base_layer_height) translate([-wpd,-w/2-wpd]) square([l+2*wpd,w+2*wpd]); } module base(){ translate([l/2,0,0]) union(){ /*antiwarp circle*/ linear_extrude(base_layer_height) circle(r=h/10); /*triangle base*/ rotate([0,0,90]) rotate([90,0,0]) translate([0,0,-w/2]) linear_extrude(w) polygon(points=[ [-h/10,0], [+h/10,0], [0,h/10] ]); } } module split_thick_texture_lines_into_two_thin_lines(){ difference(){ wooden_texture_2d(); offset(r=-1) wooden_texture_2d(); } } module select_only_thick_texture_lines(){ offset(r=1) offset(delta=-0.99) wooden_texture_2d(); } module normalize_thick_texture_lines(){ difference(){ wooden_texture_2d(); /*nur dicke striche*/ select_only_thick_texture_lines(); } offset(r=-1) select_only_thick_texture_lines(); } module sample_piece(){ //render() union(){ cube([l,w,h]); translate([0,w+eh,0]) rotate([90,0,0]) linear_extrude(eh) wooden_texture_2d(); rotate([90,0,0]) intersection() { linear_extrude(1) square([l,h]); minkowski(){ linear_extrude(pseudo_3d) wooden_texture_2d(); cone(); } } } } sample_piece(); base(); antiwarp(); module square_intersect(){ intersection(){ children(); square([l,h]); } } module cube_intersect(){ intersection(){ children(); cube([l,h,w]); /*brute force hier*/ } } module conekowski_2d(){ minkowski(){ linear_extrude(pseudo_3d) children(0); cone(); } } translate([-l,0]) cube_intersect() conekowski_2d() square_intersect() offset(r=-0.3) offset(delta=0.3) normalize_thick_texture_lines(); /*artefaktbehaftet mit Ausschneideloechern und Spitzen Ecken*/ translate([0,0]) cube_intersect() conekowski_2d() square_intersect() normalize_thick_texture_lines(); /*duenn und artefaktbehaftet*/ translate([l,0]) cube_intersect() conekowski_2d() square_intersect() wooden_texture_2d(); translate([l*2,0]) cube_intersect() conekowski_2d() square_intersect() split_thick_texture_lines_into_two_thin_lines();