File: openscad.actual

package info (click to toggle)
golang-github-alecthomas-chroma 0.6.3%2Breally0.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, buster-backports
  • size: 2,224 kB
  • sloc: python: 206; makefile: 6
file content (46 lines) | stat: -rw-r--r-- 1,020 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use <write.scad>
include <../common/base.scad>

/*
	Multiline
	Comment
*/

//draw a foobar
module foobar(){
    translate([0,-10,0])
    difference(){
    	height=5+6;
        cube([height,10.04,2.99e+8]);
        sphere(r=PI,$fn=100);
    }
}

foobar();
#cube ([5,5,5]);
echo("done");
    
function func0() = 5;
function func1(x=3) = 2*x+1;
function func2() = [1,2,3,4];
function func3(y=7) = (y==7) ? 5 : 2 ;
function func4(p0,p1,p2,p3) = [p0,p1,p2,p3];
    
echo (func0());           // 5
a =   func1();            // 7
b=    func1(5);           // 11
echo (func2());           // [1, 2, 3, 4]
echo( func3(2),func3());  // 2, 5
   
z= func4(func0(),func1(),func2(),func3()); //  [5, 7, [1, 2, 3, 4], 5]
   
translate([0,-4*func0(),0])cube([func0(),2*func0(),func0()]);

module parallelogram(x=1,y=1,angle=90)
    {polygon([[0,0],[x,0],
              [x+x*cos(angle)/sin(angle),y],
              [x*cos(angle)/sin(angle),y]]);};
  
parallelogram(10,10,35);

 function add_up_to(n) = ( n==0 ? 0 : n + add_up_to(n-1) );