kopia lustrzana https://github.com/vilemduha/blendercam
puzzle joints - open curve
rodzic
ff8b47e0fe
commit
e67225f29b
|
|
@ -508,6 +508,7 @@ class CamCurvePuzzle(bpy.types.Operator):
|
|||
twist_thick: bpy.props.FloatProperty(name="Twist Thickness", default=0.0047, min=0.001, max=3.0, precision=4,
|
||||
unit="LENGTH")
|
||||
twist_percent: bpy.props.FloatProperty(name="Twist neck", default=0.3, min=0.1, max=0.9, precision=4)
|
||||
interlock_amount: bpy.props.IntProperty(name="Interlock amount on curve", default=2, min=0, max=200)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
|
@ -524,6 +525,8 @@ class CamCurvePuzzle(bpy.types.Operator):
|
|||
if self.twist_lock:
|
||||
layout.prop(self, 'twist_thick')
|
||||
layout.prop(self, 'twist_percent')
|
||||
if self.interlock_type == 'OPENCURVE':
|
||||
layout.prop(self, 'interlock_amount')
|
||||
layout.separator()
|
||||
layout.prop(self, 'height')
|
||||
|
||||
|
|
@ -633,7 +636,7 @@ class CamCurvePuzzle(bpy.types.Operator):
|
|||
|
||||
elif self.interlock_type == 'OPENCURVE' and curve_detected:
|
||||
puzzle_joinery.openCurve(line, 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, which=self.gender)
|
||||
stem=self.stem_size, twist=self.twist_lock, t_neck=self.twist_percent,
|
||||
t_thick=self.twist_thick, which=self.gender, twist_amount=self.interlock_amount)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
|
|
|||
|
|
@ -440,29 +440,32 @@ def variable_finger(loop, loop_length, min_finger, finger_size, finger_thick, fi
|
|||
return hpos
|
||||
|
||||
|
||||
def single_interlock(finger_depth, finger_thick, finger_tolerance, x, y, groove_angle, type, amount=1):
|
||||
def single_interlock(finger_depth, finger_thick, finger_tolerance, x, y, groove_angle, type, amount=1, twist_percentage=0.5):
|
||||
if type == "GROOVE":
|
||||
interlock_groove(finger_depth, finger_thick, finger_tolerance, x, y, groove_angle)
|
||||
elif type == "TWIST":
|
||||
interlock_twist(finger_depth, finger_thick, finger_tolerance, x, y, groove_angle)
|
||||
interlock_twist(finger_depth, finger_thick, finger_tolerance, x, y, groove_angle,percentage=twist_percentage)
|
||||
elif type == "PUZZLE":
|
||||
puzzle_joinery.fingers(finger_thick, finger_tolerance, amount)
|
||||
|
||||
|
||||
def distributed_interlock(loop, loop_length, finger_depth, finger_thick, finger_tolerance, finger_amount, tangent=0,
|
||||
fixed_angle=0, start=0.01, end=0.01, closed=True, type='GROOVE'):
|
||||
fixed_angle=0, start=0.01, end=0.01, closed=True, type='GROOVE', twist_percentage=0.5):
|
||||
# distributes interlocking joints of a fixed amount
|
||||
# dynamically changes the finger tolerance with the angle differences
|
||||
# loop = takes in a shapely shape
|
||||
# finger_size = size of the mortise
|
||||
# finger_thick = thickness of the material
|
||||
# finger_tolerance = minimum finger tolerance
|
||||
# twist_percentage = portion of twist finger which is the stem
|
||||
base = False
|
||||
coords = list(loop.coords)
|
||||
old_mortise_angle = 0
|
||||
print(closed)
|
||||
if not closed:
|
||||
spacing = (loop_length - start - end) / finger_amount
|
||||
spacing = (loop_length - start - end) / (finger_amount-1)
|
||||
distance = start
|
||||
end_distance = loop_length - end
|
||||
else:
|
||||
spacing = loop_length / finger_amount
|
||||
distance = 0
|
||||
|
|
@ -482,7 +485,7 @@ def distributed_interlock(loop, loop_length, finger_depth, finger_thick, finger_
|
|||
pd = loop.project(Point(p))
|
||||
|
||||
if not_start:
|
||||
while distance <= pd:
|
||||
while distance <= pd and end_distance >= distance:
|
||||
if fixed_angle == 0:
|
||||
groove_angle = angle(oldp, p) + math.pi / 2 + tangent
|
||||
else:
|
||||
|
|
@ -492,7 +495,7 @@ def distributed_interlock(loop, loop_length, finger_depth, finger_thick, finger_
|
|||
|
||||
print(j, "groove_angle", round(180 * groove_angle / math.pi), "distance", round(distance * 1000), "mm")
|
||||
single_interlock(finger_depth, finger_thick, finger_tolerance, groove_point.x, groove_point.y,
|
||||
groove_angle, type)
|
||||
groove_angle, type, twist_percentage=twist_percentage)
|
||||
|
||||
j += 1
|
||||
distance = j * spacing + start
|
||||
|
|
|
|||
|
|
@ -610,7 +610,11 @@ def mitre(length, thick, angle, angleb, diameter, tolerance, amount=0, stem=1, t
|
|||
simple.rename('tmprect', 'mitre')
|
||||
|
||||
|
||||
def openCurve(line, thick, diameter, tolerance, amount=0, stem=1, twist=False, tneck=0.5, tthick=0.01, which='MF'):
|
||||
def openCurve(line, thick, diameter, tolerance, amount=0, stem=1, twist=False, t_neck=0.5, t_thick=0.01, twist_amount=1,
|
||||
which='MF'):
|
||||
# puts puzzle connectors at the end of an open curve
|
||||
# optionally puts twist lock connectors at the puzzle connection
|
||||
# optionally puts twist lock connectors along the open curve
|
||||
# line = shapely linestring
|
||||
# thick = thickness of the bar
|
||||
# diameter = diameter of the tool for joint creation
|
||||
|
|
@ -618,6 +622,7 @@ def openCurve(line, thick, diameter, tolerance, amount=0, stem=1, twist=False, t
|
|||
# amount = amount of fingers in the joint 0 means auto generate
|
||||
# stem = amount of radius the stem or neck of the joint will have
|
||||
# twist = twist lock addition
|
||||
# twist_amount = twist amount distributed on the curve not counting the joint twist locks
|
||||
# tneck = percentage the twist neck will have compared to thick
|
||||
# tthick = thicknest of the twist material
|
||||
# Which M,F, MF, MM, FF
|
||||
|
|
@ -654,13 +659,22 @@ def openCurve(line, thick, diameter, tolerance, amount=0, stem=1, twist=False, t
|
|||
simple.activeName('tmp_fingers')
|
||||
simple.union('tmp_')
|
||||
simple.activeName('tmp_curve')
|
||||
twistm('tmp_curve', thick, diameter, tolerance, twist, tneck, tthick, end_angle, x=p_end[0], y=p_end[1])
|
||||
twistm('tmp_curve', thick, diameter, tolerance, twist, t_neck, t_thick, end_angle, x=p_end[0], y=p_end[1])
|
||||
|
||||
twistf('receptacle', thick, diameter, tolerance, twist, tneck, tthick)
|
||||
twistf('receptacle', thick, diameter, tolerance, twist, t_neck, t_thick)
|
||||
simple.rename('receptacle', 'tmp')
|
||||
simple.rotate(start_angle+math.pi)
|
||||
simple.move(x=p_start[0], y=p_start[1])
|
||||
simple.difference('tmp', 'tmp_curve')
|
||||
|
||||
if twist_amount > 0 and twist:
|
||||
twist_start = line.length / (twist_amount+1)
|
||||
joinery.distributed_interlock(line, line.length, 0.03, t_thick, tolerance, twist_amount,
|
||||
tangent=math.pi/2, fixed_angle=0, start=twist_start, end=twist_start,
|
||||
closed=False, type='TWIST', twist_percentage=t_neck)
|
||||
simple.activeName('tmp_twist')
|
||||
simple.difference('tmp', 'tmp_curve')
|
||||
|
||||
simple.activeName('puzzle_curve')
|
||||
|
||||
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue