Also fix mass printing on all objects Signed-off-by: Arnaud Morin <arnaud.gfpv@mailops.fr>
76 lines
1.7 KiB
Python
76 lines
1.7 KiB
Python
# @author Arnaud Morin <arnaud.gfpv@mailops.fr>
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
import cadquery as cq
|
|
from frame_params import PCB_DENSITY
|
|
|
|
|
|
def fc():
|
|
|
|
box = (cq.Workplane("XY")
|
|
.box(33, 33, 8, centered=(True, True, True))
|
|
.edges('Z')
|
|
.fillet(5)
|
|
)
|
|
|
|
# Remove extra for standoff
|
|
cut = (cq.Workplane("XY")
|
|
.pushPoints([
|
|
(25.5/2, 25.5/2),
|
|
(25.5/2, -25.5/2),
|
|
(-25.5/2, 25.5/2),
|
|
(-25.5/2, -25.5/2),
|
|
])
|
|
.circle(7)
|
|
.extrude(5)
|
|
.translate((0,0,1.6/2))
|
|
)
|
|
box = box.cut(cut).cut(cut.mirror("XY"))
|
|
|
|
# Standoff
|
|
sta = (cq.Workplane("XY")
|
|
.pushPoints([
|
|
(25.5/2, 25.5/2),
|
|
(25.5/2, -25.5/2),
|
|
(-25.5/2, 25.5/2),
|
|
(-25.5/2, -25.5/2),
|
|
])
|
|
.circle(2.5)
|
|
.extrude(5, both=True)
|
|
.translate((0,0,-2))
|
|
)
|
|
box = box.union(sta)
|
|
|
|
# holes in standoff
|
|
cut = (cq.Workplane("XY")
|
|
.pushPoints([
|
|
(25.5/2, 25.5/2),
|
|
(25.5/2, -25.5/2),
|
|
(-25.5/2, 25.5/2),
|
|
(-25.5/2, -25.5/2),
|
|
])
|
|
.circle(1.2)
|
|
.extrude(10, both=True)
|
|
)
|
|
box = box.cut(cut)
|
|
|
|
# Make Z 0
|
|
box = box.translate((0,0,7))
|
|
return box
|
|
|
|
|
|
result = fc()
|
|
|
|
assert result.solids().size() == 1, "fc is not one solid"
|
|
|
|
if "show_object" not in globals(): # running outside CQ-editor
|
|
def show_object(*args, **kwargs):
|
|
pass
|
|
|
|
show_object(result)
|
|
|
|
if __name__ == "__main__":
|
|
v = result.val().Volume()
|
|
print("%-12s %.2f g" % ("fc", v * PCB_DENSITY))
|