kopia lustrzana https://github.com/vilemduha/blendercam
Added added rack
rodzic
97283de1af
commit
2d1391a300
|
|
@ -765,8 +765,15 @@ class CamCurveGear(bpy.types.Operator):
|
|||
tooth_spacing: bpy.props.FloatProperty(name="distance per tooth", default=0.010, min=0.001, max=1.0, precision=4,
|
||||
unit="LENGTH")
|
||||
tooth_amount: bpy.props.IntProperty(name="Amount of teeth", default=7, min=4)
|
||||
|
||||
spoke_amount: bpy.props.IntProperty(name="Amount of spokes", default=4, min=0)
|
||||
|
||||
hole_diameter: bpy.props.FloatProperty(name="Hole diameter", default=0.003175, min=0, max=3.0, precision=4,
|
||||
unit="LENGTH")
|
||||
rim_size: bpy.props.FloatProperty(name="Rim size", default=0.003175, min=0, max=3.0, precision=4,
|
||||
unit="LENGTH")
|
||||
hub_diameter: bpy.props.FloatProperty(name="Hub diameter", default=0.005, min=0, max=3.0, precision=4,
|
||||
unit="LENGTH")
|
||||
pressure_angle: bpy.props.FloatProperty(name="Pressure Angle", default=math.radians(20), min=0.001, max=math.pi/2,
|
||||
precision=4,
|
||||
subtype="ANGLE",
|
||||
|
|
@ -794,6 +801,9 @@ class CamCurveGear(bpy.types.Operator):
|
|||
layout.prop(self, 'backlash')
|
||||
if self.gear_type == 'PINION':
|
||||
layout.prop(self, 'clearance')
|
||||
layout.prop(self, 'spoke_amount')
|
||||
layout.prop(self, 'rim_size')
|
||||
layout.prop(self, 'hub_diameter')
|
||||
elif self.gear_type == 'RACK':
|
||||
layout.prop(self, 'rack_height')
|
||||
layout.prop(self, 'rack_tooth_per_hole')
|
||||
|
|
@ -802,7 +812,8 @@ class CamCurveGear(bpy.types.Operator):
|
|||
if self.gear_type == 'PINION':
|
||||
involute_gear.gear(mm_per_tooth=self.tooth_spacing, number_of_teeth=self.tooth_amount,
|
||||
hole_diameter=self.hole_diameter, pressure_angle=self.pressure_angle,
|
||||
clearance=self.clearance, backlash=self.backlash)
|
||||
clearance=self.clearance, backlash=self.backlash,
|
||||
rim_size=self.rim_size, hub_diameter=self.hub_diameter, spokes=self.spoke_amount)
|
||||
elif self.gear_type == 'RACK':
|
||||
involute_gear.rack(mm_per_tooth=self.tooth_spacing, number_of_teeth=self.tooth_amount,
|
||||
pressure_angle=self.pressure_angle, height=self.rack_height,
|
||||
|
|
|
|||
|
|
@ -100,8 +100,8 @@ def gear_q6(b, s, t, d):
|
|||
# backlash = gap between two meshing teeth, in the direction along the circumference of the pitch circle
|
||||
|
||||
|
||||
def gear(mm_per_tooth=0.003, number_of_teeth=5, hole_diameter=0.003,
|
||||
pressure_angle=0.3488, clearance=0.0, backlash=0.0):
|
||||
def gear(mm_per_tooth=0.003, number_of_teeth=5, hole_diameter=0.003175,
|
||||
pressure_angle=0.3488, clearance=0.0, backlash=0.0, rim_size=0.0005, hub_diameter=0.006, spokes=4):
|
||||
simple.deselect()
|
||||
pi = math.pi
|
||||
p = mm_per_tooth * number_of_teeth / pi / 2 # radius of pitch circle
|
||||
|
|
@ -151,14 +151,45 @@ def gear(mm_per_tooth=0.003, number_of_teeth=5, hole_diameter=0.003,
|
|||
simple.active_name('_hub')
|
||||
simple.union('_')
|
||||
simple.active_name('_gear')
|
||||
bpy.ops.curve.simple(align='WORLD', location=(0, 0, 0), rotation=(0, 0, 0), Simple_Type='Circle',
|
||||
Simple_radius=hole_diameter/2, shape='3D', use_cyclic_u=True, edit_mode=False)
|
||||
simple.active_name('_hole')
|
||||
simple.difference('_', '_gear')
|
||||
simple.remove_doubles()
|
||||
|
||||
if spokes > 0:
|
||||
bpy.ops.curve.simple(align='WORLD', location=(0, 0, 0), rotation=(0, 0, 0), Simple_Type='Circle',
|
||||
Simple_radius=r-rim_size, shape='3D', use_cyclic_u=True, edit_mode=False)
|
||||
simple.active_name('_hole')
|
||||
simple.difference('_', '_gear')
|
||||
bpy.ops.curve.simple(align='WORLD', location=(0, 0, 0), rotation=(0, 0, 0), Simple_Type='Circle',
|
||||
Simple_radius=hub_diameter/2, shape='3D', use_cyclic_u=True, edit_mode=False)
|
||||
simple.active_name('_hub')
|
||||
bpy.ops.curve.simple(align='WORLD', location=(0, 0, 0), rotation=(0, 0, 0), Simple_Type='Circle',
|
||||
Simple_radius=hole_diameter/2, shape='3D', use_cyclic_u=True, edit_mode=False)
|
||||
simple.active_name('_hub_hole')
|
||||
simple.difference('_hub', '_hub')
|
||||
|
||||
simple.join_multiple('_')
|
||||
|
||||
simple.add_rectangle(r-rim_size-((hub_diameter-hole_diameter)/4 + hole_diameter/2), hub_diameter/2, center_x=False)
|
||||
simple.move(x=(hub_diameter-hole_diameter)/4 + hole_diameter/2)
|
||||
simple.active_name('_spoke')
|
||||
|
||||
angle = 2 * pi / spokes
|
||||
while spokes > 0:
|
||||
simple.duplicate()
|
||||
simple.rotate(angle)
|
||||
spokes -= 1
|
||||
simple.union('_spoke')
|
||||
simple.remove_doubles()
|
||||
simple.union('_')
|
||||
else:
|
||||
bpy.ops.curve.simple(align='WORLD', location=(0, 0, 0), rotation=(0, 0, 0), Simple_Type='Circle',
|
||||
Simple_radius=hole_diameter, shape='3D', use_cyclic_u=True, edit_mode=False)
|
||||
simple.active_name('_hole')
|
||||
simple.difference('_', '_gear')
|
||||
|
||||
name = 'gear-' + str(round(mm_per_tooth*1000, 1))
|
||||
name += 'mm-pitch-' + str(number_of_teeth)
|
||||
name += 'teeth-PA-' + str(round(math.degrees(pressure_angle), 1))
|
||||
simple.active_name(name)
|
||||
#simple.active_name(name)
|
||||
|
||||
|
||||
def rack(mm_per_tooth=0.01, number_of_teeth=11, height=0.012, pressure_angle=0.3488, backlash=0.0,
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue