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

double sided working

parent 38658c34
No related merge requests found
......@@ -96,13 +96,8 @@ def generateDouble(
top_tip_angle: float | None = None,
bottom_tip_angle: float | None = None,
top_sphere_angles: list[float] | None = None,
bottom_sphere_angles: list[float] | None = None,
):
if not (
hole_radius < radius
and (top_tip_angle or top_sphere_angles)
and (bottom_tip_angle or bottom_sphere_angles)
):
if not (hole_radius < radius and (top_tip_angle or top_sphere_angles)):
print("parameters missing or out of range")
return
......@@ -141,6 +136,12 @@ def generateDouble(
)
)
b -= sweep(sections=[hole_shape], path=line)
else:
b -= extrude(
to_extrude=hole_shape,
amount=tip.faces().sort_by(SortBy.AREA).first.center().Z,
both=True,
)
return (tools.exportSTL(b, "double-sided", 1), b)
......
......@@ -99,7 +99,6 @@ def double_sided(
top_tip_angle: Annotated[float | None, Query(gt=0, lt=180)] = None,
bottom_tip_angle: Annotated[float | None, Query(gt=0, lt=180)] = None,
top_sphere_angles: Annotated[list[float] | None, Query()] = None,
bottom_sphere_angles: Annotated[list[float] | None, Query()] = None,
):
args = {
"radius": radius,
......@@ -111,7 +110,6 @@ def double_sided(
"top_tip_angle": top_tip_angle,
"bottom_tip_angle": bottom_tip_angle,
"top_sphere_angles": top_sphere_angles,
"bottom_sphere_angles": bottom_sphere_angles,
}
for k, v in cur_args.items():
if v:
......@@ -195,7 +193,10 @@ def polygon(
hole_radius: Annotated[float, Query(gt=0)],
):
result = structureGen.polygonStructGen(
num_sides=num_sides, side_length=side_length, beads_per_side=beads_per_side, hole_radius=hole_radius
num_sides=num_sides,
side_length=side_length,
beads_per_side=beads_per_side,
hole_radius=hole_radius,
)
filename = result[0]
return FileResponse(path=directory + filename, filename=filename)
......@@ -22,9 +22,7 @@
let top_cone_tip_angle = 90;
let bottom_cone_tip_angle = 90;
let top_sphere_angles = [0];
let bottom_sphere_angles = [0];
let top_current_angle_input = 45;
let bottom_current_angle_input = 45;
let api_path: string;
$: {
......@@ -38,10 +36,6 @@
}
if (bottom_type == "cone") {
api_path += `&bottom_tip_angle=${bottom_cone_tip_angle}`;
} else {
bottom_sphere_angles.forEach((angle) => {
api_path += `&bottom_sphere_angles=${angle}`;
});
}
}
......@@ -156,40 +150,6 @@
bind:value={bottom_cone_tip_angle}
/>
{/if}
{#if bottom_type == "sphere"}
<label for="angle-input"> Angle Editor </label>
<div class="flex flex-row">
<input
name="angle-input"
class="flex-1 h-10 min-w-0 bg-purple-100"
type="number"
bind:value={bottom_current_angle_input}
/>
<button
class="h-10 rounded-full w-1/4 bg-rose-300"
on:click={() => {
if (!bottom_sphere_angles.includes(bottom_current_angle_input)) {
bottom_sphere_angles.push(bottom_current_angle_input);
bottom_sphere_angles = bottom_sphere_angles;
}
}}
>
Add
</button>
<button
class="h-10 rounded-full w-1/4 bg-rose-500"
on:click={() => {
bottom_sphere_angles = [0];
}}
>
Reset
</button>
</div>
<p>
Current Angles: {bottom_sphere_angles}
</p>
{/if}
</div>
<button
class="h-10 rounded-full bg-green-500"
......
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