Script bash

More
28 Nov 2014 17:00 #53509 by grzesiekzxr
Replied by grzesiekzxr on topic Script bash
Hallo ,
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 :(

"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.

More
04 Dec 2014 04:47 #53655 by grzesiekzxr
Replied by grzesiekzxr on topic Script bash
Hallo.
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.

More
04 Dec 2014 05:11 #53656 by andypugh
Replied by andypugh on topic Script bash

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
The following user(s) said Thank You: grzesiekzxr

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

More
04 Dec 2014 19:35 - 04 Dec 2014 20:36 #53681 by ArcEye
Replied by ArcEye on topic Script bash
Hi

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
Last edit: 04 Dec 2014 20:36 by ArcEye.

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

More
05 Dec 2014 01:17 #53685 by grzesiekzxr
Replied by grzesiekzxr on topic Script bash
Hi
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:
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 :(
regards

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

More
05 Dec 2014 01:40 #53688 by andypugh
Replied by andypugh on topic Script bash

.
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)
in your G-code you should be able to see the value that is being used.

#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.

More
05 Dec 2014 01:46 #53689 by ArcEye
Replied by ArcEye on topic Script bash

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
Attachments:

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

More
05 Dec 2014 18:18 #53710 by grzesiekzxr
Replied by grzesiekzxr on topic Script bash
Hallo,
Thanks ArcEye,
Thanks Andypugh,
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 supose that is realy simple but....... :sick:
regards

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

More
05 Dec 2014 21:19 #53717 by andypugh
Replied by andypugh on topic Script bash

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.

More
05 Dec 2014 22:28 - 05 Dec 2014 22:56 #53719 by grzesiekzxr
Replied by grzesiekzxr on topic Script bash
''From the preview (I think that red is X?) it actually looks like you get the X move but not the Y move? ''
White line is in Y axis .
Dimension my working table;
X 3500 ;Y1300 ;Z 130




Probably I do some basic error ,but where?
regards
Attachments:
Last edit: 05 Dec 2014 22:56 by grzesiekzxr.

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

Time to create page: 0.198 seconds
Powered by Kunena Forum