<jupyter_start><jupyter_text>Inkscape G-Code Laser Numpy  Test Setup  Code:<jupyter_code>%matplotlib inline
cnc = GRBL.GRBL(port="/dev/cnc_3018")
cnc.laser_mode = 1

def init():
    program = GCode.GCode()
    program.G0(F=500)
    program.G1(F=300)
    program.M3(S=1)
    program.G28()
    program.G21()  # Metric Units
    program.G90()  # Absolute positioning.
    program.G92(X=0, Y=0)
    return program

print(cnc.laser_mode)

cnc.status

cnc.run("G28")

X = np.arange(0, 255.8, 0.01)

f = (3 * 2 * np.pi) / X[-1]

A = 25
Y = A * np.sin(X * f) + 89 / 2

plt.plot(X, Y)

x

y

prog = GCode.GCode()
prog.G28()
prog.G0(X=X[0], Y=Y[0])

prog.M4(S=250)
for x, y in zip(X, Y):
    prog.G1(X=np.round(x, 4), Y=np.round(y, 4), F=300)
prog.M5()
prog.G28()

prog

cnc.run(prog)

X = np.arange(10, 250, 0.1)
cycles = 3
f = (cycles * 2 * np.pi) / (X[-1] - X[0])

A = 10
Y = A * np.sin((X - X[0]) * f) + 89 / 2
_ = plt.plot(X, Y)

prog = GCode.GCode()
prog.G28()
prog.G0(X=X[0], Y=Y[0])

prog.M4(S=255)
for x, y in zip(X, Y):
    prog.G1(X=np.round(x, 4), Y=np.round(y, 4), F=400)
prog.M5()
prog.G28()

cnc.run(prog)

X = np.arange(10, 250, 1)
cycles = 2
f = (cycles * 2 * np.pi) / (X[-1] - X[0])

A = 20
Y = A * np.sin((X - X[0]) * f) + 89 / 2
_ = plt.plot(X, Y)

prog = GCode.GCode()
prog.G28()
prog.G0(X=X[0], Y=Y[0])

prog.M4(S=255)
for x, y in zip(X, Y):
    prog.G1(X=np.round(x, 4), Y=np.round(y, 4), F=400)
prog.M5()
prog.G28()

cnc.run(prog)

X = np.arange(10, 250, 1)
cycles = 1
f = (cycles * 2 * np.pi) / (X[-1] - X[0])

A = 30
Y = A * np.sin((X - X[0]) * f) + 89 / 2
_ = plt.plot(X, Y)

prog = GCode.GCode()
prog.G28()
prog.G0(X=X[0], Y=Y[0])

prog.M4(S=255)
for x, y in zip(X, Y):
    prog.G1(X=np.round(x, 4), Y=np.round(y, 4), F=400)
prog.M5()
prog.G28()

cnc.run(prog)

sys.path.append(os.path.abspath(".."))

utils.picture()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.23806970509383377, 'fraction_numerical': 0.08793565683646112, 'mean_word_length': 3.038961038961039, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '368774', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1126, 'n_tokens_neox': 995, 'n_words': 206, 'path': 'DevelopmentSandbox/LaserNumpy-Copy1.ipynb', 'repo_name': 'jed-frey/python_cnc3018', 'size': '1865'}