NC to GCODE?

I’ve been playing with PixelCNC and it looks very promising. However it spits out NC code, not gcode. Does anyone know of a converter or a method using maybe Repetier to convert it? I tried Estlcam but it just opened right into the CNC controller.

 

Edit: I just received a lengthy reply from the software developer (amazing customer service from this guy). When I get back to my desk I’ll share it here as it’s got some references that I don’t know as well as a lot of you will know. It sounds like it’s ALMOST as simple as changing the file extension and then doing some finding and replacing / deleting.

1 Like

Gcode is just a plain text file, you can change the extension to anything you want. The real important part is how it is formatted. I have never heard of that program but if you post your gcode we can see if it can actually be converted or not. Typically it would have a post processor so we can adjust the formatting ourselves.

1 Like

The following email will show you how great this guy has been to deal with. This is NOTHING compared to what he went through for me to get his software running on my dinosaur of a laptop. It’s been amazing working with him thus far. I most likely don’t need to post his entire email but it can’t hurt if anyone really wants to read into it and understand a bit about his software.

His response is as follows - the nc code I generated earlier is attached.

"

The G-code PixelCNC currently generates is "Mach3-compatible", although from what I can tell Marlin G-code appears mostly the same, but there are some differences, mostly pertaining to the fact that Marlin is geared more for 3D printing, but its G-code dialect is built on the plain G-code specification. (http://marlinfw.org/meta/gcode/)

I don't know much about Marlin specifically, but PixelCNC issues these G-code commands:

G20/G21 = interpret coordinates as inches/millimeters (Marlin)

G90 = enable absolute coordinate mode (Marlin)

G40 = disable cutter radius compensation (non-Marlin)

M3/M4/M5 = spindle cw/ccw/stop (Marlin)

M6 = tool change (non-Marlin)

M7/M8/M9 = coolant off/mist/flood (non-Marlin)

G0/G1 = rapid/feed (Marlin)

M30 = end program (Marlin, but means something else)

The commands I marked "non-Marlin" are commands that I'm sure Marlin will not recognize as anything at all, and there's a good chance it will just ignore them entirely, but it could error out complaining about encountering unrecognized commands. These commands are not listed on the Marlin G-code page at all for anything, so they will probably just be passed over and ignored.

The disable cutter-compensation G40 command is prefixed at the beginning of all PixelCNC G-code programs, along with a G20 (or G21) and a G90 command, and can be manually removed easily. I would be surprised if you had problems running G-code with the G40 or the M6 toolchange commands in there at all. Also, if you create your PixelCNC project's operations with coolant set to 'off' then the program generated will not have any of the coolant commands whatsoever, so you won't have to worry about the Marlin encountering any M7/M8/M9 commands at that point.

[** this is me again…..I should add here that the process of exporting the CNC programs is one pass / tool at a time. IE I saved off the roughing pass, then saved off the cleanup pass and then saved off the detail final pass. Three separate files for three separate tools. I’m trusting in my system of “moving everything to the corner” tool change for now. ]

Then there's the end-program M30 command, which means something else entirely to Marlin: "delete SD file". I'm guessing it's referring to deleting a file from an SD card that is plugged into the controller? I can't find any equivalent command to 'end program' on the Marlin G-code page so I'm guessing that you simply don't need an end-program command, and the program is just done when the controller encounters no more commands. You might need to remove the M30 commands from the end of PixelCNC's programs though, which is easy enough, but I imagine that at the very most it would error out when encountering an M30 - because there's no filename/path parameter following them in the G-code PixelCNC generates, but the program would be done running by the time it encounters the M30 so maybe that would not be a big problem anyway? At the very least I think it might just do nothing if it encounters an M30 that has no filepath parameter after it. That would be convenient. Otherwise just erasing that M30 line out at the end should be fine.

There's a good chance that the Marlin will gracefully ignore any unrecognized commands, instead of erroring out or going haywire and crashing or something bizzare. I'd try running PixelCNC G-code output as-is, just do something small and have it cut the air. If the G40/M6/M30 are all ignored then you won't have to worry about manually editing the CNC programs PixelCNC outputs at all. I'm sure it will spit out an error telling you about anything that trips it up and you'll be able to easily go in and make any change needed to appease the controller, but there otherwise shouldn't be any problems with everything else PixelCNC generates as far as toolpath feed/rapid commands and spindle commands. The Marlin controller should be able to execute all the toolpath traversal G-code just fine.

[** me again - I’m happy to try an air cut on something small…let me know if you think I should or if you know from above that there are definitely things I will want to edit out. ]

PhotoTestRough.nc (138 KB)

1 Like

It’s close but I don’t think it will work, we prefix all of our commands with G1 or Go (Same in marlin Cut and rapid in mach)(issue). We also need to be able to have different cut and rapids per axis. That has them all the same (biggest issue). Our Z can not move nearly as fast as our XY. Close but not close enough. The rest could be swapped but it is a lot of work, I tweak my files several times. batch jobs usually get tweaked each cut until I am happy. even a minor command swap would not be fun 4 times in an hour let alone every single time you wanted to use it.

 

Sounds like a good company but right now it is pretty far off. I didn’t look into it too heavy to see what features you are working so hard to get but nothing caught my eye from the quick skim.

You are just getting started, You have soooooooooooo many other things to deal with you should really stick with estlcam for a while, we have a post processor for other programs if you really find something you can’t do. You have to decide where you want to spend your time. I can help if there is a post processor file but without it it is dependent on that company to make it work.

1 Like

He mentioned developing a post processor into the software in future versions…hopefully I’ve put “marlin” on his radar. It’s a pretty slick turn key photo processor. I found it while looking for alternatives to Artcam which is no longer available. I think I can generate a good revenue stream if I can process photos into carves. I did find the image2code script for Fusion but it paled in comparison to the results I got just dabbling first go with PixelCNC.

Do you know of good photo converters? Perhaps I should stick to Fusion and sort the issues out with that setup?

1 Like

For what it’s worth Ryan, I’ve just sent a Pull Request to Marlin to use “Modal move” (or “Sticky move mode” as I call it).

It allows interpretation of G0/G1-less code, where only the “current move mode” parameters are sent on each line.

The PR also implements “parenthese” comments.

see CNC GCode dialect compatibility improvements by TheSFReader · Pull Request #12013 · MarlinFirmware/Marlin · GitHub :wink:

 

With regard to Z feed speed, I wonder why we don’t limit the max Z speed in the firmware to what is physically possible on that axis ? Doesn’t that limit apply correctly and cap the move ?

1 Like

We do, but for some reason it does not always work. Or at least did not previously, perhaps it was fixed. Most CAM relies solely on G0 and G1, that is the biggest issue for us and Marlin. Marlin treats them the same. If we had a proper Rapid command our Z retracts would no be an issue. That is why we use a feedrate on every line instead of just repeating the command.

From what I understand the Cam still needs to know all speeds as it can move all three axis at once and has to make sure the move does not violate the rapid (or regular) feedrate for any axis during that move. This might be where it goes bad. That is a pure guess on my part.

1 Like

i apologize for resurrecting this old thread, but after searching the forums found this applied to a question i had. i really like a web based program call easel. it generates gcode in the .nc format. really like its design elements and simple to use interface i wanted to use this. so i broke down the code and compared it to the code on the crown test.

  1. i replaced the header code from the crown test
  2. replaced g1 with g01 adding the extra 0 to all the g codes.
  3. set the feed rate (still working out the best feed rates for my setup)
  4. added a line of code at the beginning for the starting coordinate that set z axis to 0 (without it, it just carved air.
    under the edit tab in notepad it gives an option to replace all, makes the adjustments to the code pretty easy. i’m also a ridiculous novice to all this but thought i would share my experience.

from my initial tests it looks like this makes the .nc code useable for mpcnc. i plan to test more this weekend.

There are several topics on the forum that talk about Easel. I ran a test a couple of years back, and responded in this topic. At the time, if you placed your router at the level of the top of the stock in the lower left corner, and either cycled the electronics or use “Reset All Coordinates” from the menu, Easel g-code worked just fine without modifications. In some forum topics after that, others wrote some scripts that added to/modified the Easel g-code to provide some additional functionality. I think they provided the scripts, so if you are interested, you might search out topics with the keyword “Easel” on this forum.

I will admit I was searching for the file formats over the program, I will have to check out the threads mentioned. I’m still in the beginning stages of testing out my build and it’s capabilities, but have noticed so far on my testing my results seem better if I zero the coordinates each time.

Nc is the same as gcode, or gco. They are all text files with gcode.

You guys just need to use Estlcam for everything and get another board. :stuck_out_tongue:

1 Like

Fun to be reminded of the rabbit holes I used to live in. I’ll be back to this one for sure. Never really abandoned it - just sat it on the back burner. Still catching up on all I’ve missed after being away so long.

1 Like