feat: Carve channels on sides of connectors
This commit is contained in:
parent
fc154a9810
commit
0094e19d3a
|
@ -87,7 +87,7 @@ class MountingBox(Model):
|
|||
diam = hole.diam if hole.diam else self.hole_diam
|
||||
result.push([(hole.x, hole.y)]).circle(diam / 2, mode='s')
|
||||
if self.profile_callback:
|
||||
profile = self.profile_callback(profile)
|
||||
result = self.profile_callback(result)
|
||||
return result
|
||||
|
||||
def generate(self) -> Cq.Workplane:
|
||||
|
@ -108,20 +108,22 @@ class MountingBox(Model):
|
|||
reverse_plane.moveTo(hole.x, hole.y).tagPlane(hole.rev_tag, '-Z')
|
||||
|
||||
if self.generate_side_tags:
|
||||
if self.centre_left_right_tags:
|
||||
result.faces("<Y").workplane(origin=result.edges("<Y and >Z").val().Center()).tagPlane("left")
|
||||
result.faces(">Y").workplane(origin=result.edges(">Y and >Z").val().Center()).tagPlane("right")
|
||||
else:
|
||||
result.faces("<Y").workplane(origin=result.vertices("<X and <Y and >Z").val().Center()).tagPlane("left")
|
||||
result.faces(">Y").workplane(origin=result.vertices("<X and >Y and >Z").val().Center()).tagPlane("right")
|
||||
xn, xp = 0, self.length
|
||||
if self.centred[0]:
|
||||
xn -= self.length/2
|
||||
xp -= self.length/2
|
||||
yn, yp = 0, self.width
|
||||
if self.centred[1]:
|
||||
yn -= self.width/2
|
||||
yp -= self.width/2
|
||||
|
||||
c_y = ">Y" if self.flip_y else "<Y"
|
||||
if self.centre_bot_top_tags:
|
||||
result.faces("<X").workplane(origin=result.edges(f"<X and >Z").val().Center()).tagPlane("bot")
|
||||
result.faces(">X").workplane(origin=result.edges(f">X and >Z").val().Center()).tagPlane("top")
|
||||
else:
|
||||
result.faces("<X").workplane(origin=result.vertices(f"<X and {c_y} and >Z").val().Center()).tagPlane("bot")
|
||||
result.faces(">X").workplane(origin=result.vertices(f">X and {c_y} and >Z").val().Center()).tagPlane("top")
|
||||
tag_x = xn + (self.length/2 if self.centre_left_right_tags else 0)
|
||||
result.copyWorkplane(Cq.Workplane('XZ', origin=(tag_x, yn, self.thickness))).tagPlane("left")
|
||||
result.copyWorkplane(Cq.Workplane('ZX', origin=(tag_x, yp, self.thickness))).tagPlane("right")
|
||||
|
||||
tag_y = yn + (self.width/2 if self.centre_bot_top_tags else 0)
|
||||
result.copyWorkplane(Cq.Workplane('ZY', origin=(xn, tag_y, self.thickness))).tagPlane("bot")
|
||||
result.copyWorkplane(Cq.Workplane('YZ', origin=(xp, tag_y, self.thickness))).tagPlane("top")
|
||||
result.faces(">Z").tag("dir")
|
||||
return result
|
||||
|
||||
|
|
|
@ -577,6 +577,17 @@ class WingProfile(Model):
|
|||
Hole(sign * x, tag=tag)
|
||||
for x, tag in joint.hole_loc_tags()
|
||||
]
|
||||
def carve_sides(profile):
|
||||
dy = (segment_thickness + joint.total_thickness) / 4
|
||||
return (
|
||||
profile
|
||||
.push([(0,-dy), (0,dy)])
|
||||
.rect(
|
||||
joint.parent_arm_width,
|
||||
(segment_thickness - joint.total_thickness) / 2,
|
||||
mode='s',
|
||||
)
|
||||
)
|
||||
# FIXME: Carve out the sides so light can pass through
|
||||
mbox = MountingBox(
|
||||
length=joint.lip_length,
|
||||
|
@ -586,6 +597,7 @@ class WingProfile(Model):
|
|||
hole_diam=joint.hole_diam,
|
||||
centred=(True, True),
|
||||
centre_left_right_tags=True,
|
||||
profile_callback=carve_sides,
|
||||
)
|
||||
return mbox
|
||||
|
||||
|
|
Loading…
Reference in New Issue