Also fix mass printing on all objects Signed-off-by: Arnaud Morin <arnaud.gfpv@mailops.fr>
41 lines
800 B
Python
41 lines
800 B
Python
# @author Arnaud Morin <arnaud.gfpv@mailops.fr>
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
import cadquery as cq
|
|
|
|
from frame_params import (ALU_DENSITY, PLATE_GAP)
|
|
|
|
OD = 3.5 # round M2 standoff
|
|
|
|
def standoff():
|
|
p = (cq.Workplane("XY")
|
|
.circle(OD / 2.0)
|
|
.extrude(PLATE_GAP)
|
|
)
|
|
|
|
cut = (cq.Workplane("XY")
|
|
.circle(1)
|
|
.extrude(PLATE_GAP)
|
|
)
|
|
|
|
p = p.cut(cut)
|
|
|
|
return p
|
|
|
|
|
|
result = standoff()
|
|
|
|
assert result.solids().size() == 1, "standoff 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" % ("standoff", v * ALU_DENSITY))
|