save state of SpeedControl widget
24 Sep 2018 21:21 - 24 Sep 2018 21:28 #117936
by Grotius
Replied by Grotius on topic save state of SpeedControl widget
@Hi Giorgio,
xemc.cc code i will look at, interesting.
For me excel files are perfect for data saving and loading in the gui.
I asked a customer to make his own data sheet for his standard product's and pass it to me to integrate in the code.
Then the machine gui load's the data and can make the product with variable g-code easely. I do this without
G41 and G42, this is a horrible option. The lead in suck's always. A cleaner option is to write the tool offset's yourself
in formula methode.
The mill gui is saved today on my git channel : github.com/michelwijnja/Linuxcnc_inox_doors
Later this week the customer has responced his excel sheet, and then you can see the excel load and save system on the git when the gui is uploaded for next saving..
The excel save and load way makes life easer.
This is how i did my first saving's and loading's in excel.
import xlsxwriter
from openpyxl import load_workbook
def on_write_excel_file_pressed(self, widget, data=None):
print "writing excel file"
x = self.widgets.entry_excel.get_text()
# Create an new Excel file and add a worksheet.
#workbook = xlsxwriter.Workbook('plasma_tools.xlsx')
workbook = xlsxwriter.Workbook(x)
worksheet = workbook.add_worksheet('Tab_1')
# Widen the first column to make the text clearer.
worksheet.set_column('A:A', 20)
# Add a bold format to use to highlight cells.
bold = workbook.add_format({'bold': True})
# Write some simple text.
worksheet.write('A1', 'Block Tool Settings', bold)
worksheet.write('A2', 'Travelheight')
worksheet.write('B2', self.widgets.Travelheight.get_value())
worksheet.write('A3', 'Pierceheight')
worksheet.write('B3', self.widgets.Pierceheight.get_value())
worksheet.write('A4', 'Cutheight')
worksheet.write('B4', self.widgets.Cutheight.get_value())
worksheet.write('A5', 'Probe Switch Offset')
worksheet.write('B5', self.widgets.Probe_switch_offset.get_value())
worksheet.write('A6', 'Probe Search Limit')
worksheet.write('B6', self.widgets.Probe_search_limit.get_value())
worksheet.write('A7', 'Cutheight')
worksheet.write('B7', self.widgets.Cutheight.get_value())
worksheet.write('A9', 'Block Time settings', bold)
worksheet.write('A10', 'Restart Time Back')
worksheet.write('B10', self.widgets.Restart_time_back.get_value())
worksheet.write('A11', 'Anti Dive Delay')
worksheet.write('B11', self.widgets.Anti_dive_delay.get_value())
worksheet.write('A12', 'Pierce Delay')
worksheet.write('B12', self.widgets.Pierce_delay.get_value())
worksheet.write('A13', 'Auto Restart Times')
worksheet.write('B13', self.widgets.Auto_restart_times.get_value())
worksheet.write('A15', 'Block Probe Over Distance', bold)
worksheet.write('A16', 'X Offset')
worksheet.write('B16', self.widgets.Dist_x.get_value())
worksheet.write('A17', 'Y Offset')
worksheet.write('B17', self.widgets.Dist_y.get_value())
worksheet.write('A19', 'Block Z Axis', bold)
worksheet.write('A20', 'Max Speed')
worksheet.write('B20', self.widgets.Max_z_speed.get_value())
worksheet.write('A21', 'Max Acceleration')
worksheet.write('B21', self.widgets.Max_z_acceleration.get_value())
worksheet.write('A22', 'Piercespeed')
worksheet.write('B22', self.widgets.Piercespeed.get_value())
worksheet.write('A23', 'Probespeed')
worksheet.write('B23', self.widgets.Probespeed.get_value())
worksheet.write('A25', 'Block Mesa', bold)
worksheet.write('A26', 'Cut Chart Voltage')
worksheet.write('B26', self.widgets.Cut_chart_voltage.get_value())
worksheet.write('A28', 'Block Enable', bold)
worksheet.write('A29', 'Enable')
worksheet.write('B29', self.widgets.Enable.get_state())
worksheet.write('A30', 'Parort')
worksheet.write('B30', self.widgets.Parport.get_state())
worksheet.write('A31', 'Mesa')
worksheet.write('B31', self.widgets.Mesa.get_state())
worksheet.write('A33', 'Block Test', bold)
worksheet.write('A34', 'Test')
worksheet.write('B34', 1025)
worksheet.write('B35', 2)
worksheet.write_formula('B36', '=SUM(1, 2, 3)')
# Write some numbers, with row/column notation.
#worksheet.write(2, 1, 123)
#worksheet.write(3, 1, 123.456)
workbook.close()
def on_load_excel_file_pressed(self, widget, data=None):
print "load excel file"
x = self.widgets.entry_excel.get_text()
#wb = load_workbook(filename = 'plasma_tools.xlsx')
wb = load_workbook(filename = x)
sheet_ranges = wb
x = float(sheet_ranges.value)
self.widgets.Travelheight.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Pierceheight.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Cutheight.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Probe_switch_offset.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Probe_search_limit.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Cutheight.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Restart_time_back.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Anti_dive_delay.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Pierce_delay.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Auto_restart_times.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Dist_x.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Dist_y.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Max_z_speed.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Max_z_acceleration.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Piercespeed.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Probespeed.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Cut_chart_voltage.set_value(x)
# integers used for bitwise 0 or 1 :
x = int(sheet_ranges.value)
self.widgets.Enable.set_state(x)
x = int(sheet_ranges.value)
self.widgets.Parport.set_state(x)
x = int(sheet_ranges.value)
self.widgets.Mesa.set_state(x)
Is she hot?
xemc.cc code i will look at, interesting.
For me excel files are perfect for data saving and loading in the gui.
I asked a customer to make his own data sheet for his standard product's and pass it to me to integrate in the code.
Then the machine gui load's the data and can make the product with variable g-code easely. I do this without
G41 and G42, this is a horrible option. The lead in suck's always. A cleaner option is to write the tool offset's yourself
in formula methode.
The mill gui is saved today on my git channel : github.com/michelwijnja/Linuxcnc_inox_doors
Later this week the customer has responced his excel sheet, and then you can see the excel load and save system on the git when the gui is uploaded for next saving..
The excel save and load way makes life easer.
This is how i did my first saving's and loading's in excel.
Warning: Spoiler!
import xlsxwriter
from openpyxl import load_workbook
def on_write_excel_file_pressed(self, widget, data=None):
print "writing excel file"
x = self.widgets.entry_excel.get_text()
# Create an new Excel file and add a worksheet.
#workbook = xlsxwriter.Workbook('plasma_tools.xlsx')
workbook = xlsxwriter.Workbook(x)
worksheet = workbook.add_worksheet('Tab_1')
# Widen the first column to make the text clearer.
worksheet.set_column('A:A', 20)
# Add a bold format to use to highlight cells.
bold = workbook.add_format({'bold': True})
# Write some simple text.
worksheet.write('A1', 'Block Tool Settings', bold)
worksheet.write('A2', 'Travelheight')
worksheet.write('B2', self.widgets.Travelheight.get_value())
worksheet.write('A3', 'Pierceheight')
worksheet.write('B3', self.widgets.Pierceheight.get_value())
worksheet.write('A4', 'Cutheight')
worksheet.write('B4', self.widgets.Cutheight.get_value())
worksheet.write('A5', 'Probe Switch Offset')
worksheet.write('B5', self.widgets.Probe_switch_offset.get_value())
worksheet.write('A6', 'Probe Search Limit')
worksheet.write('B6', self.widgets.Probe_search_limit.get_value())
worksheet.write('A7', 'Cutheight')
worksheet.write('B7', self.widgets.Cutheight.get_value())
worksheet.write('A9', 'Block Time settings', bold)
worksheet.write('A10', 'Restart Time Back')
worksheet.write('B10', self.widgets.Restart_time_back.get_value())
worksheet.write('A11', 'Anti Dive Delay')
worksheet.write('B11', self.widgets.Anti_dive_delay.get_value())
worksheet.write('A12', 'Pierce Delay')
worksheet.write('B12', self.widgets.Pierce_delay.get_value())
worksheet.write('A13', 'Auto Restart Times')
worksheet.write('B13', self.widgets.Auto_restart_times.get_value())
worksheet.write('A15', 'Block Probe Over Distance', bold)
worksheet.write('A16', 'X Offset')
worksheet.write('B16', self.widgets.Dist_x.get_value())
worksheet.write('A17', 'Y Offset')
worksheet.write('B17', self.widgets.Dist_y.get_value())
worksheet.write('A19', 'Block Z Axis', bold)
worksheet.write('A20', 'Max Speed')
worksheet.write('B20', self.widgets.Max_z_speed.get_value())
worksheet.write('A21', 'Max Acceleration')
worksheet.write('B21', self.widgets.Max_z_acceleration.get_value())
worksheet.write('A22', 'Piercespeed')
worksheet.write('B22', self.widgets.Piercespeed.get_value())
worksheet.write('A23', 'Probespeed')
worksheet.write('B23', self.widgets.Probespeed.get_value())
worksheet.write('A25', 'Block Mesa', bold)
worksheet.write('A26', 'Cut Chart Voltage')
worksheet.write('B26', self.widgets.Cut_chart_voltage.get_value())
worksheet.write('A28', 'Block Enable', bold)
worksheet.write('A29', 'Enable')
worksheet.write('B29', self.widgets.Enable.get_state())
worksheet.write('A30', 'Parort')
worksheet.write('B30', self.widgets.Parport.get_state())
worksheet.write('A31', 'Mesa')
worksheet.write('B31', self.widgets.Mesa.get_state())
worksheet.write('A33', 'Block Test', bold)
worksheet.write('A34', 'Test')
worksheet.write('B34', 1025)
worksheet.write('B35', 2)
worksheet.write_formula('B36', '=SUM(1, 2, 3)')
# Write some numbers, with row/column notation.
#worksheet.write(2, 1, 123)
#worksheet.write(3, 1, 123.456)
workbook.close()
def on_load_excel_file_pressed(self, widget, data=None):
print "load excel file"
x = self.widgets.entry_excel.get_text()
#wb = load_workbook(filename = 'plasma_tools.xlsx')
wb = load_workbook(filename = x)
sheet_ranges = wb
x = float(sheet_ranges.value)
self.widgets.Travelheight.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Pierceheight.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Cutheight.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Probe_switch_offset.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Probe_search_limit.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Cutheight.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Restart_time_back.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Anti_dive_delay.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Pierce_delay.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Auto_restart_times.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Dist_x.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Dist_y.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Max_z_speed.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Max_z_acceleration.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Piercespeed.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Probespeed.set_value(x)
x = float(sheet_ranges.value)
self.widgets.Cut_chart_voltage.set_value(x)
# integers used for bitwise 0 or 1 :
x = int(sheet_ranges.value)
self.widgets.Enable.set_state(x)
x = int(sheet_ranges.value)
self.widgets.Parport.set_state(x)
x = int(sheet_ranges.value)
self.widgets.Mesa.set_state(x)
i think i need to hear some new trik.
Is she hot?
Last edit: 24 Sep 2018 21:28 by Grotius.
Please Log in or Create an account to join the conversation.
Moderators: HansU
Time to create page: 0.096 seconds