I am playing with the TopoMiller output. I am trying different tool paths and bits along the way.
I had been using the Scallop path operation but I did not like some of the tool marks.
I changed to a Ramp operation, since it gives an elevation cut feel, I still have not cut one yet.
I was looking at the path from straight down and found the path makes a great Topo representation. It looks so good, I want to make an etching from the path, but I need to change all the Z values to zero (accept for the retracts).
G-code isn’t too terrible to work with manually. You may be able to change them yourself with vscode or something. I’d highly recommend running any changed code through a simulator for a warm fuzzy feeling.
If you want to share the file I’d be interested in taking a look. An interesting idea for sure.
This has been pretty fun little AI test so far. Getting the tool paths flattened is straightforward enough and detecting loops is working fairly well.
The issue I’m running into at this point is the pesky transitions from one tool path to another from the original 3d. These lead ins and lead outs are harder to automagically detect than I would have thought.
No guarantees I’ll come up with anything but if I do, I’ll share it. The best bet for a real solution is to ask the topo folks for a feature to output these natively
I bet it’s pretty darn close to the logic used for laser tool path generation
Since gcode is modal, you could open the file in excel, set the first plunge to Z0, and parse the remaining Z parameters out and delete them. Resave the file as text and it should be flat. My Excel is currently running a Gcode modification which may take an hour. When done, I could mess with your file. Let me know. Cheers.
Edit: A quick look and I see the difficulty with my initial thought. However I do see G0Z0.2, isnt that the retracts?
Not 100% sure what I am looking at but the file I posted has minimal movements in Z remaining other than Z0.2. Can you view it in something like NC Corrector and let me know what needs modified?
I got into a squirrel action regarding this effort, so I wrote a windows batch file.
As I got going and remembered why I hated writing batch files at work.
I just downloaded Python and will go again.
So after 6 days of hacking away I got this to work with the following limitations.
The program writes the output file as it reads the input file.
It is SLOW !!!
The program assumes you used Top of stock so all cutting codes are Z- .
The data must have spaces between the values
Blank lines are ignored,
The reported line numbers will be incorrect by the number of blank lines encountered.
Comment lines are kept ( and %
Control C will stop the batch file.
Unzip the file and remove the .txt file extension parseNC.bat.zip (1.4 KB)
Example:
C:\Projects\gCode>parsenc
Please enter the Input filename: testg3.nc
You entered: testg3.nc
The file "testg3.nc" exists.
Please enter the Output filename: testme.nc
You entered: testme.nc
The file "testme.nc" will be created.
Reading "testg3.nc" line by line: 21:44:57.58
---------------------------------
replace Z Code Z-0.7491 with "Z0" line 22
replace Z Code Z-0.7813 with "Z0" line 23
replace Z Code Z-0.8075 with "Z0" line 24
replace Z Code Z-0.8114 with "Z0" line 25
replace Z Code Z-0.8152 with "Z0" line 26
replace Z Code Z-0.8188 with "Z0" line 27
replace Z Code Z-0.8222 with "Z0" line 28
replace Z Code Z-0.8252 with "Z0" line 29
replace Z Code Z-0.8277 with "Z0" line 30
replace Z Code Z-0.8298 with "Z0" line 31
replace Z Code Z-0.8313 with "Z0" line 32
replace Z Code Z-0.8322 with "Z0" line 33
replace Z Code Z-0.8325 with "Z0" line 34
^C^C^CTerminate batch job (Y/N)? y
I think this will work converting Ramp like passes into a Topographic like etching paths.
I am still going to make a python version. I would like to be able to set a “base” Z value instead of assuming 0. Batch files do not allow floating point math.