FormerLurker / ArcWelderLib

A collection of projects used to convert G0/G1 commands to G2/G3 commands.
365 stars 39 forks source link

<FR>Processing non printer Gcode files #70

Open ithinkido opened 3 years ago

ithinkido commented 3 years ago

--EDIT-- I have since discoverd that Arcwlder will only process 3D prnter files with valid extruder moves ( E......). Would there be any chance of a a feature to process not 3D printer Gcode using a flag maybee ( eg -- non-printer) ? This would alow the use in other areas such as pen plotting where it would be greatly appreciated. What I could imagine is that using the --non-printer flag would then only process G1 > G2/G3 moves, ignoring the need for E moves.

I would like to process some Gcode for a pen plotter to reduce the code size and hopefully improve smoothness. I have tried with both the Windows and Linux versions, and although it appears that ArcWelder has successfully run, it does not seem to be creating any arc moves.The test file attached should be a good candidate for this. Is it possible that ArcWelder only works on 3D printer gcode files with a specific format ? spiral.nc.txt image

FormerLurker commented 3 years ago

You are in luck! I just finished a feature to encode travel moves (moves without any extrusion). It needs more testing, but here are the results from processing the file you posted:

image

Here is a side-by-side comparison of the tool paths:

image

The orange lines are G0/G1 commands, the blue lines are G2/G3 commands. As you can see, much of this file was successfully converted.

If you would like to try out the devel version, let me know and I'll post some instructions.

just-jason commented 3 years ago

If you would like to try out the devel version, let me know and I'll post some instructions.

Yes please, I definitely would like to try that out.

FormerLurker commented 3 years ago

Check here for the latest bin files. If you want you can post your gcode and I can do a sanity check before you try it out.

FormerLurker commented 3 years ago

Actually, i guess you will try the gcode you already posted, which I already reviewed, lol

just-jason commented 3 years ago

For my use this is PERFECT. The tests I have done are working just as I had hoped. There will be a lot of pen plotter users happy about this. Thanks very much.

FormerLurker commented 3 years ago

Hooray! If you have time, could you post a pic of your finished plot?

just-jason commented 3 years ago

Sorry fro the delay. A strange thing, I went to do a conversion again today, and I can not get Arcwelder to run. Very strange.

image

FormerLurker commented 3 years ago

Hmm.. I will look at the console app. It LOOKS like I must have screwed something up. Try adding a second parameter for giggles, like:

ArcWelder.exe perlin.gcode perlin.aw.gcode

and see what happens. Otherwise I messed up configuring TCLAP for the new parameters.

just-jason commented 3 years ago

Still the same

FormerLurker commented 3 years ago

Ok, will do my best to reproduce and fix. Might take a few days depending. Thanks!

FormerLurker commented 3 years ago

Ok, this was totally my fault, lol! Try the builds here, which I think should work much better.

just-jason commented 3 years ago

Looking good now. I was confused at first as the info stats did not show any converted arcs , but the end file has been converted so I would call that a success. image spiral.nc.txt

FormerLurker commented 3 years ago

I will look at that issue as well. It is a work in progress ☺️

FormerLurker commented 3 years ago

Ok, this should fix the statistics display issue.

just-jason commented 3 years ago

Perfect !!!


2021-07-18 14:41:11.010 - arc_welder.gcode_conversion - INFO - Processing GCode.
2021-07-18 14:41:11.011 - arc_welder.gcode_conversion - INFO - Arc Welder Arguments
        Source File Path             : spiral.nc
        Target File Path (overwrite) : spiral.nc
        Resolution                   : 0.05mm (+-0.02500mm)
        Path Tolerance               : 5.000%
        Maximum Arc Radius           : 9999mm
        Min Arc Segments             : 0
        MM Per Arc Segment           : 0.000
        Allow 3D Arcs                : False
        Allow Travel Arcs            : True
        Allow Dynamic Precision      : False
        Default XYZ Precision        : 3
        Default E Precision          : 5
        Extrusion Rate Variance %    : 5.000%
        G90/G91 Influences Extruder  : False
        Max Gcode Length             : Unlimited
        Log Level                    : INFO
        Hide Progress Updates        : False
Progress:  00.0% complete - Estimating remaining time.
Progress: 100.0% complete - 0.03 seconds total.
2021-07-18 14:41:11.043 - arc_welder.gcode_conversion - INFO - Target File Travel Statistics:
   Min          Max     Source  Target Change
---------------------------------------------
  0.000mm to   0.002mm       0       0   0.0%
  0.002mm to   0.005mm       0       0   0.0%
  0.005mm to   0.010mm       0       0   0.0%
  0.010mm to   0.050mm       0       0   0.0%
  0.050mm to   0.100mm       0       0   0.0%
  0.100mm to   0.500mm       0       0   0.0%
  0.500mm to   1.000mm     156       9 -94.2%
  1.000mm to   5.000mm    7084    2688 -62.1%
  5.000mm to  10.000mm       0     388    INF
 10.000mm to  20.000mm       0      14    INF
 20.000mm to  50.000mm       0       0   0.0%
 50.000mm to 100.000mm       0       0   0.0%
          >= 100.000mm       1       1   0.0%
---------------------------------------------
Total distance source:............10718.980mm
Total distance target:............10720.180mm
   Total count source:...................7241
   Total count target:...................3100
 Total percent change:.................-57.2%
2021-07-18 14:41:11.044 - arc_welder.gcode_conversion - INFO - Target File Extrusion Statistics:
   Min          Max     Source  Target Change
---------------------------------------------
  0.000mm to   0.002mm       0       0   0.0%
  0.002mm to   0.005mm       0       0   0.0%
  0.005mm to   0.010mm       0       0   0.0%
  0.010mm to   0.050mm       0       0   0.0%
  0.050mm to   0.100mm       0       0   0.0%
  0.100mm to   0.500mm       0       0   0.0%
  0.500mm to   1.000mm       0       0   0.0%
  1.000mm to   5.000mm       0       0   0.0%
  5.000mm to  10.000mm       0       0   0.0%
 10.000mm to  20.000mm       0       0   0.0%
 20.000mm to  50.000mm       0       0   0.0%
 50.000mm to 100.000mm       0       0   0.0%
          >= 100.000mm       0       0   0.0%
---------------------------------------------
       Total distance:................0.000mm
   Total count source:......................0
   Total count target:......................0
 Total percent change:...................0.0%
2021-07-18 14:41:11.046 - arc_welder.gcode_conversion - INFO - Arc Welder process completed successfully.
fabien commented 2 years ago

I'm trying to use ArcWelder (1.2.0) using the CLI on macOS to prepare files for my CNC outfitted with a tangential knife cutting module (my controller handles the knife axis rotation automatically, I just feed it G1/G2/G3 instructions).

Even though my source files don't have any E codes, the G1 instructions are being output as G2/G3 - this is without the --allow-travel-arcs option (which I think is for non-3D printing use-cases like mine).

Granted, it did not work on all files (like this one: https://gist.github.com/fabien/4eb67e67cf116236b61d50d6e936d6b9), so I decided the --allow-travel-arcs option instead.

However, when I do set --allow-travel-arcs I don't get any G2/G3 conversion at all, not even on the ones that converted before - all G1's remain untouched (same for spiral.nc above). So it appears to work exactly in the opposite way for me, which seems very odd (in fact, in 1.2.0 adding this flag will actually disable this feature, setting Allow Travel Arcs: False).

Unfortunately, I cannot find release binaries for v.2.0 to see if it makes any difference. In the meantime I have tested more input files from CNC (milling) CAM software, and those don't process into G2/G3 at all, even when Allow Travel Arcs is True as shown in the output log ...

I cannot see why this converts and the gist above doesn't. Any thoughts?

EDIT: turns out the reason why some files were not being processed correctly is simply the fact that they contained G01 instructions instead of G1.

In other words, the parser should have been more lenient, as usually both formats are permitted.

FormerLurker commented 2 years ago

@fabien,

I believe I fixed the inverted option for --allow-travel-arcs, but still need to add detection of the G01 as opposed to G1. It's unfortunate that these are both valid commands, as this will increase parsing time for everyone :(. However, compliance is compliance, so I'll get that working too. Thanks for the report!