Added "view" suppport.

This commit is contained in:
Tony Tkáčik 2016-11-16 14:34:52 +01:00
parent ef7ce80785
commit 14743f42fa
2 changed files with 28 additions and 0 deletions

11
scad-views.scad Normal file
View file

@ -0,0 +1,11 @@
module display(view) {
$sc_view=view;
children();
}
module view(view) {
if($sc_view == undef || $sc_view == view) {
children();
}
}

17
scad-views.test.scad Normal file
View file

@ -0,0 +1,17 @@
use <scad-common.scad>;
use <scad-views.scad>;
// View
View=0; // [0:all,1:front,2:side,3:top]
module test() {
view("front") rotate([90,0,0]) color("blue") square(10,10);
view("side") rotate([0,-90,0]) color("red") square(10,10);
view("top") square(10,10);
}
v_arr=[undef,"front","side","top"];
display(v_arr[View]) {
test();
move(x=20) test();
}