Usage of hud in vismach?

More
3 years 9 months ago #262050 by Aciera
Replied by Aciera on topic Usage of hud in vismach?
Thanks for the feedback! I have not noticed, but with this editor nothing surprises me.
I revisited my code and modified a few things while including your pin expansion that is more powerful than what I had before.I tried to make things a bit more user friendly than what I had before and also tried to make old vismach model code work with it.Here is what the result looks like:
 

Attachment not found



The corresponding vismach code is a lot more wysiwyg then the lists I was using before:
Code:
# start hud myhud = Hud() myhud.show("Legacy") myhud.show_txt("       XYZABC-TRSRN") myhud.show_txt("----------------------------") myhud.show_txt("") myhud.show_msg("Kinematics ", ["IDENTITY","TCP","TOOL","TOOL-2"],"motion.switchkins-type", " active") myhud.show_txt("") myhud.show_pin("X abs: ","gen_xyzabc_trsrn_kins.abs-pos-x","{:8.3f}","mm") myhud.show_pin("Y abs: ","gen_xyzabc_trsrn_kins.abs-pos-y","{:8.3f}","mm") myhud.show_pin("Z abs: ","gen_xyzabc_trsrn_kins.abs-pos-z","{:8.3f}","mm") myhud.show_txt("") myhud.show_txt("") myhud.show_txt("Supports x,y,z offsets only!") myhud.show_txt("Does not support G52 or G92") myhud.show_txt("") # end hud

 

Attachment not found

Please Log in to join the conversation.

More
3 years 9 months ago #262052 by Aciera
Replied by Aciera on topic Usage of hud in vismach?
Btw, do you know if there are any other fonts that can be used?
I had a look around the source code and, if I remember correctly, I only found "8x12" that worked.

Please Log in to join the conversation.

More
3 years 9 months ago #262112 by Aciera
Replied by Aciera on topic Usage of hud in vismach?
Using the GLUT library gives some more fonts to choose from

from OpenGL.GLUT import *

then initalize the glut library in the class O:

class O(rs274.OpenGLTk.Opengl):
def __init__(self, *args, **kw):
rs274.OpenGLTk.Opengl.__init__(self, *args, **kw)
self.r_back = self.g_back = self.b_back = 0 # sets the background color of the vismach display
glutInit(sys.argv) # initialize the GLUT library
...


Let's us use the other fonts:

for string in drawtext:
maxlen = max(maxlen, len(string))
glRasterPos2i(xmargin, int(ypos))
for char in string:
#glCallList(self.fontbase + ord(char))
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, ord(char));
ypos -= char_height
i = i + 1


With some adjustments to the character spacing:

#char_width, char_height = 9, 15
char_width, char_height = 14, 20

Please Log in to join the conversation.

More
3 years 9 months ago #262205 by cmorley
Replied by cmorley on topic Usage of hud in vismach?
I don't think you need string2

myhud.show_val("X : ", "joint.0.pos-fb", "{:8.3f}", "mm")
vrs:
myhud.show_val("X : ", "joint.0.pos-fb", "{:8.3f} mm")

we probably don't need the first string either actually:

myhud.show_val("", "joint.0.pos-fb", "X: {:8.3f} mm")

Please Log in to join the conversation.

More
3 years 9 months ago #262214 by Aciera
Replied by Aciera on topic Usage of hud in vismach?
Cool, thanks for the tip!
[edit]
So here is the latest version:
- added optional tags for the hud lines. A line can have more than one tag (ie a list of tags). Tagged lines are hidden until activated.
- added functions to show tagged lines either by explicitly passing a tag or a list of tags when a halpin value is equal to a given value or if a halpin value is itself equal to a line tag
- added a function to set the hud color and transparency (static)
- added a function to set the hud text color (static)  
Code:
#hud myhud = Hud() myhud.show("       XYZABC-TRSRN") myhud.show("----------------------------") myhud.show("") myhud.add_txt("IDENTITY",[0,3]) myhud.add_txt("TCP",1) myhud.add_txt("TOOL",2) myhud.add_txt("TOOL_2",2) myhud.add_txt("") myhud.add_pin("X abs: {:8.3f} mm","gen_xyzabc_trsrn_kins.abs-pos-x",4) myhud.add_pin("Y abs: {:8.3f} mm","gen_xyzabc_trsrn_kins.abs-pos-y",5) myhud.add_pin("Z abs: {:8.3f} mm","gen_xyzabc_trsrn_kins.abs-pos-z",[2,5]) myhud.add_txt("") myhud.add_txt("") myhud.add_txt("Supports x,y,z offsets only!") myhud.add_txt("Does not support G52 or G92") myhud.add_txt("") myhud.show_tags_in_pin("motion.switchkins-type") myhud.hide_all("halui.estop.is-activated") myhud.show_tag_if_same([1,2,3,4],"motion.is-all-homed") myhud.set_hud_rgba(0.5,0.5,0.5,0.9) myhud.set_hud_text_rgb(0,0,0) #/hud

 

Attachment not found

Please Log in to join the conversation.

Time to create page: 0.133 seconds
Powered by Kunena Forum