How big can the G-Code be?

More
24 Mar 2014 05:18 #45168 by emdoteldot
Hello community,
i'm using my portal milling machine to raster scan a magnetic field with a Gauss probe with a self created g-code. I've created the g-code with labview as its a very simple one:
All i have to do is move as fast as i can to a certain coordinate (G0) and trigger the measurement with the cooling pin. The measurements are done by another program on another pc and can't afflict the CNC actions.
To do so i'm using the EMC2 Gui and load a G-code that consists of the commands: moving to a coordinate (X0 Y0 Z0), wait a bit, switch cooling on (M8), wait a bit (G04 P0.1)(to trigger the measurement of the magnetic field), switch cooling off and move to the next coordinate. The code is built sequential and without any iterations as shown in the following lines.

%
N0 G0
N5 X0 Y0 Z0
N10 G04 P0.1
N20 M8
N30 G04 P0.1
N40 M9
N50 X1 Y0 Z0
N60 G04 P0.1
N70 M8
N80 G04 P0.1
N90 M9
N100 X2 Y0 Z0
N110 G04 P0.1
N120 M8
N130 G04 P0.1
N140 M9
.... and so on %

As i have to scan a volume of 25mmx 50mm x75mm with a resolution of 1mm i'm currently trying to load a 8mb ngc.file with 503879 commandlines into the gui of emc2. I have tried it already with just 1000 lines of the same code, and there was no problem. Nonetheless if i try it with the whole .ngc file
Emc2 crashes and sends the bug report i've attached as a textfile from ubuntu. Is there a maximum filesize or a maximum number of commandlines EMC2 can handle? I can imagine that there are quite more complex exercises emc2 can work with than just those few 8mb of command lines.
Kind regards,
Michael

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

More
24 Mar 2014 05:31 #45169 by cmorley
Replied by cmorley on topic How big can the G-Code be?
What version of linuxcnc are you using?
Technically there is no limit other then memory.
Practically, it may be the preview that is crashing. ( I don't see the crash report)
Are you using AXIS? There are commands to control the preview:
www.linuxcnc.org/docs/2.5/html/gui/axis....axis_preview_control

See if that helps.

Chris M
The following user(s) said Thank You: emdoteldot

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

More
24 Mar 2014 20:04 #45185 by andypugh
Replied by andypugh on topic How big can the G-Code be?

I've created the g-code with labview as its a very simple one:

That's a rather eccentric approach :-)

The code is built sequential and without any iterations as shown in the following lines.

Why not code it as nested loops? That seems much easier.

Coolant on/off is handled by emcio and runs in user-space. To guarantee that your trigger pulses are synched to motion you probable want to use M62 / M63
www.linuxcnc.org/docs/html/gcode/m-code.html#sec:M62-M65

Coded as nested loops the code would be about 12 lines. It would actually take just as long to preview as your other code, though, so the Axis preview control comments would still be needed.

I can see advantages in logging the data on the CNC machine, including the possibility of ensuring synchronised sampling.
The following user(s) said Thank You: emdoteldot

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

More
25 Mar 2014 02:49 #45198 by newbynobi
I am pretty sure, that the preview is crashing your file. I tested that with my own gcode generator and big amount of code lines will result in very long loading time, or even chrashing the complete application.

Norbert
The following user(s) said Thank You: emdoteldot

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

More
25 Mar 2014 23:15 #45238 by emdoteldot
It was as you all said. The preview was the cause of the crash.
After i switched it off with "(AXIS, stop)" it loaded the code without further problems and the code is running since yesterday evening without errors.
@Andy
Next time i'll get deeper into gcode.Like this it took no time for me to hack it into labview as i'm accustomed to labview for years. I guess in labview i realized the nested loops that you meant.
I used 3 while loops with an iteration of an coordinate in each loop. I also included a small question-answer environment to create the g-code because like this its easy to be understood by other students in our lab that think gcode is a dresscode for illegal citizens ;)
We used the two computers because we have the accuisition software set just for labview and labview for linux is a pain to be set up. I've tried it, it works, but sometimes the chinese signs still appear so i start to get superstitious sometimes... just sometimes ;).
@Chris
Ty that was neat and easy. Just a few seconds of typing saved my setup of 3 weeks work.
@ Norbert
Exactly. it still takes a long time to load, but it loads now i've switched off the preview. I'll start working with nested loops now.

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

More
25 Mar 2014 23:47 #45240 by andypugh
Replied by andypugh on topic How big can the G-Code be?

Next time i'll get deeper into gcode.Like this it took no time for me to hack it into labview as i'm accustomed to labview for years. I guess in labview i realized the nested loops that you meant.

I used to program LabVIEW, I even did it full-time for a while (LabVIEW Realtime in fact). I can't imagine it being anyone's first choice for text processing. Matlab would have been better, I am sure.
For future reference, the G-code version would look a bit like this:
#1 = 0
O100 while [#1 LT 100]
#2 = 0
O200 while [#2 LT 100]
#3 = 0
O300 while [#3 LT 100]
M63 P1 (turn _off_ the output at the start of the next  move)
G0 X#1 Y#2 Z#3 
M62 P1
M62 P1 (turn _on_ the output)
G0 X#1 Y#2 Z#3 (dummy move to toggle the output state
G4 P0.1 
#3 = [#3 + 1]
O300 endwhile
#2 = [#2 + 1]
O200 endwhile
#3 = [#3 + 1]
O300 endwhile
M2

I think, however, that if I had been doing it I would have used a Glade GUI front end calling a G-code subroutine with step-sizes and axis limits as parameters.

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

Time to create page: 0.086 seconds
Powered by Kunena Forum