Custom User Button External Command Issue

More
20 Apr 2021 14:36 - 20 Apr 2021 14:38 #206534 by AgentWD40
My first question is if I were to make a executable python script that I want a user button to call where *should* I put this script? I have my own ~/bin directory in my home folder that I've added to my $PATH through .bashrc, should/can I add this directory to linuxcnc's path?? If so how?

Second, I'm trying to string together a gcode and then a call to an external command like this:
BUTTON_7_NAME = CLICK\ME
BUTTON_7_CODE = G0 X5 Y5 \ %howdy

howdy is simple "hello world" executable python script that I've placed in /usr/local/bin for now.

When I click this button LinuxCNC throws the error:
HAL PIN ERROR:
Invalid code for user button #7
External command "%howdy" does not exist

BUT if i call the external command by itself:
BUTTON_7_CODE = %howdy
It finds the command and executes the script just fine.
Last edit: 20 Apr 2021 14:38 by AgentWD40.

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

More
20 Apr 2021 14:54 #206536 by snowgoer540
For #2, I am curious, what happens if you try something like this:
BUTTON_n_CODE = g0x5y5 \ %halmeter

If that doesn't work, my guess is that there is an unintended feature holding this up. :) There was recently some code added that checks for invalid user buttons, and it's possible it needs some massaging in order to allow this scenario.

Per the user guide, it should be valid. Just trying to determine if it doesn't like your script, or the problem is in the user button check.

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

More
20 Apr 2021 16:03 #206540 by AgentWD40
I'll give it a shot tonight. A problem with the button code validation sounds like a prime suspect since afterall I am able to execute the script from the button when the command is by itself.

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

More
20 Apr 2021 20:19 #206562 by snowgoer540

I'll give it a shot tonight. A problem with the button code validation sounds like a prime suspect since afterall I am able to execute the script from the button when the command is by itself.


No need, I had some time after work. I reckon it's an issue with the code. I'm sure it'll get sorted out.
The following user(s) said Thank You: AgentWD40

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

More
20 Apr 2021 21:06 #206571 by AgentWD40
For my own edification can someone point me to the relevant source file on github? Or even the actual QTPlasmaC gui source files? I cant get my head around navigating to where anything is... If I could just find the actual source I may be able to suggest fixes.

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

More
21 Apr 2021 00:58 - 21 Apr 2021 00:59 #206595 by AgentWD40
@snowgoer540 @phillc54
I think I found the bug.
Line #2231 of qtplasmac_handler.py
cmd = command.lstrip('%').strip().split(' ', 1)[0]

should be
cmd = command.strip().lstrip('%').split(' ', 1)[0]

github.com/LinuxCNC/linuxcnc/blob/a316f2...mac_handler.py#L2231
Last edit: 21 Apr 2021 00:59 by AgentWD40.

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

More
21 Apr 2021 01:08 - 21 Apr 2021 01:09 #206596 by snowgoer540
Yea, I saw the same. I reckon Phill is working on it. It seems Clive is having a similar issue as well with his laser code. So probably a few more changes to come.

Thanks for the report!

I noticed a few other things about conversational while I was messing around with this tonight. So, some changes should be coming shortly.
Last edit: 21 Apr 2021 01:09 by snowgoer540.
The following user(s) said Thank You: AgentWD40

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

More
21 Apr 2021 01:20 - 21 Apr 2021 01:22 #206597 by AgentWD40
Oh, and the same change needs to be made on line #2381 of the same file.

(repeated code *tisk* *tisk* *tisk* haha :laugh: )
Last edit: 21 Apr 2021 01:22 by AgentWD40.

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

More
21 Apr 2021 04:27 #206609 by phillc54

Oh, and the same change needs to be made on line #2381 of the same file.

(repeated code *tisk* *tisk* *tisk* haha :laugh: )


Actually, redundant code...

Fix has been pushed along with some others. There are still some issues like accepting negative values when it shouldn't. I'll get around to them after my next pay rise.
The following user(s) said Thank You: rodw, AgentWD40, snowgoer540

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

More
21 Apr 2021 16:04 - 21 Apr 2021 20:39 #206668 by AgentWD40
It looks like the fix is broke :(

Line #2377: Instead of calling Popen, ACTION.SET_MANUAL_MODE() is called instead.

I'll get around to them after my next pay rise.


Do you have a patreon, gofundme... onlyfans page or whatever where we can donate for your efforts?
Last edit: 21 Apr 2021 20:39 by AgentWD40.

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

Moderators: snowgoer540
Time to create page: 0.571 seconds
Powered by Kunena Forum