Script bash
- grzesiekzxr
- Offline
- Senior Member
-
- Posts: 75
- Thank you received: 0
Thanks for response.
''This is probably from grecode not Linuxcnc
I have no idea if it knows anything about subs, probably not."
Yes I agree wih you and therefore, for the first time gave up with the Grecode,
"
If your code requires calls to subs in it etc, ."
I'm realy often using sub as : o<w>call ; o<pon>call ; o<pof>call ;o<saw>call in one file.
Unfortunately some of them have changing parameters like sub o<w>call [..] [..].......
What do you mean "you are probably going to have to script it, so you can stitch them in where required."?
I'm pretty sure that I can not write this because it probably requires a knowledge of Python or Bash
![:( :(](/media/kunena/emoticons/sad.png)
"If it does not error, you could comment out with ;"
Yes it doesn't error when is commented.
"run the call to grecode and then use sed to delete the comments afterwards."
Nice trick.
regards.
Please Log in or Create an account to join the conversation.
- grzesiekzxr
- Offline
- Senior Member
-
- Posts: 75
- Thank you received: 0
At the beginning I really thank ArcEye for your solution
I'm not sure how to finisch this method so
meanwhile, I'm trying something realy simple i.e:
1.conect right button to mdi_comment,
2.mdi_comment invoke sub,
O<symertic>sub
M66 E0 I0
#5399=-1
G4 P0.001
G55
O<symertic>endsub
Main idea is multiply all necessary: incremental X ,points X by -1.
Button work properly when I 'm checking behavior in MDI by debug #5399 changing so I expect.
But if I put it inside file or sub - seems to be invisible or have value 0.
Why in MDI expected parameter changes when press button but not change inside file or sub?
Thanks
Regards.
Please Log in or Create an account to join the conversation.
O<symertic>sub
M66 E0 I0
#5399=-1
G4 P0.001
G55
O<symertic>endsub
Main idea is multiply all necessary: incremental X ,points X by -1.
Button work properly when I 'm checking behavior in MDI by debug #5399 changing so I expect.
But if I put it inside file or sub - seems to be invisible or have value 0..
I think you might be over-complicating this.
The M66 seems superfluous, and #5399 is a special parameter which is used to return the value of M66. If you want a parameter with the same value everywhere, use a parameter number > #30.
If you are prepared to replace every X by [X * #100] then all you actually need is two lines in the INI file (as it will all fit on one MDI line)
MDI_COMMAND G54 #100 = 1
MDI_COMMAND G55 #100 = -1
Please Log in or Create an account to join the conversation.
Another way is to properly script sed.
That will save you having to change your gcode generation and have every X move written as X [move * #100]
For example:
To find every instance of X or x followed by a series of numbers and write them back with a minus sign between the X and the numbers
Input file is test.ngc, resultant file is output.ngc
sed 's/\([Xx]\)\([0-9]*\)/\1\-\2/g' < test.ngc > output.ngc
To find every instance of X or x followed by a minus sign and then series of numbers and write them back without a minus sign between the X and the numbers
Input file is test.ngc, resultant file is output.ngc
sed 's/\([Xx]\)\([\-]\)\([0-9]*\)/\1\3/g' < test.ngc > output.ngc
If you want to experiment, just provide an input file, this will print to stdout so you can check the result
sed 's/\([Xx]\)\([\-]\)\([0-9]*\)/\1\3/g' test.ngc
There is no right way to do this, there are many ways and it ends up with what works and you are comfortable maintaining
regards
Please Log in or Create an account to join the conversation.
- grzesiekzxr
- Offline
- Senior Member
-
- Posts: 75
- Thank you received: 0
Many thanks
But I'm again in a trouble.
When put MDI_COMMAND G54 #100 = 1
MDI_COMMAND G55 #100 = -1
Teminal display: emc/ask/emctask/.cc 374 interp_error -That I;m using unproper sign - ; 1
Your method is much simple and therefore better,but
![:silly: :silly:](/media/kunena/emoticons/silly.png)
To avoid it I put G54 #100 = 1 inside sub and it work .
write simple g-code;
f1000
g1 x0 y0
x[1000*#100]
;;;;x[1000*1]
y1000
x0
y0
I expected sqare,but have straight line in axis Y.
Iterpreter don't see #100 ,altough in MDI I see proper chaning 1/-1.
Sory I don't know where I make a mistake.
Your second solution I will try but first someting simple
![:( :(](/media/kunena/emoticons/sad.png)
regards
Please Log in or Create an account to join the conversation.
.
Iterpreter don't see #100 ,altough in MDI I see proper chaning 1/-1.
That's strange.
If you insert a line
(DEBUG, The parameter is #100)
#100 should be system-global. It might be worth trying #<_scale> instead. (an explicitly global named parameter)
Please Log in or Create an account to join the conversation.
When put MDI_COMMAND G54 #100 = 1
MDI_COMMAND G55 #100 = -1
Teminal display: emc/ask/emctask/.cc 374 interp_error -That I;m using unproper sign - ; 1
Just seen Andys post , ditto as per screenshot
I can only imagine re the second point you were in another co-ordinate system (G55) still, they are modal and do not change until you specifically do so.
Since the allocation in G55 failed, #100 would still be 0
regards
Please Log in or Create an account to join the conversation.
- grzesiekzxr
- Offline
- Senior Member
-
- Posts: 75
- Thank you received: 0
Please Log in or Create an account to join the conversation.
I have the same screens ,but even if I eliminate ofsets g54/g55 have only straight line should by square.
No mater if I'm using #100 or #<_scale> the same result.
I am possibly as puzzled as you now.
It is hard to tell exactly what the sequence of events was in the screenshots, but it looks like the values from the left/right buttons are being seen by the G-code, which is a good start.
From the preview (I think that red is X?) it actually looks like you get the X move but not the Y move?
Please Log in or Create an account to join the conversation.
- grzesiekzxr
- Offline
- Senior Member
-
- Posts: 75
- Thank you received: 0
Please Log in or Create an account to join the conversation.