Compare commits

..

No commits in common. "f2d2f652c475d08f8c94f1d2603d644e5f729891" and "05aaee6ee96d63085ad47f32dfeffa45f08442ff" have entirely different histories.

3 changed files with 1 additions and 152 deletions

View File

@ -1,150 +0,0 @@
import cadquery as cq
from cadquery import exporters
from modelo import (
height,
mounting_pillar_positions,
ti_depth,
ti_radius,
width,
)
hinge_radius = 6
screw_radius = 1.5 # M3
ring_radius = 5 # M3
hinge_offset = max(p[1] for p in mounting_pillar_positions) + 6
thickness = 5
hinge_width = 25
def model():
# Create the basic shape of the case bottom.
model = (
cq.Workplane("XY")
# Hollow box
.box(width, height, 5)
# Outer surface of the hinge
.faces(">X")
.workplane(centerOption="CenterOfBoundBox")
.center(height / 2 - hinge_offset, -hinge_radius + thickness / 2)
.tag("rightSide")
.placeSketch(cq.Sketch().circle(hinge_radius))
.extrude(-width)
# Cut middle section
.faces(">X")
.workplane(centerOption="CenterOfBoundBox", offset=-hinge_width)
.center(height / 2 - hinge_offset, 0)
.placeSketch(cq.Sketch().trapezoid(hinge_radius * 2 + 0.1, 20, 90))
.cutBlind(-width + 2 * hinge_width)
# Hole for screws
.faces(">X")
.workplane(centerOption="CenterOfBoundBox")
.center(height / 2 - hinge_offset, 0)
.placeSketch(cq.Sketch().circle(screw_radius))
.cutBlind(-width)
# Holes for rings & screw heads
.faces(">X")
.workplane(centerOption="CenterOfBoundBox")
.center(height / 2 - hinge_offset, 0)
.placeSketch(cq.Sketch().circle(ring_radius))
.cutBlind(-5)
.faces(">X")
.workplane(centerOption="CenterOfBoundBox", offset=-width + 4)
.center(height / 2 - hinge_offset, 0)
.placeSketch(cq.Sketch().circle(ring_radius))
.cutBlind(-5)
# Split hinge halves
.faces(">X")
.workplane(centerOption="CenterOfBoundBox", offset=-hinge_width / 2)
.center(height / 2 - hinge_offset, 0)
.placeSketch(cq.Sketch().trapezoid(hinge_radius * 2 + 1, hinge_radius * 2, 90))
.cutBlind(2)
.faces(">X")
.workplane(centerOption="CenterOfBoundBox", offset=-width + hinge_width / 2)
.center(height / 2 - hinge_offset, 0)
.placeSketch(cq.Sketch().trapezoid(hinge_radius * 2 + 1, hinge_radius * 2, 90))
.cutBlind(-1)
# Threaded inserts
.faces(">X")
.workplane(centerOption="CenterOfBoundBox", offset=-hinge_width / 2)
.center(height / 2 - hinge_offset, 0)
.placeSketch(cq.Sketch().circle(ti_radius))
.cutBlind(-ti_depth)
.faces(">X")
.workplane(centerOption="CenterOfBoundBox", offset=-width + hinge_width / 2)
.center(height / 2 - hinge_offset, 0)
.placeSketch(cq.Sketch().circle(ti_radius))
.cutBlind(ti_depth)
# Split two halves
.workplaneFromTagged("rightSide")
.placeSketch(
cq.Sketch()
.polygon(
[
(0, 0),
(-hinge_radius - 0.2, 0),
(-hinge_radius - 0.2, hinge_radius),
(0, hinge_radius),
(0, 0),
]
)
.circle(hinge_radius, mode="s")
)
.cutBlind("next")
.workplaneFromTagged("rightSide")
.workplane(offset=-hinge_width / 2)
.placeSketch(
cq.Sketch()
.polygon(
[
(0, 0),
(hinge_radius + 0.2, 0),
(hinge_radius + 0.2, hinge_radius),
(0, hinge_radius),
(0, 0),
]
)
.circle(hinge_radius, mode="s")
)
.cutBlind(-hinge_width/2)
.workplaneFromTagged("rightSide")
.workplane(offset=-width+hinge_width)
.placeSketch(
cq.Sketch()
.polygon(
[
(0, 0),
(hinge_radius + 0.2, 0),
(hinge_radius + 0.2, hinge_radius),
(0, hinge_radius),
(0, 0),
]
)
.circle(hinge_radius, mode="s")
)
.cutBlind(-hinge_width / 2)
.workplaneFromTagged("rightSide")
.workplane(offset=-width + hinge_width / 2)
.placeSketch(
cq.Sketch()
.polygon(
[
(0, 0),
(-hinge_radius - 0.2, 0),
(-hinge_radius - 0.2, hinge_radius),
(0, hinge_radius),
(0, 0),
]
)
.circle(hinge_radius, mode="s")
)
.cutBlind(-hinge_width / 2)
)
return model
if __name__ == "__main__":
model = model()
exporters.export(model, "hinged_lid.stl")

Binary file not shown.

View File

@ -17,7 +17,7 @@ front_lip = 8
def model(): def model():
# Create the basic shape of the case lid # Create the basic shape of the case bottom.
model = ( model = (
cq.Workplane("XY") cq.Workplane("XY")
# Hollow box # Hollow box
@ -67,7 +67,6 @@ def model():
def decorative_cover(): def decorative_cover():
# A decorative thingie to cover the ugly seam in the middle
model = cq.Workplane("XY").box(10, height, 1).edges("|Z").fillet(1) model = cq.Workplane("XY").box(10, height, 1).edges("|Z").fillet(1)
vent = hex_vents(size=6, width=width * 0.9, height=height * 0.9, density=0.775)[0] vent = hex_vents(size=6, width=width * 0.9, height=height * 0.9, density=0.775)[0]