G Code Syntax Check (Python + Qt Designer)
- Hossein74Majidi
- Offline
- Senior Member
Less
More
- Posts: 43
- Thank you received: 0
21 Dec 2024 12:01 - 21 Dec 2024 12:05 #317083
by Hossein74Majidi
G Code Syntax Check (Python + Qt Designer) was created by Hossein74Majidi
Hi
I'm going to use Qt Designer for my Display.
In my python handler I have a method as following:
this method loads the g code file content into a QTextEdit Widget named " showGCode" now before self.command.reset_interpreter() command and self.command.program_open(file_path) which load the G Code into linuxcnc, I want to check the gcode file syntax. How can I do it? How do I know if my G Code file is ok.
I'm going to use Qt Designer for my Display.
In my python handler I have a method as following:
def load_selected_gcode(self):
if self.modenumber_str != "Auto":
self.show_message("Invalid Mode", "Switch to Auto Mode.",0)
return
index = self.w.listGCodeFiles.currentIndex()
file_name = self.model.data(index, QtCore.Qt.DisplayRole)
file_path = os.path.join(self.gcode_directory, file_name)
self.loaded_gcod = file_path
with open(file_path, 'r') as file:
gcode_content = file.read()
self.w.showGCode.setText(gcode_content)
self.command.reset_interpreter()
self.command.program_open(file_path)
self.show_message("Success", "G Code is loaded successfully", 1)
this method loads the g code file content into a QTextEdit Widget named " showGCode" now before self.command.reset_interpreter() command and self.command.program_open(file_path) which load the G Code into linuxcnc, I want to check the gcode file syntax. How can I do it? How do I know if my G Code file is ok.
Last edit: 21 Dec 2024 12:05 by Hossein74Majidi.
Please Log in or Create an account to join the conversation.
- cmorley
- Away
- Moderator
Less
More
- Posts: 7771
- Thank you received: 2055
21 Dec 2024 17:23 #317096
by cmorley
Replied by cmorley on topic G Code Syntax Check (Python + Qt Designer)
If you use a graphic display , the file is checked each time it is loaded.
Look here how that is actually done:
github.com/LinuxCNC/linuxcnc/blob/master...qt5_graphics.py#L350
Look here how that is actually done:
github.com/LinuxCNC/linuxcnc/blob/master...qt5_graphics.py#L350
Please Log in or Create an account to join the conversation.
Moderators: cmorley
Time to create page: 0.049 seconds