Skip to content
Snippets Groups Projects
Commit 09b6ace4 authored by Albert Dong's avatar Albert Dong
Browse files

Copies working for multi-angle bead

parent 12e1b5ff
Branches
No related merge requests found
......@@ -205,7 +205,7 @@ def generateSphere(radius: float, hole_radius: float, effective_angle: float, co
)
def generateAngledBead(radius, hole_radius, angles, cutout_query):
def generateAngledBead(radius, hole_radius, angles, cutout_query, copies):
ratio = 0.88
sphere = Sphere(radius)
bottom_cut = Pos(0, 0, -radius * 4 / 3) * Sphere(radius)
......@@ -242,5 +242,11 @@ def generateAngledBead(radius, hole_radius, angles, cutout_query):
)
bead -= Pos(radius * 2 / 3, 0, 0) * drain_hole
bead -= Pos(-radius * 2 / 3, 0, 0) * drain_hole
return (tools.exportSTL(bead, "angled-spherical-bead", 1), bead)
return (
tools.exportSTL(
tools.combineItemList([bead] * copies, bead.bounding_box().diagonal),
"angled-spherical-bead",
1,
),
bead,
)
......@@ -153,10 +153,11 @@ def angled_sphere(
radius: Annotated[float, Query(gt=0)],
hole_radius: Annotated[float, Query(gt=0)],
angles: Annotated[list[float], Query()],
copies: Annotated[int, Query(gt=0)]
# cutoutQuery: Annotated[bool, Query()]
):
result = beadGen.generateAngledBead(
radius=radius, hole_radius=hole_radius, angles=angles, cutout_query=False
radius=radius, hole_radius=hole_radius, angles=angles, cutout_query=False, copies=copies
)
filename = result[0]
return FileResponse(path=directory + filename, filename=filename)
......
......@@ -38,7 +38,7 @@
} else if (bead_type == "normal") {
api_path = `http://localhost:8000/api/sphere?radius=${radius}&hole_radius=${hole_radius}&effective_angle=${effective_angle}&copies=${copies}`;
} else if (bead_type == "multi") {
api_path = `http://localhost:8000/api/angled-sphere?radius=${radius}&hole_radius=${hole_radius}`;
api_path = `http://localhost:8000/api/angled-sphere?radius=${radius}&hole_radius=${hole_radius}&copies=${copies}`;
angles.forEach((angle) => {
api_path += `&angles=${angle}`;
});
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment