-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.stanza
84 lines (79 loc) · 3.49 KB
/
tests.stanza
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
defpackage tests :
import core
import collections
import math
import geom
import clipper
import font
import libfive
import primitives
import utilities
import connection
import classes
import design
val num_slices:Int = 6
defn test_gooseneck () :
val design = new_design(5.0f,10.0f)
var side1 = extrude(woodThickness(design), rect(10.0f, 10.0f))
var side2 = extrude(woodThickness(design), rect(10.0f, 10.0f))
val sides_attached = attach(side1, connection_point(bounds(side1), V3f(1.0f, 0.5f, 0.5f)),side2, connection_point(bounds(side2), V3f(0.0f, 0.5f, 0.5f)))
val side1_attach = to-array<Shape>(sides_attached)[0]
val side2_attach = to-array<Shape>(sides_attached)[1]
val index1 = add_shape(design, side1_attach)
val index2 = add_shape(design, side2_attach)
var c_align = 0.0f
var c_point = connection_point(bounds(side2), V3f(0.0f, 0.5f, 0.5f))
var c_angle = V3f(1.0f, 0.0f, 0.0f)
add_connection(design, index1, index2, c_point, c_angle, c_align, gooseneck_primitive)
write_design(design, "gooseneck_test", 5)
defn test_dado () :
set-resolution(10.0f)
val design = new_design(5.0f, 10.0f)
var side1 = extrude(woodThickness(design), rect(20.0f, 20.0f))
var side2 = extrude(woodThickness(design), rect(20.0f, 20.0f))
val sides_attached = attach(side1, connection_point(bounds(side1), V3f(0.5f, 0.0f, 0.5f)),side2, connection_point(bounds(side2), V3f(0.5f, 1.0f, 0.5f)))
val side1_attach = to-array<Shape>(sides_attached)[0]
val side2_attach = to-array<Shape>(sides_attached)[1]
val index1 = add_shape(design, side1_attach)
val index2 = add_shape(design, side2_attach)
var c_align = 0.0f
var c_point = connection_point(bounds(side1_attach), V3f(0.5f, 0.0f, 0.5f))
var c_angle = V3f(0.0f, -1.0f, 0.0f)
add_connection(design, index1, index2, c_point, c_angle, c_align, dovetail_dado_primitive)
write_design_debug(design, "dovetail_dado_debug")
defn test_dovetail () :
val design = new_design(1.0f, 2.0f)
var side1 = extrude(woodThickness(design), rect(10.0f, 10.0f))
var side2 = extrude(woodThickness(design), rect(10.0f, 10.0f))
val sides_attached = attach(side1, connection_point(bounds(side1), V3f(1.0f, 0.5f, 0.5f)),side2, connection_point(bounds(side2), V3f(0.0f, 0.5f, 0.5f)))
val side1_attach = to-array<Shape>(sides_attached)[0]
val side2_attach = to-array<Shape>(sides_attached)[1]
val index1 = add_shape(design, side1_attach)
val index2 = add_shape(design, side2_attach)
var c_align = 0.0f
var c_point = connection_point(bounds(side2), V3f(0.0f, 0.5f, 0.5f))
var c_angle = V3f(1.0f, 0.0f, 0.0f)
add_connection(design, index1, index2, c_point, c_angle, c_align, dovetail_blind_primitive)
write_design_debug(design, "dovetail_test")
defn test_cube () :
val size_mm = 50.0f
val d = 50.0f / mm_to_point
val wt = d / 5.0f
val jw = d / 10.0f
val design = cube_design(d, jw, wt)
write_design_debug(design, "cube_design")
defn test_grid () :
grid_design()
defn test_table () :
val d = table_design(5.0f * inch_to_mm * mm_to_point, inch_to_mm * mm_to_point, inch_to_mm * mm_to_point)
write_design(d, "table_test", 4)
val e = table_design(5.0f * inch_to_mm * mm_to_point / 10.0f, inch_to_mm * mm_to_point / 10.0f, inch_to_mm * mm_to_point / 10.0f)
write_design_debug(e, "table_test")
;;float = 1.0f ->one point with 50.0f resolution ~ 1mm
;;float = 1.0f ->one point with 10.0f of resolution ~ 1mm
defn test_circle () :
val d = circle_design(5.0f * inch_to_mm * mm_to_point, inch_to_mm * mm_to_point, 4)
[]
defn main () :
test_table()
main()