# This is the arm from the monitor to the "elbow" 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") ) # 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") ) arm_length = 150 arm_width = hinge_gap upper_arm = ( cq.Workplane("XY") .rect(hinge_w, hinge_gap) .extrude(arm_length) .edges("|Z or Z") .fillet(0.25) .faces(">Y") # Add hinge that connects to the monitor .workplane(centerOption="CenterOfBoundBox") .center(0, arm_length / 2 + (outer_monitor_hinge - inner_monitor_hinge)) .placeSketch(monitor_hinge_shape) .extrude(-hinge_gap) .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") .placeSketch(hinge_profile_1) .extrude(-hinge_t) .workplaneFromTagged("hingeplane") .workplane(offset=-hinge_t - hinge_gap) .placeSketch(hinge_profile_2) .extrude(-hinge_t) .workplaneFromTagged("hingeplane") .center(+hinge_w / 2, 0) .rect(hinge_w, hinge_w + 6) .extrude(-(2 * hinge_t + hinge_gap)) ) exporters.export(upper_arm, "upper_arm.stl")