|
|
|
|
|
|
|
|
import streamlit as st |
|
|
from python_gcode_checker import run_checks |
|
|
from settings_report_details import generate_detailed_report |
|
|
|
|
|
|
|
|
st.title("G-code Programming Assistant (v0.1)") |
|
|
|
|
|
st.markdown(""" |
|
|
Welcome to the G-code Assistant! This tool is solely for educational purposes, helping you verify and analyze your G-code for potential errors and warnings before actually running it on your machine. |
|
|
|
|
|
**Note:** This tool is limited to simple carving operations on a CNC milling machine. |
|
|
|
|
|
This is a beta version, and you're free to use it for checking your G-codes. If you encounter any issues or unexpected behavior, please contact the developer at **nico.aspra@bicol-u.edu.ph**. |
|
|
""") |
|
|
|
|
|
|
|
|
depth_max = st.number_input("Maximum Depth of Cut", min_value=0.0, value=0.1, step=0.1, format="%.1f") |
|
|
|
|
|
|
|
|
gcode_input = st.text_area("Input G-code", height=300, placeholder="Enter G-code here...") |
|
|
|
|
|
|
|
|
if st.button("Analyze G-code"): |
|
|
|
|
|
errors, warnings = run_checks(gcode_input, depth_max) |
|
|
config_report = generate_detailed_report(gcode_input) |
|
|
|
|
|
|
|
|
st.subheader("Analysis Results") |
|
|
|
|
|
|
|
|
if errors: |
|
|
st.error(f"Errors: {len(errors)}\n" + "\n".join(f"Line {line}: {msg}" for line, msg in errors)) |
|
|
else: |
|
|
st.success("No errors found.") |
|
|
|
|
|
if warnings: |
|
|
st.warning(f"Warnings: {len(warnings)}\n" + "\n".join(f"Line {line}: {msg}" for line, msg in warnings)) |
|
|
else: |
|
|
st.info("No warnings found.") |
|
|
|
|
|
|
|
|
st.subheader("Configuration Settings") |
|
|
st.text(config_report) |
|
|
|
|
|
|
|
|
st.markdown("---") |
|
|
st.markdown("Developed by **Aspra, N.**") |