Read value or file in G-code
- Doc_emmet
- Away
- New Member
-
Less
More
- Posts: 17
- Thank you received: 2
02 Jul 2025 18:58 - 02 Jul 2025 19:01 #331118
by Doc_emmet
Read value or file in G-code was created by Doc_emmet
Hello, I want to use QtDragon to determine the tool height using Utils - Workpiece and then save the result so that I can access the value in the G-code. My idea was to save the result to a file, which also works by slightly modifying the auto_height.py file. I added the following line:
def show_result(self, data):
diff = float(data) - float(data)
self.lineEdit_height.setText(format(diff, '.3f'))
# New line by me:
with open('/home/dg/linuxcnc/nc_files/probe_height.txt', 'w') as f: f.write(str(diff))
But how can I access the value stored in the probe_height file in a measurement routine.ngc, or can I save the measured value directly in
the G-coder as a variable, e.g., #5000
def show_result(self, data):
diff = float(data) - float(data)
self.lineEdit_height.setText(format(diff, '.3f'))
# New line by me:
with open('/home/dg/linuxcnc/nc_files/probe_height.txt', 'w') as f: f.write(str(diff))
But how can I access the value stored in the probe_height file in a measurement routine.ngc, or can I save the measured value directly in
the G-coder as a variable, e.g., #5000
Last edit: 02 Jul 2025 19:01 by Doc_emmet.
Please Log in or Create an account to join the conversation.
Time to create page: 0.178 seconds