diff options
| author | Marius Kintel <marius@kintel.net> | 2013-05-24 14:16:20 (GMT) | 
|---|---|---|
| committer | Marius Kintel <marius@kintel.net> | 2013-05-24 14:16:20 (GMT) | 
| commit | 26046f6f0c4a774cbbb2af8ae7dc0e687963440c (patch) | |
| tree | 38ff04fc460e8aa55134fb1ee6167fafb90a3423 /testdata/scad | |
| parent | eefcd6d0b271642d470cd55bc47d1579d943938e (diff) | |
| parent | 95e399e06c6522f3fa67679808a1d52815368efa (diff) | |
Merge branch 'master' into epec-kernel
Diffstat (limited to 'testdata/scad')
21 files changed, 2221 insertions, 3 deletions
| diff --git a/testdata/scad/features/child-child-test.scad b/testdata/scad/features/child-child-test.scad new file mode 100644 index 0000000..e5e6d93 --- /dev/null +++ b/testdata/scad/features/child-child-test.scad @@ -0,0 +1,12 @@ +module up() { +  translate([0,0,1]) child(0); +} + +module red() { +  color("Red") child(0); +} + +up() cylinder(r=5); +translate([5,0,0]) up() up() cylinder(r=5); +translate([10,0,0]) up() up() up() red() cylinder(r=5); +translate([15,0,0]) red() up() up() up() up() cylinder(r=5); diff --git a/testdata/scad/features/child-tests.scad b/testdata/scad/features/child-tests.scad index e4e3572..cf983b4 100644 --- a/testdata/scad/features/child-tests.scad +++ b/testdata/scad/features/child-tests.scad @@ -1,7 +1,7 @@  $fn=16; -module parent() { -  for (i=[0:2]) { +module parent(range=[0:2]) { +  for (i=range) {      translate([2.5*i,0,0]) child(i);    }  } @@ -32,3 +32,6 @@ module parent3() {  }  translate([5,3,0]) parent3() { cube(); sphere(); } + +// Leaking variables to child list is not allowed +translate([0,6,0]) parent(range=[0:1], testvar=10) { sphere(); cube(testvar, center=true);} diff --git a/testdata/scad/features/hull2-tests.scad b/testdata/scad/features/hull2-tests.scad index e656e6a..82b56e4 100644 --- a/testdata/scad/features/hull2-tests.scad +++ b/testdata/scad/features/hull2-tests.scad @@ -31,7 +31,15 @@ module hull2dForLoop() {    }  } +module hull2null() { +  hull() { +    square(0); +    circle(0); +  } +} +  convex2dHole();  translate([40,0,0]) convex2dSimple();  translate([0,-20,0]) concave2dSimple();  translate([30,-25,0]) hull2dForLoop(); +hull2null();
\ No newline at end of file diff --git a/testdata/scad/features/hull3-tests.scad b/testdata/scad/features/hull3-tests.scad index e3fc8e7..0f48b8f 100644 --- a/testdata/scad/features/hull3-tests.scad +++ b/testdata/scad/features/hull3-tests.scad @@ -26,3 +26,12 @@ translate([-5,-5,-5]) {      }    }  } + +module hull3null() { +  hull() { +    cube(0); +    sphere(0); +  } +} +hull3null(); + diff --git a/testdata/scad/features/linear_extrude-scale-zero-tests.scad b/testdata/scad/features/linear_extrude-scale-zero-tests.scad new file mode 100644 index 0000000..8a85203 --- /dev/null +++ b/testdata/scad/features/linear_extrude-scale-zero-tests.scad @@ -0,0 +1,56 @@ +// test cases for linear extrude with scale +// by TakeItAndRun 2013 + +// syntax: linear_extrude(height=a, slices=b, twist=c, scale=[x,y]) + +a=3; +b=20; +c=0; +x=1; +y=1; + +module linear_extrudes_of_different_shapes(a=a,b=b,c=c,x=x,y=y) { +  translate(00*[4,0,0]) +  // linear_extrude of shape with hole +  linear_extrude(height=a, slices=b, twist=c, scale=[x,y]) +    difference() { +      square(2,true); square(1,true); +    } +   +  translate(01*[4,0,0]) +  // linear_extrude of disjoint polygons shapes +  linear_extrude(height=a, slices=b, twist=c, scale=[x,y]) { +    translate([1,0,0]) square(1,true); +    translate([-1,0,0]) square(1,true); +  } +   +  translate(02*[4,0,0]) +  // linear_extrude with a coplanar face +  linear_extrude(height=a, slices=b, twist=c, scale=[x,y]) { +    translate([.5,0,0])square(); +    translate([-.5,0,0])square(); +  } +   +  translate(03*[4,0,0]) +  // linear_extrude with internal hole and one coplanar edge +  linear_extrude(height=a, slices=b, twist=c, scale=[x,y]) +  difference() { +    square(2,true); +    translate([-0.5,0,0]) square(1,true); +  } +} + + +// Test varying parameters +translate(00*[0,3,0]) +linear_extrudes_of_different_shapes(c=0,x=0,y=y); +translate(01*[0,3,0]) +linear_extrudes_of_different_shapes(c=0,x=x,y=0); +translate(02*[0,3,0]) +linear_extrudes_of_different_shapes(c=0,x=0,y=0); +translate(03*[0,3,0]) +linear_extrudes_of_different_shapes(c=180,x=0,y=y); +translate(04*[0,3,0]) +linear_extrudes_of_different_shapes(c=180,x=x,y=0); +translate(05*[0,3,0]) +linear_extrudes_of_different_shapes(c=180,x=0,y=0); diff --git a/testdata/scad/features/linear_extrude-tests.scad b/testdata/scad/features/linear_extrude-tests.scad index 67de8e6..528eea2 100644 --- a/testdata/scad/features/linear_extrude-tests.scad +++ b/testdata/scad/features/linear_extrude-tests.scad @@ -11,3 +11,14 @@ translate([31.5,2.5,0]) linear_extrude(height=10, twist=-45) polygon(points = [[  translate([0,20,0]) linear_extrude(height=20, twist=45, slices=2) square([10,10]);  translate([19,20,0]) linear_extrude(height=20, twist=45, slices=10) square([10,10]); + +translate([0,-15,0]) linear_extrude(5) square([10,10]); + +// scale given as a scalar +translate([-25,-10,0]) linear_extrude(height=10, scale=2) square(5, center=true); +// scale given as a 3-dim vector +translate([-15,20,0]) linear_extrude(height=20, scale=[4,5,6]) square(10); +// scale is negative +translate([-10,5,0]) linear_extrude(height=15, scale=-2) square(10, center=true); +// scale given as undefined +translate([-15,-15,0]) linear_extrude(height=10, scale=var_undef) square(10); diff --git a/testdata/scad/features/module-recursion.scad b/testdata/scad/features/module-recursion.scad new file mode 100644 index 0000000..f67a1d0 --- /dev/null +++ b/testdata/scad/features/module-recursion.scad @@ -0,0 +1,15 @@ +module tree(currentScale, levels) +{ +  h = currentScale; +  w = currentScale/5; +  childScale = currentScale * 0.7; +   +  if (levels > 0) { +    cylinder(r=w, h=h); +    translate([0,0,h]) for (i = [1:2]) { +      rotate([40, 0, i * 180]) tree(childScale, levels-1); +    } +  } +} + +tree(1, 4); diff --git a/testdata/scad/features/modulevariables.scad b/testdata/scad/features/modulevariables.scad new file mode 100644 index 0000000..fc7a183 --- /dev/null +++ b/testdata/scad/features/modulevariables.scad @@ -0,0 +1,7 @@ +module mymodule(modparam) { +  inner_variable = 23; +  inner_variable2 = modparam * 2; +  cylinder(r1=inner_variable, r2=inner_variable2, h=10); +} + +mymodule(5); diff --git a/testdata/scad/features/surface-simple.dat b/testdata/scad/features/surface-simple.dat index 32eba08..166c600 100644 --- a/testdata/scad/features/surface-simple.dat +++ b/testdata/scad/features/surface-simple.dat @@ -1,2 +1,6 @@  0 1  2 3 + +# Comment + + diff --git a/testdata/scad/features/surface-simple.scad b/testdata/scad/features/surface-simple.scad index 9659143..1215a0b 100644 --- a/testdata/scad/features/surface-simple.scad +++ b/testdata/scad/features/surface-simple.scad @@ -1 +1,3 @@  surface("surface-simple.dat", center=true); +// Surface without a trailing newline +translate([2,0,0]) surface("surface-simple2.dat", center=true); diff --git a/testdata/scad/features/surface-simple2.dat b/testdata/scad/features/surface-simple2.dat new file mode 100644 index 0000000..a711970 --- /dev/null +++ b/testdata/scad/features/surface-simple2.dat @@ -0,0 +1,3 @@ +# Surface without a trailing newline +0 1 +2 3
\ No newline at end of file diff --git a/testdata/scad/misc/localfiles-test.scad b/testdata/scad/misc/localfiles-test.scad new file mode 100644 index 0000000..31efe96 --- /dev/null +++ b/testdata/scad/misc/localfiles-test.scad @@ -0,0 +1,3 @@ +use <localfiles_dir/localfiles_module.scad> + +localfiles_module(); diff --git a/testdata/scad/misc/localfiles_dir/localfile.dat b/testdata/scad/misc/localfiles_dir/localfile.dat new file mode 100644 index 0000000..32eba08 --- /dev/null +++ b/testdata/scad/misc/localfiles_dir/localfile.dat @@ -0,0 +1,2 @@ +0 1 +2 3 diff --git a/testdata/scad/misc/localfiles_dir/localfile.dxf b/testdata/scad/misc/localfiles_dir/localfile.dxf new file mode 100644 index 0000000..933e263 --- /dev/null +++ b/testdata/scad/misc/localfiles_dir/localfile.dxf @@ -0,0 +1,1968 @@ +999 +dxflib 2.2.0.0 +  0 +SECTION +  2 +HEADER +  9 +$ACADVER +  1 +AC1015 +  9 +$HANDSEED +  5 +FFFF +  9 +$DIMASZ + 40 +2.5 +  9 +$PLIMMIN + 10 +0.0 + 20 +0.0 +  9 +$DIMEXE + 40 +1.25 +  9 +$DIMGAP + 40 +0.625 +  9 +$PLIMMAX + 10 +210.0 + 20 +297.0 +  9 +$INSUNITS + 70 +4 +  9 +$DIMSTYLE +  2 +Standard +  9 +$CLAYER +  8 +0 +  9 +$DIMEXO + 40 +0.625 +  9 +$DIMTXT + 40 +2.5 +  9 +$CLAYER +  8 +0 +  0 +ENDSEC +  0 +SECTION +  2 +TABLES +  0 +TABLE +  2 +VPORT +  5 +8 +100 +AcDbSymbolTable + 70 +1 +  0 +VPORT +  5 +30 +100 +AcDbSymbolTableRecord +100 +AcDbViewportTableRecord +  2 +*Active + 70 +0 + 10 +0.0 + 20 +0.0 + 11 +1.0 + 21 +1.0 + 12 +286.3055555555554861 + 22 +148.5 + 13 +0.0 + 23 +0.0 + 14 +10.0 + 24 +10.0 + 15 +10.0 + 25 +10.0 + 16 +0.0 + 26 +0.0 + 36 +1.0 + 17 +0.0 + 27 +0.0 + 37 +0.0 + 40 +297.0 + 41 +1.92798353909465 + 42 +50.0 + 43 +0.0 + 44 +0.0 + 50 +0.0 + 51 +0.0 + 71 +0 + 72 +100 + 73 +1 + 74 +3 + 75 +1 + 76 +1 + 77 +0 + 78 +0 +281 +0 + 65 +1 +110 +0.0 +120 +0.0 +130 +0.0 +111 +1.0 +121 +0.0 +131 +0.0 +112 +0.0 +122 +1.0 +132 +0.0 + 79 +0 +146 +0.0 +  0 +ENDTAB +  0 +TABLE +  2 +LTYPE +  5 +5 +100 +AcDbSymbolTable + 70 +21 +  0 +LTYPE +  5 +14 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +ByBlock + 70 +0 +  3 + + 72 +65 + 73 +0 + 40 +0.0 +  0 +LTYPE +  5 +15 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +ByLayer + 70 +0 +  3 + + 72 +65 + 73 +0 + 40 +0.0 +  0 +LTYPE +  5 +16 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +CONTINUOUS + 70 +0 +  3 +Solid line + 72 +65 + 73 +0 + 40 +0.0 +  0 +LTYPE +  5 +31 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +DOT + 70 +0 +  3 +Dot . . . . . . . . . . . . . . . . . . . . . . + 72 +65 + 73 +2 + 40 +6.3499999999999996 + 49 +0.0 + 74 +0 + 49 +-6.3499999999999996 + 74 +0 +  0 +LTYPE +  5 +32 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +DOT2 + 70 +0 +  3 +Dot (.5x) ..................................... + 72 +65 + 73 +2 + 40 +3.1749999999999998 + 49 +0.0 + 74 +0 + 49 +-3.1749999999999998 + 74 +0 +  0 +LTYPE +  5 +33 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +DOTX2 + 70 +0 +  3 +Dot (2x) .  .  .  .  .  .  .  .  .  .  .  .  . + 72 +65 + 73 +2 + 40 +12.6999999999999993 + 49 +0.0 + 74 +0 + 49 +-12.6999999999999993 + 74 +0 +  0 +LTYPE +  5 +34 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +DASHED + 70 +0 +  3 +Dashed __ __ __ __ __ __ __ __ __ __ __ __ __ _ + 72 +65 + 73 +2 + 40 +19.0500000000000007 + 49 +12.6999999999999993 + 74 +0 + 49 +-6.3499999999999996 + 74 +0 +  0 +LTYPE +  5 +35 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +DASHED2 + 70 +0 +  3 +Dashed (.5x) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + 72 +65 + 73 +2 + 40 +9.5250000000000004 + 49 +6.3499999999999996 + 74 +0 + 49 +-3.1749999999999998 + 74 +0 +  0 +LTYPE +  5 +36 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +DASHEDX2 + 70 +0 +  3 +Dashed (2x) ____  ____  ____  ____  ____  ___ + 72 +65 + 73 +2 + 40 +38.1000000000000014 + 49 +25.3999999999999986 + 74 +0 + 49 +-12.6999999999999993 + 74 +0 +  0 +LTYPE +  5 +37 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +DASHDOT + 70 +0 +  3 +Dash dot __ . __ . __ . __ . __ . __ . __ . __ + 72 +65 + 73 +4 + 40 +25.3999999999999986 + 49 +12.6999999999999993 + 74 +0 + 49 +-6.3499999999999996 + 74 +0 + 49 +0.0 + 74 +0 + 49 +-6.3499999999999996 + 74 +0 +  0 +LTYPE +  5 +38 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +DASHDOT2 + 70 +0 +  3 +Dash dot (.5x) _._._._._._._._._._._._._._._. + 72 +65 + 73 +4 + 40 +12.6999999999999993 + 49 +6.3499999999999996 + 74 +0 + 49 +-3.1749999999999998 + 74 +0 + 49 +0.0 + 74 +0 + 49 +-3.1749999999999998 + 74 +0 +  0 +LTYPE +  5 +39 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +DASHDOTX2 + 70 +0 +  3 +Dash dot (2x) ____  .  ____  .  ____  .  ___ + 72 +65 + 73 +4 + 40 +50.7999999999999972 + 49 +25.3999999999999986 + 74 +0 + 49 +-12.6999999999999993 + 74 +0 + 49 +0.0 + 74 +0 + 49 +-12.6999999999999993 + 74 +0 +  0 +LTYPE +  5 +3A +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +DIVIDE + 70 +0 +  3 +Divide ____ . . ____ . . ____ . . ____ . . ____ + 72 +65 + 73 +6 + 40 +31.75 + 49 +12.6999999999999993 + 74 +0 + 49 +-6.3499999999999996 + 74 +0 + 49 +0.0 + 74 +0 + 49 +-6.3499999999999996 + 74 +0 + 49 +0.0 + 74 +0 + 49 +-6.3499999999999996 + 74 +0 +  0 +LTYPE +  5 +3B +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +DIVIDE2 + 70 +0 +  3 +Divide (.5x) __..__..__..__..__..__..__..__.._ + 72 +65 + 73 +6 + 40 +15.875 + 49 +6.3499999999999996 + 74 +0 + 49 +-3.1749999999999998 + 74 +0 + 49 +0.0 + 74 +0 + 49 +-3.1749999999999998 + 74 +0 + 49 +0.0 + 74 +0 + 49 +-3.1749999999999998 + 74 +0 +  0 +LTYPE +  5 +3C +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +DIVIDEX2 + 70 +0 +  3 +Divide (2x) ________  .  .  ________  .  .  _ + 72 +65 + 73 +6 + 40 +63.5 + 49 +25.3999999999999986 + 74 +0 + 49 +-12.6999999999999993 + 74 +0 + 49 +0.0 + 74 +0 + 49 +-12.6999999999999993 + 74 +0 + 49 +0.0 + 74 +0 + 49 +-12.6999999999999993 + 74 +0 +  0 +LTYPE +  5 +3D +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +CENTER + 70 +0 +  3 +Center ____ _ ____ _ ____ _ ____ _ ____ _ ____ + 72 +65 + 73 +4 + 40 +50.7999999999999972 + 49 +31.75 + 74 +0 + 49 +-6.3499999999999996 + 74 +0 + 49 +6.3499999999999996 + 74 +0 + 49 +-6.3499999999999996 + 74 +0 +  0 +LTYPE +  5 +3E +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +CENTER2 + 70 +0 +  3 +Center (.5x) ___ _ ___ _ ___ _ ___ _ ___ _ ___ + 72 +65 + 73 +4 + 40 +28.5749999999999993 + 49 +19.0500000000000007 + 74 +0 + 49 +-3.1749999999999998 + 74 +0 + 49 +3.1749999999999998 + 74 +0 + 49 +-3.1749999999999998 + 74 +0 +  0 +LTYPE +  5 +3F +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +CENTERX2 + 70 +0 +  3 +Center (2x) ________  __  ________  __  _____ + 72 +65 + 73 +4 + 40 +101.5999999999999943 + 49 +63.5 + 74 +0 + 49 +-12.6999999999999993 + 74 +0 + 49 +12.6999999999999993 + 74 +0 + 49 +-12.6999999999999993 + 74 +0 +  0 +LTYPE +  5 +40 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +BORDER + 70 +0 +  3 +Border __ __ . __ __ . __ __ . __ __ . __ __ . + 72 +65 + 73 +6 + 40 +44.4500000000000028 + 49 +12.6999999999999993 + 74 +0 + 49 +-6.3499999999999996 + 74 +0 + 49 +12.6999999999999993 + 74 +0 + 49 +-6.3499999999999996 + 74 +0 + 49 +0.0 + 74 +0 + 49 +-6.3499999999999996 + 74 +0 +  0 +LTYPE +  5 +41 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +BORDER2 + 70 +0 +  3 +Border (.5x) __.__.__.__.__.__.__.__.__.__.__. + 72 +65 + 73 +6 + 40 +22.2250000000000014 + 49 +6.3499999999999996 + 74 +0 + 49 +-3.1749999999999998 + 74 +0 + 49 +6.3499999999999996 + 74 +0 + 49 +-3.1749999999999998 + 74 +0 + 49 +0.0 + 74 +0 + 49 +-3.1749999999999998 + 74 +0 +  0 +LTYPE +  5 +42 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +  2 +BORDERX2 + 70 +0 +  3 +Border (2x) ____  ____  .  ____  ____  .  ___ + 72 +65 + 73 +6 + 40 +88.9000000000000057 + 49 +25.3999999999999986 + 74 +0 + 49 +-12.6999999999999993 + 74 +0 + 49 +25.3999999999999986 + 74 +0 + 49 +-12.6999999999999993 + 74 +0 + 49 +0.0 + 74 +0 + 49 +-12.6999999999999993 + 74 +0 +  0 +ENDTAB +  0 +TABLE +  2 +LAYER +  5 +2 +100 +AcDbSymbolTable + 70 +1 +  0 +LAYER +  5 +10 +100 +AcDbSymbolTableRecord +100 +AcDbLayerTableRecord +  2 +0 + 70 +0 + 62 +7 +420 +0 +  6 +CONTINUOUS +370 +25 +390 +F +  0 +ENDTAB +  0 +TABLE +  2 +STYLE +  5 +3 +100 +AcDbSymbolTable + 70 +1 +  0 +STYLE +  5 +11 +100 +AcDbSymbolTableRecord +100 +AcDbTextStyleTableRecord +  2 +Standard + 70 +0 + 40 +0.0 + 41 +0.75 + 50 +0.0 + 71 +0 + 42 +2.5 +  3 +txt +  4 + +  0 +ENDTAB +  0 +TABLE +  2 +VIEW +  5 +6 +100 +AcDbSymbolTable + 70 +0 +  0 +ENDTAB +  0 +TABLE +  2 +UCS +  5 +7 +100 +AcDbSymbolTable + 70 +0 +  0 +ENDTAB +  0 +TABLE +  2 +APPID +  5 +9 +100 +AcDbSymbolTable + 70 +1 +  0 +APPID +  5 +12 +100 +AcDbSymbolTableRecord +100 +AcDbRegAppTableRecord +  2 +ACAD + 70 +0 +  0 +ENDTAB +  0 +TABLE +  2 +DIMSTYLE +  5 +A +100 +AcDbSymbolTable + 70 +1 +100 +AcDbDimStyleTable + 71 +0 +  0 +DIMSTYLE +105 +27 +100 +AcDbSymbolTableRecord +100 +AcDbDimStyleTableRecord +  2 +Standard + 41 +2.5 + 42 +0.625 + 43 +3.75 + 44 +1.25 + 70 +0 + 73 +0 + 74 +0 + 77 +1 + 78 +8 +140 +2.5 +141 +2.5 +143 +0.03937007874016 +147 +0.625 +171 +3 +172 +1 +271 +2 +272 +2 +274 +3 +278 +44 +283 +0 +284 +8 +340 +11 +  0 +ENDTAB +  0 +TABLE +  2 +BLOCK_RECORD +  5 +1 +100 +AcDbSymbolTable + 70 +1 +  0 +BLOCK_RECORD +  5 +1F +100 +AcDbSymbolTableRecord +100 +AcDbBlockTableRecord +  2 +*Model_Space +340 +22 +  0 +BLOCK_RECORD +  5 +1B +100 +AcDbSymbolTableRecord +100 +AcDbBlockTableRecord +  2 +*Paper_Space +340 +1E +  0 +BLOCK_RECORD +  5 +23 +100 +AcDbSymbolTableRecord +100 +AcDbBlockTableRecord +  2 +*Paper_Space0 +340 +26 +  0 +ENDTAB +  0 +ENDSEC +  0 +SECTION +  2 +BLOCKS +  0 +BLOCK +  5 +20 +100 +AcDbEntity +  8 +0 +100 +AcDbBlockBegin +  2 +*Model_Space + 70 +0 + 10 +0.0 + 20 +0.0 + 30 +0.0 +  3 +*Model_Space +  1 + +  0 +ENDBLK +  5 +21 +100 +AcDbEntity +  8 +0 +100 +AcDbBlockEnd +  0 +BLOCK +  5 +1C +100 +AcDbEntity + 67 +1 +  8 +0 +100 +AcDbBlockBegin +  2 +*Paper_Space + 70 +0 + 10 +0.0 + 20 +0.0 + 30 +0.0 +  3 +*Paper_Space +  1 + +  0 +ENDBLK +  5 +1D +100 +AcDbEntity + 67 +1 +  8 +0 +100 +AcDbBlockEnd +  0 +BLOCK +  5 +24 +100 +AcDbEntity +  8 +0 +100 +AcDbBlockBegin +  2 +*Paper_Space0 + 70 +0 + 10 +0.0 + 20 +0.0 + 30 +0.0 +  3 +*Paper_Space0 +  1 + +  0 +ENDBLK +  5 +25 +100 +AcDbEntity +  8 +0 +100 +AcDbBlockEnd +  0 +ENDSEC +  0 +SECTION +  2 +ENTITIES +  0 +LINE +  5 +43 +100 +AcDbEntity +100 +AcDbLine +  8 +0 + 62 +256 +370 +-1 +  6 +ByLayer + 10 +10.0 + 20 +100.0 + 30 +0.0 + 11 +210.0 + 21 +100.0 + 31 +0.0 +  0 +LINE +  5 +44 +100 +AcDbEntity +100 +AcDbLine +  8 +0 + 62 +256 +370 +-1 +  6 +ByLayer + 10 +210.0 + 20 +100.0 + 30 +0.0 + 11 +210.0 + 21 +-100.0 + 31 +0.0 +  0 +LINE +  5 +45 +100 +AcDbEntity +100 +AcDbLine +  8 +0 + 62 +256 +370 +-1 +  6 +ByLayer + 10 +210.0 + 20 +-100.0 + 30 +0.0 + 11 +10.0 + 21 +-100.0 + 31 +0.0 +  0 +LINE +  5 +46 +100 +AcDbEntity +100 +AcDbLine +  8 +0 + 62 +256 +370 +-1 +  6 +ByLayer + 10 +10.0 + 20 +-100.0 + 30 +0.0 + 11 +10.0 + 21 +100.0 + 31 +0.0 +  0 +DIMENSION +  5 +47 +100 +AcDbEntity +  8 +0 + 62 +256 +370 +-1 +  6 +ByLayer +100 +AcDbDimension + 10 +10.0000000000000018 + 20 +150.0 + 30 +0.0 + 11 +110.0 + 21 +151.875 + 31 +0.0 + 70 +1 + 71 +5 + 72 +1 + 41 +1.0 + 42 +0.0 +  1 +localfile +  3 +Standard +100 +AcDbAlignedDimension + 13 +10.0 + 23 +130.0 + 33 +0.0 + 14 +210.0 + 24 +130.0 + 34 +0.0 +  0 +ENDSEC +  0 +SECTION +  2 +OBJECTS +  0 +DICTIONARY +  5 +C +100 +AcDbDictionary +280 +0 +281 +1 +  3 +ACAD_GROUP +350 +D +  3 +ACAD_LAYOUT +350 +1A +  3 +ACAD_MLINESTYLE +350 +17 +  3 +ACAD_PLOTSETTINGS +350 +19 +  3 +ACAD_PLOTSTYLENAME +350 +E +  3 +AcDbVariableDictionary +350 +48 +  0 +DICTIONARY +  5 +D +100 +AcDbDictionary +280 +0 +281 +1 +  0 +ACDBDICTIONARYWDFLT +  5 +E +100 +AcDbDictionary +281 +1 +  3 +Normal +350 +F +100 +AcDbDictionaryWithDefault +340 +F +  0 +ACDBPLACEHOLDER +  5 +F +  0 +DICTIONARY +  5 +17 +100 +AcDbDictionary +280 +0 +281 +1 +  3 +Standard +350 +18 +  0 +MLINESTYLE +  5 +18 +100 +AcDbMlineStyle +  2 +STANDARD + 70 +0 +  3 + + 62 +256 + 51 +90.0 + 52 +90.0 + 71 +2 + 49 +0.5 + 62 +256 +  6 +BYLAYER + 49 +-0.5 + 62 +256 +  6 +BYLAYER +  0 +DICTIONARY +  5 +19 +100 +AcDbDictionary +280 +0 +281 +1 +  0 +DICTIONARY +  5 +1A +100 +AcDbDictionary +281 +1 +  3 +Layout1 +350 +1E +  3 +Layout2 +350 +26 +  3 +Model +350 +22 +  0 +LAYOUT +  5 +1E +100 +AcDbPlotSettings +  1 + +  2 +C:\Program Files\AutoCAD 2002\plotters\DWF ePlot (optimized for plotting).pc3 +  4 + +  6 + + 40 +0.0 + 41 +0.0 + 42 +0.0 + 43 +0.0 + 44 +0.0 + 45 +0.0 + 46 +0.0 + 47 +0.0 + 48 +0.0 + 49 +0.0 +140 +0.0 +141 +0.0 +142 +1.0 +143 +1.0 + 70 +688 + 72 +0 + 73 +0 + 74 +5 +  7 + + 75 +16 +147 +1.0 +148 +0.0 +149 +0.0 +100 +AcDbLayout +  1 +Layout1 + 70 +1 + 71 +1 + 10 +0.0 + 20 +0.0 + 11 +420.0 + 21 +297.0 + 12 +0.0 + 22 +0.0 + 32 +0.0 + 14 +100000000000000000000.0 + 24 +100000000000000000000.0 + 34 +100000000000000000000.0 + 15 +-100000000000000000000.0 + 25 +-100000000000000000000.0 + 35 +-100000000000000000000.0 +146 +0.0 + 13 +0.0 + 23 +0.0 + 33 +0.0 + 16 +1.0 + 26 +0.0 + 36 +0.0 + 17 +0.0 + 27 +1.0 + 37 +0.0 + 76 +0 +330 +1B +  0 +LAYOUT +  5 +22 +100 +AcDbPlotSettings +  1 + +  2 +C:\Program Files\AutoCAD 2002\plotters\DWF ePlot (optimized for plotting).pc3 +  4 + +  6 + + 40 +0.0 + 41 +0.0 + 42 +0.0 + 43 +0.0 + 44 +0.0 + 45 +0.0 + 46 +0.0 + 47 +0.0 + 48 +0.0 + 49 +0.0 +140 +0.0 +141 +0.0 +142 +1.0 +143 +1.0 + 70 +1712 + 72 +0 + 73 +0 + 74 +0 +  7 + + 75 +0 +147 +1.0 +148 +0.0 +149 +0.0 +100 +AcDbLayout +  1 +Model + 70 +1 + 71 +0 + 10 +0.0 + 20 +0.0 + 11 +12.0 + 21 +9.0 + 12 +0.0 + 22 +0.0 + 32 +0.0 + 14 +0.0 + 24 +0.0 + 34 +0.0 + 15 +0.0 + 25 +0.0 + 35 +0.0 +146 +0.0 + 13 +0.0 + 23 +0.0 + 33 +0.0 + 16 +1.0 + 26 +0.0 + 36 +0.0 + 17 +0.0 + 27 +1.0 + 37 +0.0 + 76 +0 +330 +1F +  0 +LAYOUT +  5 +26 +100 +AcDbPlotSettings +  1 + +  2 +C:\Program Files\AutoCAD 2002\plotters\DWF ePlot (optimized for plotting).pc3 +  4 + +  6 + + 40 +0.0 + 41 +0.0 + 42 +0.0 + 43 +0.0 + 44 +0.0 + 45 +0.0 + 46 +0.0 + 47 +0.0 + 48 +0.0 + 49 +0.0 +140 +0.0 +141 +0.0 +142 +1.0 +143 +1.0 + 70 +688 + 72 +0 + 73 +0 + 74 +5 +  7 + + 75 +16 +147 +1.0 +148 +0.0 +149 +0.0 +100 +AcDbLayout +  1 +Layout2 + 70 +1 + 71 +2 + 10 +0.0 + 20 +0.0 + 11 +12.0 + 21 +9.0 + 12 +0.0 + 22 +0.0 + 32 +0.0 + 14 +0.0 + 24 +0.0 + 34 +0.0 + 15 +0.0 + 25 +0.0 + 35 +0.0 +146 +0.0 + 13 +0.0 + 23 +0.0 + 33 +0.0 + 16 +1.0 + 26 +0.0 + 36 +0.0 + 17 +0.0 + 27 +1.0 + 37 +0.0 + 76 +0 +330 +23 +  0 +DICTIONARY +  5 +48 +100 +AcDbDictionary +281 +1 +  3 +DIMASSOC +350 +4A +  3 +HIDETEXT +350 +49 +  0 +DICTIONARYVAR +  5 +49 +100 +DictionaryVariables +280 +0 +  1 +2 +  0 +DICTIONARYVAR +  5 +4A +100 +DictionaryVariables +280 +0 +  1 +1 +  0 +ENDSEC +  0 +EOF diff --git a/testdata/scad/misc/localfiles_dir/localfiles-compatibility-test.scad b/testdata/scad/misc/localfiles_dir/localfiles-compatibility-test.scad new file mode 100644 index 0000000..d6b197c --- /dev/null +++ b/testdata/scad/misc/localfiles_dir/localfiles-compatibility-test.scad @@ -0,0 +1,3 @@ +use <localfiles_subdir/localfiles_submodule.scad> + +localfiles_submodule(); diff --git a/testdata/scad/misc/localfiles_dir/localfiles_module.scad b/testdata/scad/misc/localfiles_dir/localfiles_module.scad new file mode 100644 index 0000000..2611e71 --- /dev/null +++ b/testdata/scad/misc/localfiles_dir/localfiles_module.scad @@ -0,0 +1,9 @@ +module localfiles_module() +{ +  linear_extrude(h=100) import("localfile.dxf"); +  translate([-250,0,0]) linear_extrude(file="localfile.dxf"); +  translate([0,350,0]) rotate_extrude(file="localfile.dxf"); +  translate([250,0,0]) scale([200,200,50]) surface("localfile.dat"); + +  translate([0,-200,0]) sphere(r=dxf_dim(file="localfile.dxf", name="localfile")/2); +} diff --git a/testdata/scad/misc/localfiles_dir/localfiles_subdir/localfiles_submodule.scad b/testdata/scad/misc/localfiles_dir/localfiles_subdir/localfiles_submodule.scad new file mode 100644 index 0000000..cab3499 --- /dev/null +++ b/testdata/scad/misc/localfiles_dir/localfiles_subdir/localfiles_submodule.scad @@ -0,0 +1,9 @@ +module localfiles_submodule() +{ +  linear_extrude(h=100) import("localfile.dxf"); +  translate([-250,0,0]) linear_extrude(file="localfile.dxf"); +  translate([0,350,0]) rotate_extrude(file="localfile.dxf"); +  translate([250,0,0]) scale([200,200,50]) surface("localfile.dat"); + +  translate([0,-200,0]) sphere(r=dxf_dim(file="localfile.dxf", name="localfile")/2); +} diff --git a/testdata/scad/misc/lookup-tests.scad b/testdata/scad/misc/lookup-tests.scad new file mode 100644 index 0000000..c03ec95 --- /dev/null +++ b/testdata/scad/misc/lookup-tests.scad @@ -0,0 +1,17 @@ +echo(lookup(undef, undef)); +echo(lookup(undef, [undef])); +echo(lookup(undef, [[undef]])); +echo(lookup(undef, [[undef, undef]])); +echo(lookup(0, [[0, 0]])); +echo(lookup(0.5, [[0, 0], +                  [1, 1]])); + +table = [[-1,  -5], +         [-10, -55], +         [0,    0], +         [1,    3], +         [10,   333]]; +indices = [-20,-10,-9.9, -0.5, 0, 0.3, 1.1, 10, 10.1]; +for (i=[0:len(indices)-1]) { +  echo(lookup(indices[i], table)); +} diff --git a/testdata/scad/misc/variable-scope-sub.scad b/testdata/scad/misc/variable-scope-sub.scad new file mode 100644 index 0000000..fda9520 --- /dev/null +++ b/testdata/scad/misc/variable-scope-sub.scad @@ -0,0 +1,24 @@ +sub_global = 15; + +module submodule() { +  echo($children); +  echo(submodule_var); +  submodule_var = 16; +  module subsubmodule() { +    echo($children); +    subsubmodule_var = 17; +    echo(subsubmodule_var); +    child(0); +  } +  subsubmodule() {child(0); sphere();} +} + +module submodule2() { +  echo(sub_global); +  echo($children); +} + +module submain() { +  echo(global_var); // Undefined global var +  submodule() {submodule2() sphere(); cube();} +} diff --git a/testdata/scad/misc/variable-scope-tests.scad b/testdata/scad/misc/variable-scope-tests.scad new file mode 100644 index 0000000..8426fbb --- /dev/null +++ b/testdata/scad/misc/variable-scope-tests.scad @@ -0,0 +1,53 @@ +echo("special variable inheritance"); +module special_module(a) { +  echo(a, $fn); +  special_module2(a); +} + +module special_module2(b) { +  echo(a); +  echo(b, $fn); +} + +special_module(23, $fn=5); + +echo("inner variables shadows parameter"); +module inner_variables(a, b) { +  b = 24; +  echo(a, b); +} + +inner_variables(5, 6); + +echo("user-defined special variables as parameter"); +module user_defined_special($b) { +  echo($b); +  user_defined_special2(); +} + +module user_defined_special2() { +  echo($b); +} + +user_defined_special(7); + +echo("assign only visible in children's scope"); +module assigning() { +  echo(c); +} + +module assigning2(c) { +  echo(c); +} + +assign(c=5) { +  assigning(); +  assigning2(c); +} + +echo("undeclared variable can still be passed and used"); +module undeclared_var() { +  echo(d); +} + +undeclared_var(d=6); diff --git a/testdata/scad/templates/import_dxf-tests-template.scad b/testdata/scad/templates/import_dxf-tests-template.scad index f10dd06..91eca7a 100644 --- a/testdata/scad/templates/import_dxf-tests-template.scad +++ b/testdata/scad/templates/import_dxf-tests-template.scad @@ -4,7 +4,7 @@ translate([-210,0,0]) import(file="../../dxf/polygons.dxf", origin=[0,110]);  translate([-210,0,0]) import(file="../../dxf/polygons.dxf", origin=[110,110], scale=0.5);  import(file="../../dxf/multiple-layers.dxf");  translate([-200,200,0]) import(file="../../dxf/multiple-layers.dxf", layer="0"); -translate([0,200,0]) import(file="../../dxf/multiple-layers.dxf", layer="0"); +translate([0,200,0]) import(filename="../../dxf/multiple-layers.dxf", layername="0");  translate([200,200,0]) import(file="../../dxf/multiple-layers.dxf", layer="noname");  translate([0,200,0]) import(file="../../dxf/multiple-layers.dxf", layer="Layer with a pretty long name including \\ \"special\" /'\\\\ characters");  translate([200,0,0]) import(file="@CMAKE_SOURCE_DIR@/../testdata/dxf/polygons.dxf"); | 
