added alg123d only where needed

This commit is contained in:
Bernhard 2023-03-20 20:20:33 +01:00
parent e9964e465b
commit aaae6f5a08
15 changed files with 99 additions and 80 deletions

View file

@ -1,4 +1,5 @@
from alg123d import *
from build123d import *
import alg123d as ad
# 35x7.5mm DIN Rail Dimensions
overall_width, top_width, height, thickness, fillet_radius = 35, 27, 7.5, 1, 0.8
@ -24,24 +25,25 @@ inside_vertices = (
)
)
din = fillet(din, inside_vertices, radius=fillet_radius)
din = ad.fillet(din, inside_vertices, radius=fillet_radius)
outside_vertices = filter(
lambda v: (v.Y == 0.0 or v.Y == height)
and -overall_width / 2 < v.X < overall_width / 2,
din.vertices(),
)
din = fillet(din, outside_vertices, radius=fillet_radius + thickness)
din = ad.fillet(din, outside_vertices, radius=fillet_radius + thickness)
rail = extrude(din, rail_length)
rail = ad.extrude(din, rail_length)
plane = Plane(rail.faces().max(Axis.Y))
with LazyAlgCompound() as slot_faces:
for loc in GridLocations(0, slot_pitch, 1, rail_length // slot_pitch - 1):
slot_faces += plane * loc * SlotOverall(slot_length, slot_width)
slot_faces = [
plane * loc * SlotOverall(slot_length, slot_width)
for loc in GridLocations(0, slot_pitch, 1, rail_length // slot_pitch - 1)
]
slots = extrude(slot_faces, -height)
slots = ad.extrude(slot_faces, -height)
rail -= slots
rail = Plane.XZ * rail