cosplay: Touhou/Houjuu Nue #4

Open
aniva wants to merge 189 commits from touhou/houjuu-nue into main
2 changed files with 46 additions and 6 deletions
Showing only changes of commit 1710f0db36 - Show all commits

View File

@ -74,11 +74,13 @@ class Handle:
result.faces(">Z").tag("mate2")
return result
def _external_thread(self):
def _external_thread(self, length=None):
if length is None:
length = self.insertion_length
return NMt.external_metric_thread(
self.diam_threading,
self.thread_pitch,
self.insertion_length,
length,
top_lead_in=True)
def _internal_thread(self):
return NMt.internal_metric_thread(
@ -86,7 +88,7 @@ class Handle:
self.thread_pitch,
self.insertion_length)
def insertion(self):
def insertion(self, holes=[]):
"""
This type of joint is used to connect two handlebar pieces. Each handlebar
piece is a tube which cannot be machined, so the joint connects to the
@ -95,6 +97,12 @@ class Handle:
Tags:
* lip: Co-planar Mates to the rod
* mate: Mates to the connector
WARNING: A tolerance lower than the defualt (maybe 5e-4) is required for
STL export.
Set `holes` to the heights for drilling holes into the model for resin
to flow out.
"""
result = (
Cq.Workplane('XY')
@ -117,12 +125,22 @@ class Handle:
if not self.simplify_geometry:
thread = self._internal_thread().val()
result = result.union(thread)
for h in holes:
cyl = Cq.Solid.makeCylinder(
radius=2,
height=self.diam * 2,
pnt=(-self.diam, 0, h),
dir=(1, 0, 0))
result = result.cut(cyl)
return result
def connector(self, solid: bool = False):
def connector(self, solid: bool = True):
"""
Tags:
* mate{1,2}: Mates to the connector
WARNING: A tolerance lower than the defualt (maybe 2e-4) is required for
STL export.
"""
result = (
Cq.Workplane('XY')
@ -151,7 +169,7 @@ class Handle:
.located(Cq.Location((0, 0, self.connector_length / 2))))
.union(
thread
.rotate((0,0,0), (1,0,0), angleDegrees=90)
.rotate((0,0,0), (1,0,0), angleDegrees=180)
.located(Cq.Location((0, 0, -self.connector_length / 2))))
)
return result
@ -183,6 +201,28 @@ class Handle:
)
return result
def threaded_core(self, length):
"""
Generates a threaded core for unioning with other components
"""
result = (
Cq.Workplane('XY')
.cylinder(
radius=self.diam_connector_external / 2,
height=length,
centered=(True, True, False),
)
)
result.faces(">Z").tag("mate")
result.faces("<Z").tag("base")
if not self.simplify_geometry:
thread = self._external_thread(length=length).val()
result = (
result
.union(thread)
)
return result
def connector_insertion_assembly(self):
connector_color = Cq.Color(0.8,0.8,0.5,0.3)
insertion_color = Cq.Color(0.7,0.7,0.7,0.3)

View File

@ -96,7 +96,7 @@ class Parameters:
trident_handle: Handle = Handle(
diam=38,
diam_inner=33,
diam_inner=38-2 * 25.4/8,
# M27-3
diam_threading=27,
thread_pitch=3,