cadquery/monitor/upper_arm.py

55 lines
1.6 KiB
Python
Raw Permalink Normal View History

2022-07-23 17:05:21 +00:00
# This is the arm from the monitor to the "elbow"
2022-07-23 15:57:54 +00:00
import cadquery2 as cq
from cadquery2 import exporters
from hinge import hinge_gap, hinge_w, hinge_profile_1, hinge_profile_2, hinge_t
# monitor hinge dimensions
inner_monitor_hinge = 3.2 / 2
outer_monitor_hinge = hinge_w / 2
monitor_hinge_shape = (
cq.Sketch().circle(outer_monitor_hinge).circle(inner_monitor_hinge, mode="s")
)
2022-07-23 17:05:21 +00:00
# Both hinges are the same shape, just one is outer and the other inner
elbow_hinge_shape = (
cq.Sketch().circle(outer_monitor_hinge).circle(inner_monitor_hinge, mode="s")
2022-07-23 15:57:54 +00:00
)
arm_length = 130
2022-07-23 17:05:21 +00:00
arm_width = hinge_gap
2022-07-23 15:57:54 +00:00
2022-07-23 19:12:56 +00:00
upper_arm = (
2022-07-23 15:57:54 +00:00
cq.Workplane("XY")
2022-07-23 17:05:21 +00:00
.rect(hinge_w, hinge_gap)
2022-07-23 15:57:54 +00:00
.extrude(arm_length)
.edges("|Z or <Z or >Z")
.fillet(0.25)
.faces(">Y")
# Add hinge that connects to the monitor
2022-07-23 17:05:21 +00:00
.workplane(centerOption="CenterOfBoundBox")
2022-07-23 15:57:54 +00:00
.center(0, arm_length / 2 + (outer_monitor_hinge - inner_monitor_hinge))
.placeSketch(monitor_hinge_shape)
.extrude(-hinge_gap)
2022-07-23 17:05:21 +00:00
.center(0, -(arm_length + outer_monitor_hinge))
# Add hinge that connects to the elbow
.transformed(rotate=cq.Vector(0, 0, 180))
.workplane(offset=(20 - arm_width) / 2)
.center(-hinge_w / 2, 0)
.tag("hingeplane")
2022-07-23 15:57:54 +00:00
.placeSketch(hinge_profile_1)
.extrude(-hinge_t)
.workplaneFromTagged("hingeplane")
2022-07-23 17:05:21 +00:00
.workplane(offset=-hinge_t - hinge_gap)
2022-07-23 15:57:54 +00:00
.placeSketch(hinge_profile_2)
.extrude(-hinge_t)
2022-07-23 17:05:21 +00:00
.workplaneFromTagged("hingeplane")
.center(+hinge_w / 2, 0)
.rect(hinge_w, hinge_w + 6)
.extrude(-(2 * hinge_t + hinge_gap))
2022-07-23 15:57:54 +00:00
)
2022-07-23 19:12:56 +00:00
exporters.export(upper_arm, "upper_arm.stl")