Created
October 28, 2018 02:24
-
-
Save nezuppo/8760852129a1d65c1aa9a87a6129054a to your computer and use it in GitHub Desktop.
OpenSCAD で同じ高さに linear_extrude した 2D を重ね合わせた場合でもプレビューで綺麗に表示できるよう、diff_extrude() モジュールを作りました。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module diff_extrude(thickness, colors) { | |
if (0 < $children) { | |
for (i=[0:$children - 1]) { | |
this_color = i < len(colors) ? | |
colors[i] : "black"; | |
color(this_color) | |
linear_extrude(thickness) | |
difference() { | |
children(i); | |
if (i < $children - 1) | |
children([i + 1:$children - 1]); | |
} | |
} | |
} | |
} | |
module example() { | |
$fn = 100; | |
diff_extrude(3, ["red", "blue", "green"]) { | |
translate([7 * sin(0) , 7 * cos(0) ]) circle(10); | |
translate([7 * sin(120), 7 * cos(120)]) circle(10); | |
translate([7 * sin(240), 7 * cos(240)]) circle(10); | |
} | |
} | |
example(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment