pull/200/head
palain 2022-01-24 09:22:36 -04:00
rodzic 76cd52f4ec
commit 3a9ce2ca73
3 zmienionych plików z 49 dodań i 8 usunięć

Wyświetl plik

@ -579,7 +579,9 @@ class CamCurvePuzzle(bpy.types.Operator):
unit="LENGTH")
twist_percent: bpy.props.FloatProperty(name="Twist neck", default=0.3, min=0.1, max=0.9, precision=4)
twist_keep: bpy.props.BoolProperty(name="keep Twist holes", default=False)
twist_separator: bpy.props.BoolProperty(name="Add Twist separator", default=True)
twist_line: bpy.props.BoolProperty(name="Add Twist to bar", default=False)
twist_line_amount: bpy.props.IntProperty(name="amount of separators", default=2, min=1, max=600)
twist_separator: bpy.props.BoolProperty(name="Add Twist separator", default=False)
twist_separator_amount: bpy.props.IntProperty(name="amount of separators", default=2, min=2, max=600)
twist_separator_spacing: bpy.props.FloatProperty(name="Separator spacing", default=0.025, min=-0.004, max=1.0,
precision=4, unit="LENGTH")
@ -605,6 +607,9 @@ class CamCurvePuzzle(bpy.types.Operator):
layout.prop(self, 'twist_thick')
layout.prop(self, 'twist_percent')
layout.prop(self, 'twist_keep')
layout.prop(self, 'twist_line')
if self.twist_line:
layout.prop(self, 'twist_line_amount')
layout.prop(self, 'twist_separator')
if self.twist_separator:
layout.prop(self, 'twist_separator_amount')
@ -677,7 +682,9 @@ class CamCurvePuzzle(bpy.types.Operator):
if not self.mitre:
puzzle_joinery.bar(self.width, self.height, self.diameter, self.finger_tolerance, self.finger_amount,
stem=self.stem_size, twist=self.twist_lock, tneck=self.twist_percent,
tthick=self.twist_thick, twist_keep=self.twist_keep, which=self.gender)
tthick=self.twist_thick, twist_keep=self.twist_keep,
twist_line=self.twist_line, twist_line_amount=self.twist_line_amount,
which=self.gender)
else:
puzzle_joinery.mitre(self.width, self.height, self.angle, self.angleb, self.diameter,
self.finger_tolerance, self.finger_amount, stem=self.stem_size,
@ -692,13 +699,16 @@ class CamCurvePuzzle(bpy.types.Operator):
puzzle_joinery.arcbararc(self.width, self.radius, self.height, self.angle, self.angleb, self.diameter,
self.finger_tolerance, self.finger_amount,
stem=self.stem_size, twist=self.twist_lock, tneck=self.twist_percent,
tthick=self.twist_thick, twist_keep=self.twist_keep, which=self.gender)
tthick=self.twist_thick, twist_keep=self.twist_keep,
twist_line=self.twist_line, twist_line_amount=self.twist_line_amount,
which=self.gender)
elif self.interlock_type == 'CURVEBAR':
puzzle_joinery.arcbar(self.width, self.radius, self.height, self.angle, self.diameter,
self.finger_tolerance, self.finger_amount,
stem=self.stem_size, twist=self.twist_lock, tneck=self.twist_percent,
tthick=self.twist_thick, twist_keep=self.twist_keep,
twist_line=self.twist_line, twist_line_amount=self.twist_line_amount,
which=self.gender)
elif self.interlock_type == 'MULTIANGLE':

Wyświetl plik

@ -89,6 +89,21 @@ def interlock_twist(length, thickness, finger_play, cx=0, cy=0, rotation=0, perc
simple.remove_doubles()
def twist_line(length, thickness, finger_play, percentage, amount, distance, center=True):
# Makes an amount of twist for the distance and centers it
spacing = distance / amount
while amount > 0:
position = spacing * amount
interlock_twist(length, thickness, finger_play, percentage=percentage, cx=position)
print('twistline', amount, distance, position)
amount -= 1
simple.join_multiple('_groove')
simple.active_name('twist_line')
if center:
simple.move(x=(-distance-spacing)/2)
def twist_separator_slot(length, thickness, finger_play=0.00005, percentage=0.5):
simple.add_rectangle(thickness+finger_play, length, center_y=False)
simple.move(y=((length*percentage-finger_play)/2))

Wyświetl plik

@ -154,7 +154,8 @@ def twistm(name, length, diameter, tolerance, twist, tneck, tthick, angle, twist
def bar(width, thick, diameter, tolerance, amount=0, stem=1, twist=False, tneck=0.5, tthick=0.01, twist_keep=False,
which='MF'):
twist_line=False, twist_line_amount=2, which='MF'):
# width = length of the bar
# thick = thickness of the bar
# diameter = diameter of the tool for joint creation
@ -200,6 +201,13 @@ def bar(width, thick, diameter, tolerance, amount=0, stem=1, twist=False, tneck=
simple.remove_multiple("_") # Remove temporary base and holes
simple.remove_multiple("fingers") # Remove temporary base and holes
if twist_line:
joinery.twist_line(thick, tthick, tolerance, tneck, twist_line_amount, width)
if twist_keep:
simple.duplicate()
simple.active_name('tmptwist')
simple.difference('tmp', 'tmprect')
simple.rename('tmprect', 'Puzzle_bar')
simple.remove_multiple("tmp") # Remove temporary base and holes
simple.make_active('Puzzle_bar')
@ -291,7 +299,7 @@ def arc(radius, thick, angle, diameter, tolerance, amount=0, stem=1, twist=False
def arcbararc(length, radius, thick, angle, angleb, diameter, tolerance, amount=0, stem=1, twist=False,
tneck=0.5, tthick=0.01, which='MF', twist_keep=False):
tneck=0.5, tthick=0.01, which='MF', twist_keep=False, twist_line=False, twist_line_amount=2):
# length is the total width of the segments including 2 * radius and thick
# radius = radius of the curve
# thick = thickness of the bar
@ -332,13 +340,21 @@ def arcbararc(length, radius, thick, angle, angleb, diameter, tolerance, amount=
simple.move(x=-length / 2)
simple.active_name('tmp_receptacle')
simple.union('tmp')
simple.active_name('tmprect')
if twist_line:
joinery.twist_line(thick, tthick, tolerance, tneck, twist_line_amount, length)
if twist_keep:
simple.duplicate()
simple.active_name('tmptwist')
simple.difference('tmp', 'tmprect')
simple.active_name('arcBarArc')
simple.make_active('arcBarArc')
def arcbar(length, radius, thick, angle, diameter, tolerance, amount=0, stem=1, twist=False,
tneck=0.5, tthick=0.01, twist_keep=False, which='MF'):
tneck=0.5, tthick=0.01, twist_keep=False, which='MF', twist_line=False, twist_line_amount=2):
# length is the total width of the segments including 2 * radius and thick
# radius = radius of the curve
# thick = thickness of the bar
@ -361,12 +377,12 @@ def arcbar(length, radius, thick, angle, diameter, tolerance, amount=0, stem=1,
# Generate male section and join to the base
if which == 'MM' or which == 'MF':
bar(length, thick, diameter, tolerance, amount=amount, stem=stem, twist=twist, tneck=tneck, tthick=tthick,
which='M', twist_keep=twist_keep)
which='M', twist_keep=twist_keep, twist_line=twist_line, twist_line_amount=twist_line_amount)
simple.active_name('tmprect')
if which == 'FF' or which == 'FM':
bar(length, thick, diameter, tolerance, amount=amount, stem=stem, twist=twist, tneck=tneck, tthick=tthick,
which='F', twist_keep=twist_keep)
which='F', twist_keep=twist_keep, twist_line=twist_line, twist_line_amount=twist_line_amount)
simple.rotate(math.pi)
simple.active_name('tmprect')