- Posts: 44
- Thank you received: 0
G Code Syntax Check (Python + Qt Designer)
- Hossein74Majidi
- Topic Author
- Offline
- Senior Member
-
Less
More
1 year 10 months ago #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:
Code:
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.
Please Log in to join the conversation.
1 year 10 months ago #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 to join the conversation.
- Hossein74Majidi
- Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 44
- Thank you received: 0
1 year 10 months ago #317139
by Hossein74Majidi
I studied the link you've provided but it was so complicated. I didnt get it well
Replied by Hossein74Majidi on topic G Code Syntax Check (Python + Qt Designer)
Thanks for your reply, I dont wanna use graphic display. I simply just want to know if I select a file from a file browser for example, or even a list of gcode files, it returns me an error with some details about the gcode syntax error in that fileIf 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
I studied the link you've provided but it was so complicated. I didnt get it well
Please Log in to join the conversation.
Time to create page: 0.096 seconds
