Setup Sheet as Embedded Tab
22 Jun 2024 08:21 #303539
by Wischi
Setup Sheet as Embedded Tab was created by Wischi
Hello,
I found this neat little feature for qtpyvcp that displays a html setup sheet from CAM as a tab in the gui. Would this be possible in gmoccapy using the embedded tab or the User tab? How could it be done? Sadly I don't have any experience with glade or python yet. Maybe this would be a good project to get into it?
forum.linuxcnc.org/qtpyvcp/38792-display-setup-sheet
Thanks
I found this neat little feature for qtpyvcp that displays a html setup sheet from CAM as a tab in the gui. Would this be possible in gmoccapy using the embedded tab or the User tab? How could it be done? Sadly I don't have any experience with glade or python yet. Maybe this would be a good project to get into it?
forum.linuxcnc.org/qtpyvcp/38792-display-setup-sheet
Thanks
Please Log in or Create an account to join the conversation.
22 Jun 2024 08:29 #303540
by pippin88
Replied by pippin88 on topic Setup Sheet as Embedded Tab
A setup sheet display is a great idea.
Years ago I modified gmoccapy to have:
A Gcode manual tab
Active GCodes named - e.g G64 showed as "G64 Path Blending" or G61 showed as "G61 Exact Stop"
But I couldn't keep up with gmocappy updates (gcode naming changed the gmocappy main page, was not just a tab) so gave up on my mods.
Years ago I modified gmoccapy to have:
A Gcode manual tab
Active GCodes named - e.g G64 showed as "G64 Path Blending" or G61 showed as "G61 Exact Stop"
But I couldn't keep up with gmocappy updates (gcode naming changed the gmocappy main page, was not just a tab) so gave up on my mods.
Please Log in or Create an account to join the conversation.
22 Jun 2024 08:40 #303541
by Wischi
Replied by Wischi on topic Setup Sheet as Embedded Tab
This would also be nice. Reminds me of the Siemens 840 where there is a 'i" icon in the corner and when you click on it you get a whole gcode manual with descriptions.
Also showing a list of installed ocode macros could be useful.
Also showing a list of installed ocode macros could be useful.
Please Log in or Create an account to join the conversation.
22 Jun 2024 09:00 #303542
by HansU
Replied by HansU on topic Setup Sheet as Embedded Tab
@Wischi so basically a tab that shows a HTML page? Should be a big thing. The question is only where to define the path.
When was that? (On which gmoccapy version switch you gave up?)
Maybe I can help you if you have the old code and can post it here.
A setup sheet display is a great idea.
But I couldn't keep up with gmocappy updates (gcode naming changed the gmocappy main page, was not just a tab) so gave up on my mods.
When was that? (On which gmoccapy version switch you gave up?)
Maybe I can help you if you have the old code and can post it here.
Please Log in or Create an account to join the conversation.
22 Jun 2024 09:34 #303545
by Wischi
Replied by Wischi on topic Setup Sheet as Embedded Tab
@HansU
Yes.
Or maybe also pdf to be more compatible with other CAM software? Fusion 360 outputs html
The qtpyvcp Version looks for a .html file with the same Name as the loaded .ngc file
Yes.
Or maybe also pdf to be more compatible with other CAM software? Fusion 360 outputs html
The qtpyvcp Version looks for a .html file with the same Name as the loaded .ngc file
Please Log in or Create an account to join the conversation.
22 Jun 2024 12:23 #303550
by pippin88
June 2016 looks like
My gmoccapy.py changes:
I have no memory of how I got to this solution - may have been help from someone here (I know zero python).
Replied by pippin88 on topic Setup Sheet as Embedded Tab
[/quote]When was that? (On which gmoccapy version switch you gave up?)
Maybe I can help you if you have the old code and can post it here.
June 2016 looks like
My gmoccapy.py changes:
def _update_active_gcodes( self ):
# active G codes
active_codes = []
temp = []
for code in sorted( self.stat.gcodes[1:] ):
if code == -1:
continue
if code % 10 == 0:
temp.append( "%d" % ( code / 10 ) )
else:
temp.append( "%d.%d" % ( code / 10, code % 10 ) )
for num, code in enumerate( temp ):
if num == 8:
active_codes.append( "\n" )
active_codes.append( "G" + code )
self.active_gcodes = active_codes
self.gcodes = self.stat.gcodes
self.widgets.active_gcodes_label.set_label( " ".join( self.active_gcodes ) )
# replace active G codes with explanation, e.g. G8 changes to G8 = Radius Mode
def _expand_active_gcodes(self):
# define our method
def replace_all(text, dic):
for i, j in dic.iteritems():
text = text.replace(i, j)
return text
active_codes = []
temp = []
for code in sorted(self.stat.gcodes[1:]):
if code == -1:
continue
if code % 10 == 0:
temp.append("%d" % (code / 10))
else:
temp.append("%d.%d" % (code / 10, code % 10))
for num, code in enumerate(temp):
active_codes.append("G" + code + " ")
self.active_gcodes = active_codes
self.gcodes = self.stat.gcodes
#change the list into a string so we can replace
active_codes = " ".join(self.active_gcodes)
# our text the replacement will take place
gcode_exp = active_codes
# our dictionary with our key:values.
reps = {'G1 ':'\nG1 = Coordinated motion ("Straight feed")',
'G4 ':'\nG4 = Dwell (no motion for P seconds)',
'G7 ':'\nG7 = Diameter Mode',
'G8 ':'\nG8 = Radius Mode',
'G17 ':'\nG17 = Select XY plane',
'G18 ':'\nG18 = Select XZ plane',
'G19 ':'\nG19 = Select YZ plane',
'G20 ':'\nG20 = Inches',
'G21 ':'\nG21 = Millimeters',
'G33 ':'\nG33 = Spindle-synchronized motion',
'G33.1 ':'\nG33.1 = Rigid tapping',
'G40 ':'\nG40 = Cancel cutter radius compensation',
'G49 ':'\nG49 = Cancel tool length offset',
'G53 ':'\nG53 = Motion in machine coordinate system',
'G54 ':'\nG54 = select coordinate system 1',
'G55 ':'\nG55 = select coordinate system 2',
'G56 ':'\nG56 = select coordinate system 3',
'G57 ':'\nG57 = select coordinate system 4',
'G58 ':'\nG58 = select coordinate system 5',
'G59 ':'\nG59 = select coordinate system 6',
'G59.1 ':'\nG59.1 = select coordinate system 7',
'G59.2 ':'\nG59.2 = select coordinate system 8',
'G59.3 ':'\nG59.3 = select coordinate system 9',
'G61 ':'\nG61 = Exact Path mode',
'G61.1 ':'\nG61.1 = Exact Stop mode',
'G64 ':'\nG64 = Continuous mode with optional path tolerance',
'G80 ':'\nG80 = Cancel motion mode',
'G90 ':'\nG90 = Absolute distance mode',
'G91 ':'\nG91 = Incremental distance mode',
'G90.1 ':'\nG90.1 = Arc centers I,J,K are absolute',
'G91.1 ':'\nG91.1 = Arc centers I,J,K are relative to the arc\'s starting point',
'G94 ':'\nG94 = Units per minute feed rate',
'G95 ':'\nG95 = Units per revolution',
'G96 ':'\nG96 = CSS mode (Constant Surface Speed)',
'G97 ':'\nG97 = RPM mode',
'G98 ':'\nG98 = Retract to prior position',
'G99 ':'\nG99 = Retract to R position'
}
# bind the returned text of the method
# to a variable and print it
txt = replace_all(gcode_exp, reps)
self.widgets.active_gcodes_exp.set_label("".join(txt))
# replace active M codes with explanation, e.g. M1 changes to M1 = Optional Pause
def _expand_active_mcodes(self):
# define our method
def replace_all(text, dic):
for i, j in dic.iteritems():
text = text.replace(i, j)
return text
# M codes
active_codes = []
temp = []
for code in sorted(self.stat.mcodes[1:]):
if code == -1:
continue
temp.append("%d" % code)
for code in (temp):
active_codes.append("M" + code + " ")
self.active_mcodes = active_codes
self.mcodes = self.stat.mcodes
#change the list into a string so we can replace
active_codes = " ".join(self.active_mcodes)
# our text the replacement will take place
mcode_exp = active_codes
# our dictionary with our key:values.
reps = {'M0 ':'\nM0 = Program Pause',
'M1 ':'\nM1 = Optional Pause',
'M2 ':'\nM2 = End Program',
'M3 ':'\nM3 = Turn spindle clockwise',
'M4 ':'\nM4 = Turn spindle counterclockwise',
'M5 ':'\nM5 = Stop spindle',
'M7 ':'\nM7 = Turn mist on',
'M8 ':'\nM8 = Turn flood on',
'M9 ':'\nM9 = Turn all coolant off',
'M19 ':'\nM19 = Orient spindle',
'M30 ':'\nM30 = End Program',
'M48 ':'\nM48 = Enable spindle and feed rate override controls',
'M49 ':'\nM49 = Disbale spindle and feed rate override controls',
'M50 ':'\nM50 = Feed Override Control (P0 = off, P1 = on)',
'M51 ':'\nM51 = Spindle Speed Override Control (P0 = off, P1 = on)',
'M52 ':'\nM52 = Adaptive Feed Control (P0 = off, P1 = on)',
'M53 ':'\nM53 = Feed Stop Control (P0 = off, P1 = on)',
'M60 ':'\nM60 = Pallet Change Pause'
}
# bind the returned text of the method
# to a variable and print it
txt = replace_all(mcode_exp, reps)
self.widgets.active_mcodes_exp.set_label("".join(txt))
def _update_active_mcodes( self ):
# M codes
active_codes = []
temp = []
for code in sorted( self.stat.mcodes[1:] ):
if code == -1:
continue
temp.append( "%d" % code )
for code in ( temp ):
active_codes.append( "M" + code )
self.active_mcodes = active_codes
self.mcodes = self.stat.mcodes
self.widgets.active_mcodes_label.set_label( " ".join( self.active_mcodes ) )
I have no memory of how I got to this solution - may have been help from someone here (I know zero python).
The following user(s) said Thank You: zz912
Please Log in or Create an account to join the conversation.
22 Jun 2024 19:47 #303564
by cmorley
Replied by cmorley on topic Setup Sheet as Embedded Tab
Qtdragon has a setup page that displays an optional PDF/HTML file.
If you name the PDF/HTML the same as the NGC file then they will both be loaded.
There is also a basic HTML writer included.
I had plans for easy ways to add pics and the tooltable but I don't think <i finished them.
It could probably be written as a qtvcp panel that could be embedded in other screens.
What Info does it need to display?
From memory I believe a user asked for it because some programs already create a PDF or HTML page.
If you name the PDF/HTML the same as the NGC file then they will both be loaded.
There is also a basic HTML writer included.
I had plans for easy ways to add pics and the tooltable but I don't think <i finished them.
It could probably be written as a qtvcp panel that could be embedded in other screens.
What Info does it need to display?
From memory I believe a user asked for it because some programs already create a PDF or HTML page.
Please Log in or Create an account to join the conversation.
24 Jun 2024 18:18 #303709
by Wischi
Well I got something. Sort of mostly copy and paste from other scripts, definitely have to learn python at some point. Right now you have to press a button to load a .html file with the same name, in the same dir as the .ngc file, no check if files exist yet. Is there anyway to do this automatic? I have read about event handlers but running it in the background seems kind of a waste. Maybe update it when the tab gets activated (clicked on) ?
I have attached the code and glade file. The required ini config is included in the .py file. Please comment on the script and what could be done better! When you start gmoccapy there is always a small windows that appears and then disappers quickly, how can that be fixed?
Replied by Wischi on topic Setup Sheet as Embedded Tab
Well I got something. Sort of mostly copy and paste from other scripts, definitely have to learn python at some point. Right now you have to press a button to load a .html file with the same name, in the same dir as the .ngc file, no check if files exist yet. Is there anyway to do this automatic? I have read about event handlers but running it in the background seems kind of a waste. Maybe update it when the tab gets activated (clicked on) ?
I have attached the code and glade file. The required ini config is included in the .py file. Please comment on the script and what could be done better! When you start gmoccapy there is always a small windows that appears and then disappers quickly, how can that be fixed?
Attachments:
Please Log in or Create an account to join the conversation.
28 Jun 2024 12:05 #303969
by HansU
The most elegant way would be to load this on a file-load event. signal "file-loaded", see linuxcnc.org/docs/stable/html/gui/gstat.html.
But if I remember correctly this doesn't work with GladeVCP unfortunately. Therfore the HTML widget must be part of Gmoccapy.
What does this window contain?
Replied by HansU on topic Setup Sheet as Embedded Tab
Is there anyway to do this automatic? I have read about event handlers but running it in the background seems kind of a waste. Maybe update it when the tab gets activated (clicked on) ?
The most elegant way would be to load this on a file-load event. signal "file-loaded", see linuxcnc.org/docs/stable/html/gui/gstat.html.
But if I remember correctly this doesn't work with GladeVCP unfortunately. Therfore the HTML widget must be part of Gmoccapy.
When you start gmoccapy there is always a small windows that appears and then disappers quickly, how can that be fixed?
What does this window contain?
Please Log in or Create an account to join the conversation.
28 Jun 2024 20:24 - 28 Jun 2024 20:28 #303991
by Wischi
The sample from chapter 2.2 works in gmocappy. But i was thinking it might be better to be able to select a file instead of loading it from the .ngc file. Maybe you are running OP1 and want to look at the setup for OP2.
I created a simple webbrowser like interface, with home dir / back / forward / load file from .ngc / zoom functions.
The file browser is just the default that comes up when you open a folder with file://
Kinda works alright actually, except that the mouse wheel scrolling does not work, maybe the touchscreen will work still have to try it on the real machine.
It is blank but has the window title "setup_sheet", same as the .py and .glade file. My guess would be that it gets initialized and when it is done it will be pushed into the embedded tab.
Replied by Wischi on topic Setup Sheet as Embedded Tab
The most elegant way would be to load this on a file-load event. signal "file-loaded", see linuxcnc.org/docs/stable/html/gui/gstat.html.
But if I remember correctly this doesn't work with GladeVCP unfortunately. Therfore the HTML widget must be part of Gmoccapy.
The sample from chapter 2.2 works in gmocappy. But i was thinking it might be better to be able to select a file instead of loading it from the .ngc file. Maybe you are running OP1 and want to look at the setup for OP2.
I created a simple webbrowser like interface, with home dir / back / forward / load file from .ngc / zoom functions.
The file browser is just the default that comes up when you open a folder with file://
Kinda works alright actually, except that the mouse wheel scrolling does not work, maybe the touchscreen will work still have to try it on the real machine.
What does this window contain?
It is blank but has the window title "setup_sheet", same as the .py and .glade file. My guess would be that it gets initialized and when it is done it will be pushed into the embedded tab.
Last edit: 28 Jun 2024 20:28 by Wischi.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
Time to create page: 0.149 seconds