You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.1 KiB
84 lines
2.1 KiB
from cadquery import exporters
|
|
from cq_warehouse.extensions import Workplane
|
|
from cq_warehouse.fastener import *
|
|
from cq_warehouse.thread import *
|
|
from cqmore.curve import archimedeanSpiral, circle
|
|
from cqmore.polygon import regularPolygon, star
|
|
from cqmore.polyhedron import polarZonohedra, Polyhedron, superellipsoid
|
|
from svg_path import addSvgPath
|
|
from svgpathtools import svg2paths
|
|
import cadquery as cq
|
|
import cqmore
|
|
from math import ceil, floor
|
|
|
|
Workplane = cqmore.extend(Workplane)
|
|
Workplane.addSvgPath = addSvgPath
|
|
|
|
width = 154
|
|
height = 182
|
|
|
|
poop_chute_dist_from_side = 59
|
|
|
|
holes_plane = (
|
|
Workplane("XZ")
|
|
.workplane(offset=-2)
|
|
.center(85, height - 75)
|
|
.cylinder(8, 14 / 2)
|
|
.center(-20, 0)
|
|
.cylinder(8, 14 / 2)
|
|
.center(10, 20)
|
|
.cylinder(8, 17 / 2)
|
|
)
|
|
|
|
cover_usb = (
|
|
Workplane("XZ").workplane(offset=-4.5).center(-4, height - 77).box(11, 5.3, 1.0)
|
|
)
|
|
|
|
result = cq.importers.importStep("/home/deck/Downloads/Backpanel_Part3.stp")
|
|
|
|
result = result.cut(holes_plane)
|
|
result = result.union(cover_usb)
|
|
|
|
# magnet distance should be 90 mm apart
|
|
test_piece = (
|
|
Workplane().workplane(offset=110).center(70, 0).box(80, 4, 60).cut(holes_plane)
|
|
)
|
|
|
|
cq.exporters.export(result, "/home/deck/model_files/modified_backpanel_part_3.step")
|
|
cq.exporters.export(
|
|
test_piece, "/home/deck/model_files/modified_backpanel_test_piece.step"
|
|
)
|
|
|
|
|
|
result_part1 = cq.importers.importStep("/home/deck/Downloads/Backpanel_Part1.stp")
|
|
|
|
magnet_diameter = 6
|
|
magnet_radius = magnet_diameter / 2.0
|
|
poop_chute_dist_from_bottom = (
|
|
14.8 # how far the poop chute is from the bottom of its piece
|
|
)
|
|
|
|
magnet_holes_plane = (
|
|
Workplane("XZ")
|
|
.center(
|
|
poop_chute_dist_from_side + 8,
|
|
-(poop_chute_dist_from_bottom) - (24 * 3 - (magnet_radius * 3)),
|
|
)
|
|
.rect(24, 24, forConstruction=True)
|
|
.vertices()
|
|
.cylinder(5, magnet_radius)
|
|
.center(0, 24)
|
|
.rect(24, 24, forConstruction=True)
|
|
.vertices()
|
|
.cylinder(5, magnet_radius)
|
|
)
|
|
|
|
result_part1 = result_part1.cut(magnet_holes_plane)
|
|
cq.exporters.export(
|
|
result_part1, "/home/deck/model_files/modified_backpanel_part_1.step"
|
|
)
|
|
|
|
try:
|
|
show_object(result_part1)
|
|
except NameError:
|
|
pass
|
|
|