Bandsaw Tyre
This commit is contained in:
commit
e7b8f7edd3
|
@ -0,0 +1,2 @@
|
|||
.DS_Store
|
||||
.venv/
|
|
@ -0,0 +1,135 @@
|
|||
#! /usr/bin/env python3
|
||||
import fullcontrol as fc
|
||||
import math
|
||||
|
||||
debug = True
|
||||
design_name = 'bandsaw_tyre'
|
||||
print_speed = 1000
|
||||
max_print_speed = 30000
|
||||
fan_percent = 100
|
||||
bed_width = 300
|
||||
bed_depth = 200
|
||||
centre_x = bed_width / 2
|
||||
centre_y = bed_depth / 2
|
||||
printer_name = 'generic'
|
||||
nozzle_diameter = 0.8
|
||||
layer_height = 0.3
|
||||
min_e_height = 0.01
|
||||
initial_z = 0.2
|
||||
max_volumetric = 10
|
||||
centre_point = fc.Point( x = centre_x, y = centre_y, z = 0 )
|
||||
|
||||
band_height = 12
|
||||
band_inner_radius = 95
|
||||
band_max_thickness = 2.5
|
||||
band_min_thickness = 1.75
|
||||
band_profile_side_radius = 25
|
||||
start_angle = 0
|
||||
|
||||
loop_segments = 100
|
||||
spiral_loops = ((band_height - initial_z) / layer_height) + 2
|
||||
spiral_segments = math.floor(spiral_loops * loop_segments)
|
||||
print(f"Loops: {spiral_loops} Segments: {spiral_segments}")
|
||||
|
||||
def extrusion_width_at_height(z_pos):
|
||||
z_offset = z_pos - (band_height / 2)
|
||||
extrusion_width = band_max_thickness + math.sqrt((band_profile_side_radius ** 2) - (z_offset ** 2)) - band_profile_side_radius
|
||||
return extrusion_width
|
||||
|
||||
def skirt():
|
||||
prime_radius = band_inner_radius - 5
|
||||
prime_loops = 2
|
||||
prime_segments = prime_loops * 50
|
||||
skirt = fc.spiralXY(centre_point, prime_radius - 5, prime_radius, start_angle, prime_loops, prime_segments)
|
||||
skirt.append(fc.Extruder(on=False))
|
||||
skirt.append(fc.PrinterCommand(id='retract'))
|
||||
return skirt
|
||||
|
||||
base_e_width = extrusion_width_at_height(initial_z)
|
||||
spiral = fc.spiralXY(centre_point, band_inner_radius, band_inner_radius, start_angle, spiral_loops, spiral_segments)
|
||||
|
||||
first_slope_starts = loop_segments
|
||||
first_slope_ends = 2 * loop_segments
|
||||
last_slope_starts = len(spiral) - 2 * loop_segments
|
||||
last_slope_ends = len(spiral) - loop_segments
|
||||
z_height_per_segment = layer_height / loop_segments
|
||||
|
||||
spiral_steps = [fc.Extruder(on=True)]
|
||||
z_position = 100
|
||||
|
||||
for i in range(len(spiral)):
|
||||
plot = False
|
||||
|
||||
# first layer
|
||||
if i < first_slope_starts:
|
||||
e_height = initial_z
|
||||
z_position = initial_z
|
||||
print("Initial ", end='')
|
||||
plot = True
|
||||
|
||||
# bottom slope
|
||||
elif i < first_slope_ends:
|
||||
e_height = z_height_per_segment * (i - first_slope_starts + 1)
|
||||
z_position += z_height_per_segment
|
||||
print("Bottom Slope ", end='')
|
||||
plot = True
|
||||
|
||||
# Normal Spiral
|
||||
elif i < last_slope_starts:
|
||||
e_height = layer_height
|
||||
z_position += z_height_per_segment
|
||||
print("Spiral ", end='')
|
||||
plot = True
|
||||
|
||||
# top slope
|
||||
elif i < last_slope_ends:
|
||||
e_height = (last_slope_ends - i) * z_height_per_segment
|
||||
print("Top Slope ", end='')
|
||||
plot = True
|
||||
|
||||
# top layer
|
||||
else:
|
||||
z_position = band_height
|
||||
e_height = layer_height
|
||||
print("Top ", end='')
|
||||
plot = True
|
||||
|
||||
e_width = extrusion_width_at_height(z_position)
|
||||
radial_offset = e_width / 2
|
||||
print(f"z_position: {z_position} e_height: {e_height} e_width: {e_width}")
|
||||
speed = min(( max_volumetric / e_height / e_width * 60 ), max_print_speed )
|
||||
# if debug: print(f"Speed: {speed}")
|
||||
if plot:
|
||||
spiral_steps.append(fc.Printer(print_speed = speed))
|
||||
spiral_steps.append(fc.ExtrusionGeometry(area_model = 'rectangle', width = e_width, height = e_height))
|
||||
spiral_steps.append(fc.move(fc.move_polar(spiral[i], centre_point, radial_offset, 0), fc.Vector(z = z_position)))
|
||||
|
||||
steps = skirt() + spiral_steps
|
||||
|
||||
# preview the design
|
||||
fc.transform(steps, 'plot', fc.PlotControls(
|
||||
style='tube',
|
||||
tube_type='cylinders',
|
||||
initialization_data = {
|
||||
'extrusion_width': nozzle_diameter,
|
||||
'extrusion_height': layer_height,
|
||||
'neat_for_publishing': True
|
||||
},
|
||||
zoom=0.7))
|
||||
|
||||
# generate and save gcode
|
||||
gcode_controls = fc.GcodeControls(
|
||||
printer_name = printer_name,
|
||||
initialization_data = {
|
||||
'primer': 'travel',
|
||||
'print_speed': print_speed,
|
||||
'fan_percent': fan_percent,
|
||||
'extrusion_width': nozzle_diameter * 0.8,
|
||||
'extrusion_height': layer_height
|
||||
}
|
||||
)
|
||||
|
||||
steps.append(fc.ManualGcode(text="M0 ; stop"))
|
||||
|
||||
gcode = fc.transform(steps, 'gcode', gcode_controls)
|
||||
open(f'{design_name}.gcode', 'w').write(gcode)
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue