maj
This commit is contained in:
@@ -2,6 +2,8 @@ from flask import Flask, render_template, request
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from streamer import stream_gcode
|
from streamer import stream_gcode
|
||||||
|
from text_to_gcode import convert_text
|
||||||
|
|
||||||
import svgToGcode
|
import svgToGcode
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
@@ -71,9 +73,8 @@ def getGcode():
|
|||||||
def getText():
|
def getText():
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
txt = request.form["txt"].strip()
|
txt = request.form["txt"].strip()
|
||||||
|
print(txt)
|
||||||
if txt:
|
if txt:
|
||||||
# Découpe le texte en lignes de 20 caractères max
|
|
||||||
formatted_text = ""
|
formatted_text = ""
|
||||||
current_line = ""
|
current_line = ""
|
||||||
for word in txt.split():
|
for word in txt.split():
|
||||||
@@ -87,10 +88,19 @@ def getText():
|
|||||||
if current_line.strip():
|
if current_line.strip():
|
||||||
formatted_text += current_line.strip()
|
formatted_text += current_line.strip()
|
||||||
|
|
||||||
print("Original text:", txt)
|
|
||||||
print("Formatted text with line breaks:")
|
print("Formatted text with line breaks:")
|
||||||
print(formatted_text)
|
print(formatted_text)
|
||||||
|
|
||||||
|
gcode_output = convert_text(formatted_text)
|
||||||
|
print("G-code generated:")
|
||||||
|
print(gcode_output)
|
||||||
|
|
||||||
|
gcode_filename = "retourligne.gcode"
|
||||||
|
with open(gcode_filename, "w") as gcode_file:
|
||||||
|
gcode_file.write(gcode_output)
|
||||||
|
|
||||||
|
print(f"G-code saved to {gcode_filename}")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print('empty text')
|
print('empty text')
|
||||||
return render_template("form.html")
|
return render_template("form.html")
|
||||||
|
|||||||
1783
plotter-app/retourligne.gcode
Normal file
1783
plotter-app/retourligne.gcode
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user