Browse Source

adding completed organizer

master
wes 2 weeks ago
parent
commit
9eee35cf14
  1. 132
      organizer.py

132
organizer.py

@ -1,20 +1,35 @@
from cadquery import exporters from cadquery import exporters
from cq_warehouse.extensions import Workplane from cq_warehouse.extensions import Workplane
from cq_warehouse.fastener import *
from cq_warehouse.thread import *
import cadquery as cq import cadquery as cq
magnet_diameter = 5.0 screw_simple = False # Controls whether to not actually make the screw threads, saves time running it for testing
screw_length = 15 # FIXME need different ones for different holes
handle_screw = ButtonHeadScrew(
size="M6-1",
fastener_type="iso7380_1",
length=screw_length * MM,
simple=screw_simple,
)
magnet_diameter = 4.92
magnet_radius = magnet_diameter / 2.0 magnet_radius = magnet_diameter / 2.0
prong_width = 20.0 prong_width = 20.0
prong_dist = 224.75 - prong_width prong_dist = 228 - prong_width
prong_height = 23.5 prong_height = 23.5
prong_thickness = 7.7 prong_thickness = 7.7
wall_thickness = 4.7 wall_thickness = 5.4
depth = 128 depth = 128
width = 245 width = 240
height = 133 height = 133
magnet_buffer_space = -0.6 magnet_buffer_space = 0.3
foot_diameter = 8.8
foot_radius = foot_diameter / 2.0
result = Workplane() result = Workplane()
result = result.box( result = result.box(
@ -32,6 +47,7 @@ result = (
) )
) )
# Magnet holes
result = ( result = (
result.workplane(offset=wall_thickness) result.workplane(offset=wall_thickness)
.move(width / 2.0 - magnet_diameter, 0) .move(width / 2.0 - magnet_diameter, 0)
@ -51,7 +67,7 @@ result = (
) )
.line(0, depth - wall_thickness * 2) .line(0, depth - wall_thickness * 2)
.vertices() .vertices()
.cylinder(6.5, magnet_radius, combine="cut") .cylinder(6.6, magnet_radius, combine="cut")
) )
door_side_magnet_cut_left = ( door_side_magnet_cut_left = (
@ -59,9 +75,9 @@ door_side_magnet_cut_left = (
.workplane(offset=depth / 2.0) .workplane(offset=depth / 2.0)
.move( .move(
width / 2.0 - wall_thickness + (magnet_buffer_space / 2.0), width / 2.0 - wall_thickness + (magnet_buffer_space / 2.0),
-depth / 2.0 + wall_thickness + 6, -depth / 2.0 + wall_thickness + 7,
) )
.cylinder(3, magnet_radius) .cylinder(4.3, magnet_radius)
) )
door_side_magnet_cut_right = ( door_side_magnet_cut_right = (
@ -69,9 +85,9 @@ door_side_magnet_cut_right = (
.workplane(offset=-(depth / 2.0)) .workplane(offset=-(depth / 2.0))
.move( .move(
width / 2.0 - wall_thickness + (magnet_buffer_space / 2.0), width / 2.0 - wall_thickness + (magnet_buffer_space / 2.0),
-depth / 2.0 + wall_thickness + 6, -depth / 2.0 + wall_thickness + 7,
) )
.cylinder(3, magnet_radius) .cylinder(4.3, magnet_radius)
) )
result = result.cut(door_side_magnet_cut_left) result = result.cut(door_side_magnet_cut_left)
@ -82,9 +98,9 @@ door_side_magnet_cut_left_top = (
.workplane(offset=depth / 2.0) .workplane(offset=depth / 2.0)
.move( .move(
width / 2.0 - wall_thickness + (magnet_buffer_space / 2.0), width / 2.0 - wall_thickness + (magnet_buffer_space / 2.0),
depth / 2.0 - wall_thickness - 5, depth / 2.0 - wall_thickness - 7,
) )
.cylinder(3, magnet_radius) .cylinder(4.3, magnet_radius)
) )
door_side_magnet_cut_right_top = ( door_side_magnet_cut_right_top = (
@ -92,18 +108,20 @@ door_side_magnet_cut_right_top = (
.workplane(offset=-(depth / 2.0)) .workplane(offset=-(depth / 2.0))
.move( .move(
width / 2.0 - wall_thickness + (magnet_buffer_space / 2.0), width / 2.0 - wall_thickness + (magnet_buffer_space / 2.0),
depth / 2.0 - wall_thickness - 5, depth / 2.0 - wall_thickness - 7,
) )
.cylinder(3, magnet_radius) .cylinder(4.3, magnet_radius)
) )
result = result.cut(door_side_magnet_cut_left_top) result = result.cut(door_side_magnet_cut_left_top)
result = result.cut(door_side_magnet_cut_right_top) result = result.cut(door_side_magnet_cut_right_top)
# slots to fit the oscilloscope in
# move 38 mm back
scope_slots = ( scope_slots = (
Workplane("ZX") Workplane("ZX")
.workplane(offset=(height / 2.0)) .workplane(offset=(height / 2.0))
.move(depth / 2.0 - wall_thickness, -(width / 2.0) + 18) .move(depth / 2.0 - wall_thickness - 38, -(width / 2.0) + 13)
.line(0, prong_dist) .line(0, prong_dist)
.vertices() .vertices()
.box(prong_thickness, prong_width, wall_thickness * 3) .box(prong_thickness, prong_width, wall_thickness * 3)
@ -117,19 +135,97 @@ feet_cut = (
.move(0, 0) .move(0, 0)
.rect(height - wall_thickness * 6, width - wall_thickness * 6) .rect(height - wall_thickness * 6, width - wall_thickness * 6)
.vertices() .vertices()
.cylinder(2, 5) .cylinder(1.4, foot_radius)
) )
result = result.cut(feet_cut) result = result.cut(feet_cut)
## Doors ## Doors
door = Workplane() door = Workplane()
door = door.box(wall_thickness, (depth + wall_thickness), height + wall_thickness) door = door.box(wall_thickness, depth, height)
## Door magnets
door = (
door.workplane(offset=-(height / 2.0) - 1)
.move(
0,
-(depth / 2.0) + wall_thickness,
)
.line(0, depth - wall_thickness * 2)
.vertices()
.cylinder(6.6, magnet_radius, combine="cut")
)
_door_side_magnet_cut_left = (
Workplane("XZ")
.workplane(offset=(depth / 2.0))
.move(
0,
-depth / 2.0 + wall_thickness + 7,
)
.cylinder(4.3, magnet_radius)
)
_door_side_magnet_cut_right = (
Workplane("XZ")
.workplane(offset=-(depth / 2.0))
.move(
0,
-depth / 2.0 + wall_thickness + 7,
)
.cylinder(4.3, magnet_radius)
)
door = door.cut(_door_side_magnet_cut_left)
door = door.cut(_door_side_magnet_cut_right)
_door_side_magnet_cut_left_top = (
Workplane("XZ")
.workplane(offset=depth / 2.0)
.move(
0,
depth / 2.0 - wall_thickness - 7,
)
.cylinder(4.3, magnet_radius)
)
_door_side_magnet_cut_right_top = (
Workplane("XZ")
.workplane(offset=-(depth / 2.0))
.move(
0,
depth / 2.0 - wall_thickness - 7,
)
.cylinder(4.3, magnet_radius)
)
door = door.cut(_door_side_magnet_cut_left_top)
door = door.cut(_door_side_magnet_cut_right_top)
# door_handle_cut = Workplane().union(screw_thread.rotate((0, 0, 0), (0, 1, 0), 270))
door = (
door.rotate((0, 0, 0), (0, 1, 0), 270)
.workplane(offset=6.0)
.move(60, 0)
.threadedHole(handle_screw, 8, simple=screw_simple, fit="Close")
)
handle = (
Workplane()
.union(handle_screw)
.workplane(offset=5)
.cylinder(8, 6, combine="cut")
.workplane(offset=5)
.cylinder(5, 3.5)
)
cq.exporters.export(result, "/home/deck/model_files/organizer.stl") cq.exporters.export(result, "/home/deck/model_files/organizer.stl")
cq.exporters.export(door, "/home/deck/model_files/organizer_door.stl") cq.exporters.export(door, "/home/deck/model_files/organizer_door.stl")
cq.exporters.export(handle, "/home/deck/model_files/organizer_door_handle.stl")
try: try:
show_object(result) show_object(handle)
except NameError: except NameError:
pass pass

Loading…
Cancel
Save