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