forked from tazjel/declaracad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbottle.enaml
61 lines (56 loc) · 2.38 KB
/
bottle.enaml
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
from declaracad.occ.api import (
Cylinder, Prism, Face, Segment, Arc, Wire, Point,
Fuse, ThickSolid, Fillet, Transform, Part
)
enamldef Assembly(Part): part:
name = "Bottle"
#: "Parametric" properties of this shape
attr height = 7.0
attr width = 5.0
attr thickness = 3.0
#: Actual shape
ThickSolid:
material = 'diamond'
# Hollows out the bottle
#closing_faces << [neck.shape_faces[0]]
offset << thickness/50.0
Fuse:
# Fuse the bottle to the neck
Cylinder: neck:
# Bottle neck
position << (0,0,part.height)
direction = (0,0,1)
radius << thickness/4.0
height << part.height/10.0
Fillet: bottle:
# Bottle, with filleted edges
radius << thickness/12.0
Prism:
# Create a solid from the bottle face
vector << (0,0,height)
Face:
# Create a face from the base profile
Wire:
# Create a wire from the profile and mirrored profile
Wire: profile:
Segment:
Point: p1:
position << (-width/2.0, 0, 0)
Point: p2:
position << (-width/2.0, -thickness/4.0, 0)
Arc:
Point:
position := p2.position
Point: p3:
position << (0, -thickness/2.0, 0)
Point:
position := p5.position
Segment:
Point: p4:
position << (width/2.0, 0, 0)
Point: p5:
position << (width/2.0, -thickness/4.0, 0)
Transform:
#: TODO coerce
mirror = ((0,0,0),(1,0,0))
shape = profile