Candle icon indicating copy to clipboard operation
Candle copied to clipboard

Users command popups

Open Jarewa opened this issue 2 years ago • 12 comments

Candle 1.2.14b

I wanted to ask if there are other scripts for pop-ups, I would like to insert text and to confirm or deny that it executes depending on what I do?

{var x = QInputDialog.getText(0, "Relative", "X")}

This script causes a window to open and you have to enter the data to be captured and inserted

G91 G0 X{x}

I would like to ask if there are other references to other pop-ups to create my own scripts?

Jarewa avatar Apr 17 '22 14:04 Jarewa

I tested a bit and some qt5 windows work "QInputDialog" "QMessageBox"

But it is limited in the number of characters. Maybe the author would allocate more space?

{QMessageBox.warning(this,"Ostrzeżenie","Wymień narzędzie i naciśnij Ok", QMessageBox.Yes | QMessageBox.No )}

Did not work "QMessageBox.Yes | QMessageBox.No" :(

Screenshot_2

Jarewa avatar Apr 21 '22 18:04 Jarewa

Hello, im tried to remove limit, but it's may be buggy for now: Candle_iss549.zip

This script should work:

{script.importExtension("qt.widgets")}
{with (QMessageBox) warning(0, "1", "2", StandardButtons(Yes, No))}

Denvi avatar Apr 22 '22 16:04 Denvi

{script.importExtension("qt.widgets")} {with (QMessageBox) warning(0, "1", "2", StandardButtons(Yes, No))}

Works I'm happy, I already know how to format other windows as well :)

Can you still tell me if they work and how to format the conditional statements?

np.

if( x== yes){ // code // gcode } if(x== No){ // code // gcode }

Jarewa avatar Apr 23 '22 17:04 Jarewa

Some fixes for nested brackets: Candle_iss549_1.zip

So now this example works:

{script.importExtension("qt.widgets")}
{with (QMessageBox) var r  = warning(0, "1", "2", StandardButtons(Yes, No, Cancel))}
{if (r == QMessageBox.No) {s = "G"; s + 0} else {"G1"}}

Denvi avatar Apr 25 '22 16:04 Denvi

Thank you very much, it gives you a lot of possibilities and is very functional.

Now tests :)

Jarewa avatar Apr 26 '22 10:04 Jarewa

@Jarewa Maybe it worth to write you own plugin instead of user command scripting?

mar0x avatar Apr 26 '22 10:04 mar0x

hello, translation via google translate

thank you for this feature I encounter a problem, I make user commands for probes cutter diameter dialog box: OK on the other hand I cannot add numbers, it treats them as strings on the other hand if I work in the negative it works

this works {script.importExtension("qt.widgets")} {d = QInputDialog.getText(0, "Relative", "Diamètre de la fraise")} {y_probe = 25} G91 G21 G91 G0 Y{-y_probe -d} return G91 < ok G21 < ok G91 G0 Y-27.0000 < ok

this does not work {script.importExtension("qt.widgets")} {d = QInputDialog.getText(0, "Relative", "Diamètre de la fraise")} {y_probe = 25} G91 G21 G91 G0 Y-{y_probe +d} return G91 < ok G21 < ok G91 G0 Y-252 < ok

I tried to process them in integer but it returns me a valid error

davi-domo avatar May 26 '22 12:05 davi-domo

Hi, have you tried parseInt() or unary "+" such as:

y_probe + parseInt(d)
or
y_probe + +d

Denvi avatar May 26 '22 13:05 Denvi

Hi, have you tried parseInt() or unary "+" such as:

y_probe + parseInt(d)
or
y_probe + +d

thank you I tried but I must have made a typo I will be able to advance on my probes

Capture d’écran probe

to follow up on this track I made a short video to integrate the XYZ probe into candle https://youtu.be/74_t17TzNYs

davi-domo avatar May 26 '22 14:05 davi-domo

Some fixes for nested brackets: Candle_iss549_1.zip

So now this example works:

{script.importExtension("qt.widgets")}
{with (QMessageBox) var r  = warning(0, "1", "2", StandardButtons(Yes, No, Cancel))}
{if (r == QMessageBox.No) {s = "G"; s + 0} else {"G1"}}

Hello i tried the following command to generate a confirm pop up, but i have the following error "SYNTAXERROR: PARSE ERROR ELSE G1} < error:2", have u found some command to generate a confirm dialog?

  • Candle version "1.2.15b" Thanks 👍

JepApps avatar Feb 12 '23 00:02 JepApps

Something wrong here, show your script?

Jarewa avatar Feb 12 '23 19:02 Jarewa

Something wrong here, show your script?

Here It's the script image

JepApps avatar Feb 12 '23 21:02 JepApps