Script bash

More
10 Dec 2014 05:57 #53855 by grzesiekzxr
Replied by grzesiekzxr on topic Script bash
Thanks
Now I have:
#!/bin/bash

echo "M101 called"

axis-remote --clear;
axis-remote --mdi '#100 = 1' ;
axis-remote --reload ;
exit 0

#!/bin/bash

echo "M102 called"

axis-remote --clear;
axis-remote --mdi '#100 = -1' ;
axis-remote --reload ;
exit 0

(debug,#100)
g4p0.001
g17 g21
m6t1
g43h1
f10000
g0 x100 y300
g1y500
g1 x[300*#100]
g1 x100 y300
;;o<w>call[100][100][50][10][3][10][140][0][1]
m30

When sign & => without delay ,when sign ; => big delay and error: not posible....(EMC_TASK_PLAN_OPEN) manual mode

test.txt
(debug,#100)
g4p0.001
g17 g21
m6t1
g43h1
f10000
g0 x100 y300
g1y500
g1 x[300*#100]
g1 x100 y300
;;o<w>call[100][100][50][10][3][10][140][0][1]
m30


Unfortunately without success, still not refresh :dry: ,
regards

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

More
10 Dec 2014 18:08 #53864 by ArcEye
Replied by ArcEye on topic Script bash
Hi,

I can confirm your findings, if the parameter #100 is not set in the code that the plot interpreter reads, it just multiplies the X moves by 0 and produces a vertical Y plot

No amount of refreshing changes this and it does not matter when the parameter was set, unless you have #100 = something in your code, it does not work.

However run the program and it cuts the shape as required.

I will have to look at this a bit later.

When sign & => without delay ,when sign ; => big delay and error: not posible....(EMC_TASK_PLAN_OPEN) manual mode


I think that is why I went to spawning in the first place B)

regards

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

More
10 Dec 2014 18:17 - 10 Dec 2014 18:21 #53865 by andypugh
Replied by andypugh on topic Script bash

I can confirm your findings, if the parameter #100 is not set in the code that the plot interpreter reads, it just multiplies the X moves by 0 and produces a vertical Y plot


The preview is generated by a separate mini-interpreter. Perhaps this uses a private parameter space?

I assume that if you were to edit the file on disk to define #100 as +1 or -1 before pressing the button then the --reload command would give a correct preview (I am not suggesting this as the solution).

Maybe the answer is to use a GUI without graphical preview :-)
Last edit: 10 Dec 2014 18:21 by andypugh.

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

More
10 Dec 2014 20:19 #53868 by grzesiekzxr
Replied by grzesiekzxr on topic Script bash
Hallo .
I appreciate and I'm realy grateful for yours time,suport and expertise.
Prewiev is very helpful.
I will try
'' I assume that if you were to edit the file on disk to define #100 as +1 or -1 before pressing the button then the --reload command would give a correct preview (I am not suggesting this as the solution).''
In new versin Axis 2.6;2.7 is the same situacion/problem? :whistle:
Maybe if I use another globa parmeter it resolve problem?

regards.

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

More
10 Dec 2014 22:16 - 10 Dec 2014 22:17 #53873 by ArcEye
Replied by ArcEye on topic Script bash
Hi

Think I have solved this, at least for usage, if not why local values are ignored.

It appears that the preview interpreter ignores local values not set in the code. I have no idea why.
Wider than this, it actually ignores ALL volatile values, which includes those at 5000 and above.

However if you use a persistent parameter from a coordinate group you are not going to use, it will read it at each reload and reset the plot preview

I used #5381, which is the X coordinates in 59.3, just to keep it consistent if you ever wanted to mirror about another axis, eg Y

That works, it redraws the correct plot.

The only thing I did not try was setting the value externally, as I have not got a sim set up for that.
I set it through the MDI tab between program runs, but have no reason at all to believe the results will be any different

Try this out and see how it works for you

Andy Pugh wrote:

I assume that if you were to edit the file on disk to define #100 as +1 or -1 before pressing the button then the --reload command would give a correct preview (I am not suggesting this as the solution).


Yes it would and of course is what originally was happening, when the gcode was amended by running it though the filter.
Only in trying to use a simpler method of changing the sign, did this peculiar issue turn up

Like you, the only immediate reason I can arrive at is that it fills a private set of parameters in the same way as the program would when run.
So global persistent params are OK but local 'user' ones are zeroed and only those set in the code have values

regards
Last edit: 10 Dec 2014 22:17 by ArcEye.

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

More
11 Dec 2014 02:07 #53893 by Todd Zuercher
Replied by Todd Zuercher on topic Script bash
I've suspected as much.

Did you (or could you) try a persistent parameter (try adding #100 to the .var file)?

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

More
11 Dec 2014 02:37 #53894 by ArcEye
Replied by ArcEye on topic Script bash
Hi Todd

I have not tried 'making it persistent' by adding to the .var file
I'll add it to my list for tomorrow :laugh:

It will depend upon whether the preview interpreter actually reads the file or just has a hard coded list of persistent parameters internally, in which case it will not pick up any new ones anyway.

regards

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

More
11 Dec 2014 04:03 #53900 by grzesiekzxr
Replied by grzesiekzxr on topic Script bash
Hallo,
AT first sight working I'm happy again :laugh:
Axis refresh and see parameters-I conclude that only global -persistent variable are visible.
I have tried to add variable to my machine .var , like; 5401 -1.000000 ,but always is overwritten by value 0.
Is it possible to add own Global Variable Persistent -maybe in INI FILE ?

Many thanks
I can sleep quietly tonight ;)
regards.

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

More
11 Dec 2014 15:32 #53907 by ArcEye
Replied by ArcEye on topic Script bash

I have tried to add variable to my machine .var , like; 5401 -1.000000 ,but always is overwritten by value 0.


That is because 5401 is volatile, you have to use a persistent parameter.

www.linuxcnc.org/docs/html/gcode/overvie...umbered_parameters_a

You can add parameters to the .var file to make them persistent, but as I explained I don't know if the preview interpreter actually reads that file.

I also don't know whether you can make a parameter out of the normal user range, which is predefined as volatile, persistent by including it in the .var file

I'll leave you to experiment, 5381 works perfectly well you can just use that.

regards

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

More
11 Dec 2014 17:30 #53909 by grzesiekzxr
Replied by grzesiekzxr on topic Script bash
Hallo,
Of course I forgot about it becouse in my machine .var is only 5400 parameters ,so I took next 5401 forgetting that is volatile.

I checked by MDI and the greatest possible parameter is 5428 .
I can ad parameter like 5501 but it is not accessible I suppose by the AXIS (behind the range).

If in MDI write : #5501=-1 I have an error parameter behind the range,
if (debug,#5501) ###### i.
Therefore I don't see an option to add aditional variable.

Next what I want to achieve is conecting only right button to script which will change the extension from supposing .ngc to .inv .
Then I had a fully automatic process.

[FILTER]

PROGRAM_EXTENSION = .inv
inv= invertx

Inside script:

#!/bin/bash

cat $1 |sed 's/x\([ ]*\)\([-0-9\.]*\)/x[-1*[\2]]/g'

exit 0

This way I will use working two methods one :

-1 ;1 to resolve problem with subs
and second:

I will not have to write in any program x[x*#5381]

I'm happy that existing persistent variables are working and prewiev is visible. :)

Thanks
regards.

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

Time to create page: 0.104 seconds
Powered by Kunena Forum