Script bash
20 Nov 2014 17:02 #53229
by ArcEye
Replied by ArcEye on topic Script bash
Hi
Now that I know what you want, may have an idea.
This python program will automatically transform a gcode program, by flipping, mirroring or inverting axes.
sourceforge.net/projects/gcodetransposer/?source=typ_redirect
So having a button which activates a halui MDI command, which in turn runs a user M code script could
Take the current gcode file and run through GCode.py to flip X and Y moves, outputting filename-reversed.ngc
Use axis-remote to load filename-reversed.ngc
It can't be completely automated, because you still need to touch off to a new origin, or the 2 parts will touch along the 'mirror line', but it should give something to work with.
regards
PS
How do you get the current loaded filename if they vary? Sounds simple but isn't.
See my Axis modifications at mgware.co.uk
Now that I know what you want, may have an idea.
This python program will automatically transform a gcode program, by flipping, mirroring or inverting axes.
sourceforge.net/projects/gcodetransposer/?source=typ_redirect
So having a button which activates a halui MDI command, which in turn runs a user M code script could
Take the current gcode file and run through GCode.py to flip X and Y moves, outputting filename-reversed.ngc
Use axis-remote to load filename-reversed.ngc
It can't be completely automated, because you still need to touch off to a new origin, or the 2 parts will touch along the 'mirror line', but it should give something to work with.
regards
PS
How do you get the current loaded filename if they vary? Sounds simple but isn't.
See my Axis modifications at mgware.co.uk
Please Log in or Create an account to join the conversation.
- grzesiekzxr
- Offline
- Senior Member
Less
More
- Posts: 75
- Thank you received: 0
20 Nov 2014 21:50 #53239
by grzesiekzxr
Replied by grzesiekzxr on topic Script bash
Hallo.
Sory for the delay I haven't an internet in my workschop.
''It can't be completely automated, because you still need to touch off to a new origin''
I was thinking that Filter replace simple G54 -> G59.
MY idea is to Flter evryone g-code but produce mirror if (CONDITION) signal from button right is true.
When false put orginal g-code.
Next AXIS_REMOTE.
Ofcourse i dont' know how to check the signal/pin inside FILTER -script.
Sometimes ago I was checking GRECODE but it need terminal.
I belive that it can be automated becouse oly then it's soluion for me .
I appreciate your time.
Regards
Sory for the delay I haven't an internet in my workschop.
''It can't be completely automated, because you still need to touch off to a new origin''
I was thinking that Filter replace simple G54 -> G59.
MY idea is to Flter evryone g-code but produce mirror if (CONDITION) signal from button right is true.
When false put orginal g-code.
Next AXIS_REMOTE.
Ofcourse i dont' know how to check the signal/pin inside FILTER -script.
Sometimes ago I was checking GRECODE but it need terminal.
I belive that it can be automated becouse oly then it's soluion for me .
I appreciate your time.
Regards
Please Log in or Create an account to join the conversation.
20 Nov 2014 22:17 - 20 Nov 2014 22:33 #53241
by ArcEye
If you know where your new origin will be in relation to the old one , it could be automated.
You could go to that point in your current co-ordinates and then use G10 L20 to set that as the origin in a new co-ordinate system and switch to that.
The FILTER script is a bit of a blind alley which is masking other alternatives
They are meant simply for filtering a file loaded into Linuxcnc and producing an output that can be run as a ngc file, a graphics file though image2gcode for example.
Your idea already requires operator intervention, to press a button which indicates if the program should be normal or mirrored.
Why not use this button press to initiate what is required, rather than passively wait until a file load and then try to find a way to test if mirroring is required and do it inside a filter?
Old program finishes
Button press
Current file is processed to produce a mirror version
Axes are moved and shifted to new origin in another co-ordinate system
Mirrored file is loaded
Off you go again
There are a lot of other ways to do it too, I don't know your whole work process.
regards
Replied by ArcEye on topic Script bash
I belive that it can be automated becouse oly then it's soluion for me .
If you know where your new origin will be in relation to the old one , it could be automated.
You could go to that point in your current co-ordinates and then use G10 L20 to set that as the origin in a new co-ordinate system and switch to that.
The FILTER script is a bit of a blind alley which is masking other alternatives
They are meant simply for filtering a file loaded into Linuxcnc and producing an output that can be run as a ngc file, a graphics file though image2gcode for example.
Your idea already requires operator intervention, to press a button which indicates if the program should be normal or mirrored.
Why not use this button press to initiate what is required, rather than passively wait until a file load and then try to find a way to test if mirroring is required and do it inside a filter?
Old program finishes
Button press
Current file is processed to produce a mirror version
Axes are moved and shifted to new origin in another co-ordinate system
Mirrored file is loaded
Off you go again
There are a lot of other ways to do it too, I don't know your whole work process.
regards
Last edit: 20 Nov 2014 22:33 by ArcEye.
Please Log in or Create an account to join the conversation.
21 Nov 2014 01:19 #53246
by andypugh
Replied by andypugh on topic Script bash
Maybe 4 buttons?
1) Left of table / normal part
2) Left of table / Mirrored part
3) Right of table / Normal part
4) Right of table / Mirrored part.
MDI_COMMAND O<LN> CALL
MDI_COMMAND O<LM> CALL
MDI_COMMAND O<RN> CALL
MDI_COMMAND O<RM> CALL
O<LN> SUB
G54
O<NORMAL_PART> CALL
O<LN> ENDSUB
O<LM>SUB
G54
O<MIRROR_PART> CALL
O<LM> ENDSUB
O<RN> SUB
G55
O<NORMAL_PART> CALL
O<RN> ENDSUB
O<RM> SUB
G55
O<MIRROR_PART> CALL
O<RM> ENDSUB
You would need to wrap the part G-code in SUB / ENDSUB tags, but it would work.
1) Left of table / normal part
2) Left of table / Mirrored part
3) Right of table / Normal part
4) Right of table / Mirrored part.
MDI_COMMAND O<LN> CALL
MDI_COMMAND O<LM> CALL
MDI_COMMAND O<RN> CALL
MDI_COMMAND O<RM> CALL
O<LN> SUB
G54
O<NORMAL_PART> CALL
O<LN> ENDSUB
O<LM>SUB
G54
O<MIRROR_PART> CALL
O<LM> ENDSUB
O<RN> SUB
G55
O<NORMAL_PART> CALL
O<RN> ENDSUB
O<RM> SUB
G55
O<MIRROR_PART> CALL
O<RM> ENDSUB
You would need to wrap the part G-code in SUB / ENDSUB tags, but it would work.
Please Log in or Create an account to join the conversation.
- grzesiekzxr
- Offline
- Senior Member
Less
More
- Posts: 75
- Thank you received: 0
21 Nov 2014 02:29 #53247
by grzesiekzxr
Replied by grzesiekzxr on topic Script bash
Thanks again you are raely quick .
Now I see that can be good way.
Now I see that can be good way.
Please Log in or Create an account to join the conversation.
- grzesiekzxr
- Offline
- Senior Member
Less
More
- Posts: 75
- Thank you received: 0
21 Nov 2014 02:59 #53251
by grzesiekzxr
Replied by grzesiekzxr on topic Script bash
I'm readig script and trying to understand "sourceforge.net/projects/gcodetransposer/?source=typ_redirect"
But I 'm not sure which part schould put inside my ( script.-M150)
Supose in INI I have :
MDI_COMMAND O<RM> CALL
### I' not sure abut it above maybe MDI_COMMAND M150
Ofcourse MDI_COMMAND conected to button
Inside subroutine I schould put custom cod supose M150
M150 should include part acountable for mirror and replacing my Ocode responsible for horizontal drillings
Example if O<horiz_drill_x+>
then replace to O<horiz_drill_-x>
Can you help me write it corectly.
Regards
But I 'm not sure which part schould put inside my ( script.-M150)
Supose in INI I have :
MDI_COMMAND O<RM> CALL
### I' not sure abut it above maybe MDI_COMMAND M150
Ofcourse MDI_COMMAND conected to button
Inside subroutine I schould put custom cod supose M150
M150 should include part acountable for mirror and replacing my Ocode responsible for horizontal drillings
Example if O<horiz_drill_x+>
then replace to O<horiz_drill_-x>
Can you help me write it corectly.
Regards
Please Log in or Create an account to join the conversation.
21 Nov 2014 15:39 #53257
by ArcEye
Replied by ArcEye on topic Script bash
I'll have to leave Andy to explain his thoughts conclusively, but the way I read it is this.
Start with file part-normal.ngc, that goes in LN
Run through the gcode transposer to produce a vertical mirror image, that goes in LM
Run through the gcode transposer to produce a horizontal mirror image, that goes in RN
Run that code through gcode transposer to produce a vertical mirror image, that goes in RM
Then you have code which will produce each possible 2D mirror transposition of the original, just wrap them each in a sub and you can call them from
mdi commands attached to buttons
regards
Start with file part-normal.ngc, that goes in LN
Run through the gcode transposer to produce a vertical mirror image, that goes in LM
Run through the gcode transposer to produce a horizontal mirror image, that goes in RN
Run that code through gcode transposer to produce a vertical mirror image, that goes in RM
Then you have code which will produce each possible 2D mirror transposition of the original, just wrap them each in a sub and you can call them from
mdi commands attached to buttons
regards
The following user(s) said Thank You: grzesiekzxr
Please Log in or Create an account to join the conversation.
- grzesiekzxr
- Offline
- Senior Member
Less
More
- Posts: 75
- Thank you received: 0
22 Nov 2014 05:29 #53274
by grzesiekzxr
Replied by grzesiekzxr on topic Script bash
.....long day
I know that you give me all tips thanks.
But I'm not a programer and don't know how?
I can make button and connect to MDI_COMMAND O<LN> CALL,
I wonder what is necessary to put within O<LM>SUB
If I understand corectly I schould write sub
O<LM>SUB
G55
M150 (inside schould put GCode.py -all content , or only part responsible for mirror)
O<MIRROR_PART> CALL
O<LM> ENDSUB
I feel that I do not understand something.
I have to ask for support step by step .
I am grateful for help.
I know that you give me all tips thanks.
But I'm not a programer and don't know how?
I can make button and connect to MDI_COMMAND O<LN> CALL,
I wonder what is necessary to put within O<LM>SUB
If I understand corectly I schould write sub
O<LM>SUB
G55
M150 (inside schould put GCode.py -all content , or only part responsible for mirror)
O<MIRROR_PART> CALL
O<LM> ENDSUB
I feel that I do not understand something.
I have to ask for support step by step .
I am grateful for help.
Please Log in or Create an account to join the conversation.
23 Nov 2014 01:10 #53292
by ArcEye
Replied by ArcEye on topic Script bash
Hopefully tomorrow I will have time to put what I believe Andy was outlining, into a sim config, so that you can see it working.
You still seem to be leaning towards dynamic gcode transformation.
Do you use that many different programs on the one machine, that it is not practical to have a stock of 4 for each part, to cover all rotation possibilities?
If so, the answer would probably be to script the production of these rotations through a filter program.
That program can then write the code into a sub saved under a preset name which will be hard coded in the MDI command associated with a button.
It would be akin to the solution you first thought of in part, except that the filter produces all 4 possibles and the operator chooses which one to use manually via a button.
Still do not know how you deal with the issue of changing the origin for the next part to be cut.
Do you manually move to a new origin and touch off? Or have some automated offset from the existing one to achieve this?
regards
You still seem to be leaning towards dynamic gcode transformation.
Do you use that many different programs on the one machine, that it is not practical to have a stock of 4 for each part, to cover all rotation possibilities?
If so, the answer would probably be to script the production of these rotations through a filter program.
That program can then write the code into a sub saved under a preset name which will be hard coded in the MDI command associated with a button.
It would be akin to the solution you first thought of in part, except that the filter produces all 4 possibles and the operator chooses which one to use manually via a button.
Still do not know how you deal with the issue of changing the origin for the next part to be cut.
Do you manually move to a new origin and touch off? Or have some automated offset from the existing one to achieve this?
regards
Please Log in or Create an account to join the conversation.
- grzesiekzxr
- Offline
- Senior Member
Less
More
- Posts: 75
- Thank you received: 0
23 Nov 2014 05:00 #53299
by grzesiekzxr
Replied by grzesiekzxr on topic Script bash
Hallo my machine looks almost like.
""Do you use that many different programs on the one machine, that it is not practical to have a stock of 4 for each part, to cover all rotation possibilities?""
Yes I have only one cnc machine and unfortunately all day, I have to write new program .
Evryone program is different becouse evry cabinet kitchen are differ ofcourse there are similarities.
Just therefore I love NGCGUI.
""It would be akin to the solution you first thought of in part, except that the filter produces all 4 possibles and the operator chooses which one to use manually via a button.""
Thats great.
"Still do not know how you deal with the issue of changing the origin for the next part to be cut.
Do you manually move to a new origin and touch off? Or have some automated offset from the existing one to achieve thi"
In video youtube you can see that on the table are permanent base/support when I ferstly press button base rise then I put material when put again button base fall and program run.
LEFT BASE G54 X0 Y0 Z0 (here normal part) LEFT BUTTON
RIGHT BASE G59 X3500 Y0 Z0 (mirror part). RIGHT BUTTON
Many thanks.
Regards.
""Do you use that many different programs on the one machine, that it is not practical to have a stock of 4 for each part, to cover all rotation possibilities?""
Yes I have only one cnc machine and unfortunately all day, I have to write new program .
Evryone program is different becouse evry cabinet kitchen are differ ofcourse there are similarities.
Just therefore I love NGCGUI.
""It would be akin to the solution you first thought of in part, except that the filter produces all 4 possibles and the operator chooses which one to use manually via a button.""
Thats great.
"Still do not know how you deal with the issue of changing the origin for the next part to be cut.
Do you manually move to a new origin and touch off? Or have some automated offset from the existing one to achieve thi"
In video youtube you can see that on the table are permanent base/support when I ferstly press button base rise then I put material when put again button base fall and program run.
LEFT BASE G54 X0 Y0 Z0 (here normal part) LEFT BUTTON
RIGHT BASE G59 X3500 Y0 Z0 (mirror part). RIGHT BUTTON
Many thanks.
Regards.
Please Log in or Create an account to join the conversation.
Time to create page: 0.260 seconds