Extended pyvcp_widgets

More
12 Feb 2014 20:48 - 24 Feb 2014 18:10 #43802 by ArcEye
Hi

I have now updated my extended pyvcp_widgets.py file to reflect recent changes to the bar widget and the checkbox, amoungst others.

I have also included a sample config to demo multilabel and bar changing and show other widgets being set to default values

If you want to download the whole file rather than make ad hoc edits it is available from
www.mgware.co.uk/LinuxCNC/extended-pyvcp.html

Read the py file header for each widget to see the xml syntax required to address the various extra pins etc
They are backwardly compatible with the original widgets, ie. are all additions which if not used, do nothing

Most are outlined and demonstrated in this section across various posts too.

I have undoubtedly cocked up something updating this, if you find any bugs let me know :laugh:

regards
Last edit: 24 Feb 2014 18:10 by ArcEye.
The following user(s) said Thank You: BigJohnT

Please Log in or Create an account to join the conversation.

More
14 Feb 2014 12:50 #43845 by cmorley
Replied by cmorley on topic Extended pyvcp_widgets
is this an improved version of the patch you offered for inclusion some long time ago?

Chris M

Please Log in or Create an account to join the conversation.

More
14 Feb 2014 15:27 #43849 by ArcEye
Replied by ArcEye on topic Extended pyvcp_widgets
Hi Chris

Basically yes

Just updated with a couple more things, the remote toggling of check boxes by hal pin and ability to have coloured bar which changes colour to reflect the value it is representing ( OK, Warn, Danger type scenario)

Saves them being scattered all over different forum posts

regards

Please Log in or Create an account to join the conversation.

More
14 Feb 2014 17:41 #43851 by cmorley
Replied by cmorley on topic Extended pyvcp_widgets
I should just add them to master...I am busy with other stuff for a while but will try to remember to look into this again.

Chris M

Please Log in or Create an account to join the conversation.

More
14 Feb 2014 18:17 #43852 by ArcEye
Replied by ArcEye on topic Extended pyvcp_widgets
If there is some danger of them going somewhere, I will clean up the file (lots of comments so I could find things or remember what I did)
and maybe amend a copy of the existing html doc page to reflect the changes.

I'm trying to get to grips with some CAD/CAM stuff at the minute, I will re-post when done

Thanks

Please Log in or Create an account to join the conversation.

More
17 Feb 2014 00:12 - 24 Feb 2014 17:37 #43902 by ArcEye
Replied by ArcEye on topic Extended pyvcp_widgets
Hi Chris

The cleaned up py file is here

(removed pending edit)

Perhaps JT can assist re the html file, for some reason the auto TOC generator creates 2 lists, I can't see an immediate reason, probably some arcane formatting error

regards
Last edit: 24 Feb 2014 17:37 by ArcEye.
The following user(s) said Thank You: Rick G

Please Log in or Create an account to join the conversation.

More
17 Feb 2014 17:17 #43910 by Rick G
Replied by Rick G on topic Extended pyvcp_widgets
Hello ArcEye,

Great addition. Nice timing too as we are in the process of setting up a plasma table with torch height control using Mesa's THCAD, J.T.'s THC component and spinboxs with initial values set from NGCGUI subs and then modified.
The resulting values are stores in the var file so they can be restores when the machine is restarted. Just did a quick test and works great.

Because the original spinbox did not have a hal parameter pin we set the voltage with a sum2 component, the value stored in the file or from the sub added to a spinbox with an initial value of 0.
We did a slight edit to connect a value to the new parameter pin.

In the xml...
<spinbox>
                <width>"5"</width>
                <halpin>"volts-adjustment"</halpin>
                <param_pin>1</param_pin>
                <min_>-100</min_>
                <max_>100</max_>
                <resolution>1</resolution>
                <font>("Helvetica",10)</font>
                <format>"1.0f"</format>
                <font>("Arial",10)</font>
                <initval>0</initval>
            </spinbox>

Where M105 is..
#!/bin/bash
#m105 to set thc values
#voltage is P
#adjust is Q
voltage=$1
vadjust=$2
halcmd setp sum2.0.in1 $voltage
halcmd setp pyvcp.spinbox.1.param_pin $vadjust
#halcmd setp thc.feedrate $feedrate
exit 0

M105 P99 Q13
Works as expected.

I do need to edit the M105 as...

M105 P99
Creates a invalid hal argument and will set the spinbox to -1

Thanks for the additions.

Rick G

Please Log in or Create an account to join the conversation.

More
17 Feb 2014 19:11 #43913 by ArcEye
Replied by ArcEye on topic Extended pyvcp_widgets
Hi Rick

Thanks for the additions.


You're welcome, I'm glad someone is using them. I think Mariusl who originally requested the spinbox mod was doing something quite similar to your THC set up

M105 P99
Creates a invalid hal argument and will set the spinbox to -1


I seem to remember being bitten by that in the past myself, if you don't specifically set P or Q you end up with -1, to 6 decimal places.

The fact that it passes a float value even if you enter an integer also caused problems, where the value was a selection from a menu, because bash would not match say 3 with 3.000000

This bash script shows the conversion I had to do when using a logging script M121 P1(to start) or P2(to end)
#!/bin/bash

if [ ! $# -ge 1 ]; then
  echo "Usage: M121 n - where n is 1 (start  2 (end "
  exit 1
fi

float=$1
int=${float/\.*}

case $int in

    1 ) axis-remote --get 
        echo "JOB FILE NAME" >> /tmp/joblog.txt
        echo "*************" >> /tmp/joblog.txt
    	cat /tmp/filename.txt >> /tmp/joblog.txt
        echo "Started at:-" >> /tmp/joblog.txt
    	date >> /tmp/joblog.txt;;
    
    2 ) echo "Ended at:-" >> /tmp/joblog.txt
        date >> /tmp/joblog.txt;;

esac

exit 0

.. and yes it was a hacked version of axis-remote :laugh:

regards

Please Log in or Create an account to join the conversation.

More
18 Feb 2014 13:57 #43936 by cmorley
Replied by cmorley on topic Extended pyvcp_widgets
Does this patch change the current behavior of widgets in a major way?

Please Log in or Create an account to join the conversation.

More
18 Feb 2014 15:50 #43937 by ArcEye
Replied by ArcEye on topic Extended pyvcp_widgets
Hi Chris,

Does this patch change the current behavior of widgets in a major way?


It is not a patch, it is a full replacement, I can create a patch against a fresh clone of master if you want it in that format.

No, it should be backwardly compatible.
The new fields require to be set before anything happens.

For instance the bar widget retains the default color setting for the bar and only if all three range fields are completed with valid colours, will it colour the bar based upon the value at the halpin.

There is one new pin in the checkbox widget that is created automatically, but that does not affect anything unless it is used.

regards

Please Log in or Create an account to join the conversation.

Time to create page: 0.266 seconds
Powered by Kunena Forum