changed gcode generation, so it raises the pen between each letter
This commit is contained in:
@@ -4,7 +4,7 @@ from Gcode_generator import Machine
|
||||
from HersheyFonts import HersheyFonts
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
machine_type = Machine.LASER
|
||||
machine_type = Machine.THREEAXIS
|
||||
|
||||
# Create an instance of the Gcode class
|
||||
gcode = Gcode(
|
||||
@@ -12,15 +12,32 @@ gcode = Gcode(
|
||||
mm_per_px=0.1, # Conversion factor: mm per pixel
|
||||
speed=1000, # Speed in mm/min
|
||||
machine=machine_type,
|
||||
max_s=255 # Laser power (only for LASER machines)
|
||||
max_s=255, # Laser power (only for LASER machines)
|
||||
safe_z= 5,
|
||||
work_z= 0
|
||||
)
|
||||
|
||||
|
||||
thefont = HersheyFonts()
|
||||
thefont.load_default_font()
|
||||
thefont.normalize_rendering(100)
|
||||
for (x1, y1), (x2, y2) in thefont.lines_for_text('Wallter is a wall plotter'):
|
||||
gcode.draw_line(x1, y1 ,x2 ,y2)
|
||||
|
||||
text_lines = thefont.lines_for_text('Wallter is a wall plotter')
|
||||
|
||||
# print(next(text_lines)[0])
|
||||
# first_point = next(text_lines)[0]
|
||||
# gcode.go_to(first_point[0], first_point[1])
|
||||
|
||||
last_p2 = (0,0)
|
||||
for (x1, y1), (x2, y2) in text_lines:
|
||||
if((x1, y1) == last_p2):
|
||||
gcode.write_to(x2 ,y2)
|
||||
else:
|
||||
gcode.draw_line(x1, y1, x2, y2)
|
||||
|
||||
last_p2 = (x2,y2)
|
||||
|
||||
|
||||
|
||||
# Draw a line from (10, 20) to (30, 40)
|
||||
# gcode.draw_line(10, 20, 30, 40)
|
||||
@@ -29,4 +46,4 @@ for (x1, y1), (x2, y2) in thefont.lines_for_text('Wallter is a wall plotter'):
|
||||
# Finish the G-code file
|
||||
gcode.end_gcode()
|
||||
|
||||
print("G-code file generated: example.gcode")
|
||||
print("G-code file generated: test_gcode.gcode")
|
||||
Reference in New Issue
Block a user