feat: Improve model for printing
This commit is contained in:
parent
59bcc9914c
commit
1710f0db36
|
@ -74,11 +74,13 @@ class Handle:
|
||||||
result.faces(">Z").tag("mate2")
|
result.faces(">Z").tag("mate2")
|
||||||
return result
|
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(
|
return NMt.external_metric_thread(
|
||||||
self.diam_threading,
|
self.diam_threading,
|
||||||
self.thread_pitch,
|
self.thread_pitch,
|
||||||
self.insertion_length,
|
length,
|
||||||
top_lead_in=True)
|
top_lead_in=True)
|
||||||
def _internal_thread(self):
|
def _internal_thread(self):
|
||||||
return NMt.internal_metric_thread(
|
return NMt.internal_metric_thread(
|
||||||
|
@ -86,7 +88,7 @@ class Handle:
|
||||||
self.thread_pitch,
|
self.thread_pitch,
|
||||||
self.insertion_length)
|
self.insertion_length)
|
||||||
|
|
||||||
def insertion(self):
|
def insertion(self, holes=[]):
|
||||||
"""
|
"""
|
||||||
This type of joint is used to connect two handlebar pieces. Each handlebar
|
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
|
piece is a tube which cannot be machined, so the joint connects to the
|
||||||
|
@ -95,6 +97,12 @@ class Handle:
|
||||||
Tags:
|
Tags:
|
||||||
* lip: Co-planar Mates to the rod
|
* lip: Co-planar Mates to the rod
|
||||||
* mate: Mates to the connector
|
* 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 = (
|
result = (
|
||||||
Cq.Workplane('XY')
|
Cq.Workplane('XY')
|
||||||
|
@ -117,12 +125,22 @@ class Handle:
|
||||||
if not self.simplify_geometry:
|
if not self.simplify_geometry:
|
||||||
thread = self._internal_thread().val()
|
thread = self._internal_thread().val()
|
||||||
result = result.union(thread)
|
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
|
return result
|
||||||
|
|
||||||
def connector(self, solid: bool = False):
|
def connector(self, solid: bool = True):
|
||||||
"""
|
"""
|
||||||
Tags:
|
Tags:
|
||||||
* mate{1,2}: Mates to the connector
|
* mate{1,2}: Mates to the connector
|
||||||
|
|
||||||
|
WARNING: A tolerance lower than the defualt (maybe 2e-4) is required for
|
||||||
|
STL export.
|
||||||
"""
|
"""
|
||||||
result = (
|
result = (
|
||||||
Cq.Workplane('XY')
|
Cq.Workplane('XY')
|
||||||
|
@ -151,7 +169,7 @@ class Handle:
|
||||||
.located(Cq.Location((0, 0, self.connector_length / 2))))
|
.located(Cq.Location((0, 0, self.connector_length / 2))))
|
||||||
.union(
|
.union(
|
||||||
thread
|
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))))
|
.located(Cq.Location((0, 0, -self.connector_length / 2))))
|
||||||
)
|
)
|
||||||
return result
|
return result
|
||||||
|
@ -183,6 +201,28 @@ class Handle:
|
||||||
)
|
)
|
||||||
return result
|
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):
|
def connector_insertion_assembly(self):
|
||||||
connector_color = Cq.Color(0.8,0.8,0.5,0.3)
|
connector_color = Cq.Color(0.8,0.8,0.5,0.3)
|
||||||
insertion_color = Cq.Color(0.7,0.7,0.7,0.3)
|
insertion_color = Cq.Color(0.7,0.7,0.7,0.3)
|
||||||
|
|
|
@ -96,7 +96,7 @@ class Parameters:
|
||||||
|
|
||||||
trident_handle: Handle = Handle(
|
trident_handle: Handle = Handle(
|
||||||
diam=38,
|
diam=38,
|
||||||
diam_inner=33,
|
diam_inner=38-2 * 25.4/8,
|
||||||
# M27-3
|
# M27-3
|
||||||
diam_threading=27,
|
diam_threading=27,
|
||||||
thread_pitch=3,
|
thread_pitch=3,
|
||||||
|
|
Loading…
Reference in New Issue