TNGv2 Buttons [SOLVED]

Results 1 to 17 of 17

Thread: TNGv2 Buttons [SOLVED]

  1. #1
    Member theRat's Avatar
    Join Date
    Jun 2017
    Location
    Australia
    Posts
    143
    Downloads
    0
    Uploads
    0

    Default TNGv2 Buttons [SOLVED]

    I found the example of how to create new buttons in another thread and have a button working. I am wanting to add an extra coolant button in the middle of the toolbar. To do this I need to disable the default top button bar in the settings and then completely define the top toolbar from scratch. I did this in TNGv1 and it worked fine, but with TNGv2 I have noticed that you have moved to using SVG files for the buttons. I ma guessing the default buttons are embedded in one of the dll's so they aren't easy to extract. Is it possible to post a zip file containing all the default SVG's for using to redo button bars?
    Also do you have any recommendations for sizing SVG's when creating new button images?

    Really loving the improvements. Thanks for all your effort.

    Simon

    Similar Threads:
    Last edited by PlanetCNC; 11-04-2019 at 03:32 PM.


  2. #2
    Member theRat's Avatar
    Join Date
    Jun 2017
    Location
    Australia
    Posts
    143
    Downloads
    0
    Uploads
    0

    Default Re: TNGv2 Buttons

    Also I am having problems getting a button for a a user defined script to show. With the following in my buttons file:

    Code:
    cmd: "Machine.Mist" "" image="Icons/test.svg"
    cmd: "Machine.Flood" "" image="Icons/test.svg"
    cmd: "Machine.UserDefined_1" "" image="Icons/test.svg"
    The first 2 buttons show up and work, the 3rd button for the UserDefined_1 is not there. I copied that line from your example.

    Is there a way to run gcode files directly from a button? Say I have a M900.gcode in my scripts directory can I just execute it without having to put it in a user defined script?



  3. #3
    Member PlanetCNC's Avatar
    Join Date
    Mar 2017
    Location
    Slovenia
    Posts
    1295
    Downloads
    0
    Uploads
    0

    Default Re: TNGv2 Buttons

    To create button for "User Command" use this:
    cmd: "Machine.User_Commands.UserCommand_1"

    "User Commands" are scripts stored in "UserCmd" folder.

    In your case you have custom M900 gcode in Scripts folder. This can be run like normal g-code. You could use command like:
    expr: "cmd('Machine.Start_Code', 'M900')"
    This works basically same way as running M900 via MDI.

    Next version will also have helper function with same behavior:
    expr: "startcode('M900')"



  4. #4
    Member theRat's Avatar
    Join Date
    Jun 2017
    Location
    Australia
    Posts
    143
    Downloads
    0
    Uploads
    0

    Default Re: TNGv2 Buttons [SOLVED]

    Thanks very much for that. I now have that button working mostly. When I use this line:

    Code:
    expr: "cmd('Machine.Start_Code', 'M900')" "Air" image="Icons/test.svg"
    I get the correct icon and the script runs but it puts the text "Air" over the top of the button. If I replace the "Air" with "" the image looks right, but then there is no popup help message. Is there a way to overcome this? I would have thought that if you specify an image then it shouldn't put the text over it.

    Can you please answer the questions in the original post also regarding the SVG specs and if the default SVG's can be made available.

    Thannks
    Simon



  5. #5
    Member PlanetCNC's Avatar
    Join Date
    Mar 2017
    Location
    Slovenia
    Posts
    1295
    Downloads
    0
    Uploads
    0

    Default Re: TNGv2 Buttons [SOLVED]

    Next version will have "tooltip" attribute. For exmple:
    expr: "_jog_speed=_usb1/60" "JOG" image="Icons/IMG_EStop.svg" tooltip="Jog Speed"

    Default icons are in zip file here:

    Attached Files Attached Files


  6. #6
    Member theRat's Avatar
    Join Date
    Jun 2017
    Location
    Australia
    Posts
    143
    Downloads
    0
    Uploads
    0

    Default Re: TNGv2 Buttons [SOLVED]

    Thank you so much for that, can wait for the tooltip update

    One hopefully last question about buttons, is there a way to make them behave like the coolant/spindle buttons where they show the state of that item? Also is there a way to enable/disable buttons like the start/stop/pause?



  7. #7
    Member PlanetCNC's Avatar
    Join Date
    Mar 2017
    Location
    Slovenia
    Posts
    1295
    Downloads
    0
    Uploads
    0

    Default Re: TNGv2 Buttons [SOLVED]

    Try this:
    expr: "cmd('Machine.Start_Code', 'M900')" "M900" enable="_hw_estop == 0" updown="_hw_idle == 1"

    Enable and Up/Down state is controlled by parameters now. I case that you use parameters that don't automatically update display then add 'updatefast' attribute like this:
    expr: "cmd('Machine.Start_Code', 'M900')" "M900" enable="_hw_estop == 0" updown="_hw_idle == 1" updatefast="true"



  8. #8
    Member theRat's Avatar
    Join Date
    Jun 2017
    Location
    Australia
    Posts
    143
    Downloads
    0
    Uploads
    0

    Default Re: TNGv2 Buttons [SOLVED]

    I have tried this and it works if I have a single test. For my button to behave like the others I need to AND two conditions. So my line would look something like this:

    expr: "cmd('Machine.Start_Code', 'M900')" "" image="Icons/IMG_Air.svg" imagechange="true" stroke=1.1 enable="AND[_hw_idle == 1,_hw_estop == 0]"

    Unfortunately this doesn't work. The button is always enabled. Is there a way to do that AND?



  9. #9
    Member PlanetCNC's Avatar
    Join Date
    Mar 2017
    Location
    Slovenia
    Posts
    1295
    Downloads
    0
    Uploads
    0

    Default Re: TNGv2 Buttons [SOLVED]

    AND(_hw_idle == 1,_hw_estop == 0)

    Expression statements use normal brackets. Only g-code expressions use square brackets.

    Didn't you get en error? You can open "Output" window by clicking on white square in top right corner. See screenshot.


    Attached Thumbnails Attached Thumbnails TNGv2 Buttons [SOLVED]-06-11-2019-22-37-00-png  


  10. #10
    Member theRat's Avatar
    Join Date
    Jun 2017
    Location
    Australia
    Posts
    143
    Downloads
    0
    Uploads
    0

    Default Re: TNGv2 Buttons [SOLVED]

    Yes, I saw I was getting errors in there, but for some reason couldn't figure out the correct syntax. What you suggested works perfectly. As an added bonus it is a bitwise AND which I needed for the updown parameter. The button is working perfectly now, except for not getting getting turned off on estop. Is there a script that runs on estop? I notice under settings->events there are scripts for OnStart/OnEnd/OnStop, is OnStop actually onEStop?



  11. #11
    Member PlanetCNC's Avatar
    Join Date
    Mar 2017
    Location
    Slovenia
    Posts
    1295
    Downloads
    0
    Uploads
    0

    Default Re: TNGv2 Buttons [SOLVED]

    except for not getting getting turned off on estop...

    add attribute:
    updatefast="true"
    to button to force fast updates



  12. #12
    Member theRat's Avatar
    Join Date
    Jun 2017
    Location
    Australia
    Posts
    143
    Downloads
    0
    Uploads
    0

    Default Re: TNGv2 Buttons [SOLVED]

    I already have that. The Estop disables the button, but if it is currently turned on it stays on. I want to turn it off when EStop occurs. Similar to the behaviour you get when you tick the boxes in Settings->Program Defaults->EStop->(Stop Mist, Stop Flood, Stop Spindle). I think I need to have a script run when EStop happens to be able to do that.



  13. #13
    Member PlanetCNC's Avatar
    Join Date
    Mar 2017
    Location
    Slovenia
    Posts
    1295
    Downloads
    0
    Uploads
    0

    Default

    Unfortunately there are no estop scripts. Estop is special state and controller is blocked to execute a command.

    Even if you type M900 to mdi it will not be executed because of estop state.



  14. #14
    Member theRat's Avatar
    Join Date
    Jun 2017
    Location
    Australia
    Posts
    143
    Downloads
    0
    Uploads
    0

    Default Re: TNGv2 Buttons [SOLVED]

    Ok, that kind of makes sense. Does that mean those other options to turn of coolant/spindle are handled in the controller firmware?
    I guess its not a real problem for me as M900 turns on Air only as a coolant.

    Thanks for all your help.



  15. #15
    Member PlanetCNC's Avatar
    Join Date
    Mar 2017
    Location
    Slovenia
    Posts
    1295
    Downloads
    0
    Uploads
    0

    Default

    Yes, these are implemented in firmware.



  16. #16
    Member theRat's Avatar
    Join Date
    Jun 2017
    Location
    Australia
    Posts
    143
    Downloads
    0
    Uploads
    0

    Default Re: TNGv2 Buttons [SOLVED]

    That explains why EStop has seemed a bit dodgy for me. My spindle and coolant are all controlled using I2C, so EStop is never going to be able to change their state. Maybe something to think about, consider it a feature request, would be to add functionality to the firmware to send a configurable sequence of I2C commands when EStop is triggered.



  17. #17
    Member theRat's Avatar
    Join Date
    Jun 2017
    Location
    Australia
    Posts
    143
    Downloads
    0
    Uploads
    0

    Default Re: TNGv2 Buttons [SOLVED]

    Solved, but the BtnRight.txt in the zip file has a couple of errors, probably due to software updates. The OffsetZero and MeasureOff menu paths are slightly different.



Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

TNGv2 Buttons [SOLVED]

TNGv2 Buttons [SOLVED]