-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path06_enclosure_optional_params.py
40 lines (33 loc) · 2.08 KB
/
06_enclosure_optional_params.py
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
# NOTE
# It is strongly recommended to use Jupyter-Cadquery and the .ipynb sample file instead of this
# to view the examples: it will make it way easier for you to naviguate through the enclosure:
# interract with the models, hide parts, view the debug assemblies more easily, and much more.
# Can be removed if you've installed cq_enclosure_builder on your system
import sys
sys.path.append("../src")
from cq_enclosure_builder import PartFactory as pf
from cq_enclosure_builder import Enclosure, EnclosureSize, Face, ProjectInfo
project_info = ProjectInfo("Hello World", "0.9")
enclosure = Enclosure(
size=EnclosureSize(180, 90, 38, 2),
project_info=project_info,
lid_on_faces=[Face.BOTTOM], # for now, can only be BOTTOM, feel free to contribute/open an issue if you have a more specific need
lid_panel_size_error_margin=1.2, # meaning the lid is `margin` smaller than the hole (space for the lid) on both width and length
lid_thickness_error_margin=2, # if >0, the lid screws and support will be slightly sunk in the enclosure
add_corner_lid_screws=True, # one screw per corner; more can be added with Enclosure#add_screw
add_lid_support=True, # adds a rim all around the enclosure to prevent the lid from sinking in
add_top_support=True, # small support rim on the enclosure to provide additional strength
lid_screws_heat_set=True, # use heat set inserts instead of printed threads
no_fillet_top=True, # removed the fillet (rounded edges) on the top of the enclosure
no_fillet_bottom=True, # removed the fillet (rounded edges) on the bottom of the enclosure
)
pf.set_default_types({"button": 'SPST PBS-24B-4'})
pf.set_default_parameters({"enclosure_wall_thickness": enclosure.size.wall_thickness})
enclosure.add_part_to_face(Face.TOP, "SPST", pf.build_button(), rel_pos=(0, 0))
enclosure.assemble()
show_object(enclosure.assembly_with_debug)
# Exports the following files, based on the project's name and version:
# - stls/hello_world-box-v0.9.stl
# - stls/hello_world-lid-v0.9.stl
# - stls/hello_world-ALL-v0.9.stl
enclosure.export_printables()