-
Notifications
You must be signed in to change notification settings - Fork 0
/
mcad_test.go
55 lines (52 loc) · 1.35 KB
/
mcad_test.go
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
47
48
49
50
51
52
53
54
55
package mcad_test
import (
"fmt"
"os"
"github.com/lestrrat-go/openscad"
)
func ExampleScrew() {
if err := openscad.EmitFile("screw.scad", os.Stdout); err != nil {
fmt.Printf("%s\n", err)
return
}
// OUTPUT:
// include <curves.scad>
//
// module helix(pitch, length, slices=500)
// {
// rotations=length/pitch;
// linear_extrude(height=length, center=false, convexity=10, twist=360*rotations, scale=slices, $fn=100)
// children();
// }
//
// module auger(pitch, length, outside_radius, inner_radius, taper_ratio=0.25)
// {
// union()
// {
// helix(pitch, length)
// polygon(points=[[0, inner_radius], [outside_radius, inner_radius*taper_ratio], [outside_radius, inner_radius*-1*taper_ratio], [0, -1*inner_radius]], paths=[[0, 1, 2, 3]]);
// cylinder(h=length, r=inner_radius);
// }
// }
//
// module ball_groove(pitch, length, diameter, ball_radius=10)
// {
// helix(pitch, length, 100)
// translate([diameter, 0, 0])
// circle(r=ball_radius);
// }
//
// module ball_groove2(pitch, length, diameter, ball_radius, slices=200)
// {
// rotations=length/pitch;
// radius=diameter/2;
// offset=length/slices;
// union()
// for(i=[0:slices]) {
// let(z=i*offset)
// translate(helix_curve(pitch, radius, z))
// sphere(r=ball_radius, $fa=5, $fs=1);
// }
// }
//
}