svenhb / GRBL-Plotter

A GCode sender (not only for lasers or plotters) for up to two GRBL controller. SVG, DXF, HPGL import. 6 axis DRO.
https://grbl-plotter.de/
GNU General Public License v3.0
696 stars 176 forks source link

Tangential knife A-Axis turn command not getting included in applying height map #388

Closed vinevinz closed 6 months ago

vinevinz commented 8 months ago

Describe the bug

Before I describe the bug, I know standard GRBL cannot control 4 axis simultaneously. My board is MKS Tiny Bee with FluidNC (apparently works great with this software). The CNC plotter has XYYZA motor all Nema17.

So, I upgraded the machine to tangential knife instead of drag. I'm using rotary cutter directly attached to A axis motor (works like charm).

Problem is, cutting mat is not that flat, probing height map results got me ~0.6mm difference from one edge to the other. As I'm applying the height map to G-Code, the A axis command actually getting removed.

Is this a bug or just the feature not implemented? Or maybe I am doing it wrong, bcs honestly I'm using 3d printer bed leveling logic here (it looks very similar anyway with klipper leveling).

I'm trying to cut circle (has not been successful yet due to uneven flatness issue)

G-Code screenshot attached

To Reproduce Steps to reproduce the behavior:

  1. Load circle SVG, tangential knife enable on A-Axis
  2. Probe Z and height map (I am using 2 probe here, first for G38.2, second just limit switch for height map)
  3. Height-map = Z-offset -1 (my probing tool offset), max value 0.0
  4. Apply map
  5. New g-code generated without A axis

Expected behavior G-code includes A-Axis?

Screenshots Original G-Code Screenshot 2024-03-23 181038

Applied height map G-Code Screenshot 2024-03-23 181112

Other example, A-axis turn command without lifting knife getting omitted when applying height map(this is untested code, please ignore for so much knife lifting)

Screenshot 2024-03-23 182126

Applied G-Code Screenshot 2024-03-23 182159

Thank you!

svenhb commented 8 months ago

I need to check

svenhb commented 8 months ago

Try test version https://github.com/svenhb/GRBL-Plotter/blob/master/GRBL-Plotter_Setup_1731b.exe

vinevinz commented 8 months ago

Sorry for late reply, kinda busy weekend here

It is working but not properly, I will attach the video of without height map and with the height map. Applying height map makes A axis goes kinda crazy on sharp corners and does not work on circles.

This is the normal WITHOUT HEIGHT MAP:

https://github.com/svenhb/GRBL-Plotter/assets/29923628/3d85cf84-4b4d-405c-b8fc-93107e422688

This 2 is with the height map:

https://github.com/svenhb/GRBL-Plotter/assets/29923628/1e6ec445-a9f0-421f-b070-3df4e12d6252

https://github.com/svenhb/GRBL-Plotter/assets/29923628/1664bd9d-5c0e-4128-9919-a5647e897246

Free SVG attached if you wanna try

https://github.com/svenhb/GRBL-Plotter/assets/29923628/8dfa875e-67b9-49a3-b967-4644250196d2 https://github.com/svenhb/GRBL-Plotter/assets/29923628/c5af3cff-d48c-402e-9f37-c562f1a0ec87

vinevinz commented 8 months ago

On my further analysis I think I found the problem, when applying height map to the g-code, the program doesn't respect the inserted turn command when re-writing it. It just copy whatever A-Axis command after Z lift pen.

The screenshot of the g-code after applying height map from this version of program new inserted height map

Without height map applied, the program respects the turn command Screenshot 2024-03-24 210225

svenhb commented 8 months ago

Nice cutter 👍 Please try https://github.com/svenhb/GRBL-Plotter/blob/master/GRBL-Plotter_Setup_1731c.exe Also arc conversion works now (tested with simple shape)

vinevinz commented 8 months ago

Hi Sven,

Thank you, I am building dual head cutter and pen with servo to lift up the pen.

My initial testing looks promising for this version. However circle only works by disabling G2/3 arc commands, is that okay? I am new to CNC world and I don't know if that will be a problem. Besides circle every other pattern works amazing. I think only moves translated from G2/3 commands is broken.

Enabling G2/3 will make A-axis spin uncontrollably which creates beautiful art on its own. Btw I load circle from SVG not simple shapes (just for this testing purposes). unnamed

svenhb commented 8 months ago

However circle only works by disabling G2/3 arc commands,

Did you try allready version "c"? For me it works with G2/G3 command - also from SVG. https://github.com/svenhb/GRBL-Plotter/blob/master/GRBL-Plotter_Setup_1731c.exe

vinevinz commented 8 months ago

Hi sven, sorry for late reply it was crazy week here.

Yes it is working perfectly, I think it was installation problem because I was lazy to do clean install. Thank you very much for your help on this problem.

Btw, I have new problem of start and ending edges not meeting. Can you help suggesting whether this is a software or a hardware problem?

IMG_7072 IMG_7071

svenhb commented 7 months ago

I assume a hardware problem: If you woud use a "regular knife" - perhaps the knife blade is too weak (too long) and bends sidewards, when cutting the circle - as a result the circle radius becomes bigger. How stable is your holder? image

vinevinz commented 7 months ago

Hi Sven sorry for late reply, been doing hard work this last 2 week

I have question regarding how does the software determine starting point? Bcs I'm using rotary cutter which always overcut, I need to adjust the SVG so it will not overcut. It will be nice and easier to know where is the starting point when adjusting the design.

Example of starting point adjustment so, just make the starting point and end point separated by few millimeters.

Screenshot 2024-04-17 172746 Screenshot 2024-04-17 173509

Update on the machine: I have redesigned everything for Z gantry and upgraded beefier X axis. You are right it is hardware problem. I'm feeling very silly to make it this strong just to cut 0.8mm synthetic leather, no wonder the leather cutting machine cost at least 10k usd 😅

unnamed (1)

svenhb commented 7 months ago

If no sorting is active, the startpoint from the SVG will be used: image

I have an option for overlap in closed figures (for laser cutting), Do you need to apply the "under cut" to each figure or just to open figures? image

vinevinz commented 7 months ago

Wow that is new info, I just knew SVG got a starting point! Thank you so much!

I think under cut in every figure is nice especially in closed path, I mean everytime the knife needs to lift up and change direction it needs to undercut.

svenhb commented 7 months ago

I implemented path shortening, not sure if it meets your needs: https://github.com/svenhb/GRBL-Plotter/blob/master/GRBL-Plotter_Setup_1731e.exe image

vinevinz commented 7 months ago

That one works great! Maybe just maybe if you could, can you add path shortening for the start point too?

Since rotary cutter will overcut the starting point and end point right. I will attached sample svg and picture about what I mean.

tes pola sepatu speed-starting point

image_123650291

svenhb commented 7 months ago

add path shortening for the start point too

Yes, I can do. What should happen with paths which are shorten then the shortening? Delete at all?

svenhb commented 7 months ago

Try this version: https://github.com/svenhb/GRBL-Plotter/blob/master/GRBL-Plotter_Setup_1731f.exe

vinevinz commented 7 months ago

Yes it works great now! Thank you so much sven for the hard work, you are writing 2 new features just for me. This is a very amazing feature to have.

add path shortening for the start point too

Yes, I can do. What should happen with paths which are shorten then the shortening? Delete at all?

I think on ideal world it will be nice to give out options to delete at all or ignore path shortening for that path. But just delete at all will be fine. We can always fix it manually in the svg.

svenhb commented 7 months ago

I'm glad to hear it's working. Feel free to give me a star.

vinevinz commented 6 months ago

Hi Sven, I have completed my main build and I still have few questions for you, sorry for such an annoying user :(

  1. Is there anyway to use tangential axis path modification only on specific tool? For example, I load and SVG that includes path for 2 tools, 1 knife and 1 pen, but I only want the path modification only work on knife.
  2. Is there anyway to move diffrent group path simultaneously? With the same example, I load SVG containing path for 2 tools, 1 pen and 1 knife, they will each create a group based on the layer sorting on the SVG. I can't seem to move it together bcos they need to work together on same object to achieve the desired result. One draw on top, one cut on the same piece, just like your laser and pen example.

Thanks before!

svenhb commented 6 months ago

1) I experimented with machine settings given in SVG-Meta Data - perhaps thats a solution: https://grbl-plotter.de/index.php?id=form-setup-1#format-related Write down whats missing to get it work. 2) Thats not possible yet, will try to implement it, but needs longer time....

vinevinz commented 6 months ago
  1. I experimented with machine settings given in SVG-Meta Data - perhaps thats a solution: https://grbl-plotter.de/index.php?id=form-setup-1#format-related Write down whats missing to get it work.
  2. Thats not possible yet, will try to implement it, but needs longer time....
  1. Got it will try that out and get back to you.
  2. That is fine, I was just asking if there's any hidden feature,

By the way, I found another bug! Applying height map sometimes adding weird move to the A axis, which turns the blade 180 for a brief moment.

Take a look at line 434 and 435, the A axis doing 180 dance Screenshot 2024-05-08 114126

Screenshot 2024-05-08 114141

Result and image attached

Screenshot 2024-05-08 172739

unnamed (2)

Surely this move instantly chip off the tip of the rotary blade ( well im using cheap chinese ones, gotta try with the olfa japan blades later)

svenhb commented 6 months ago

From lines 433, 434 -> A0.51 to A-0.54 are just 1° difference, where is the 180° jump!? It is a motion almost only on +X (right) direction. From the 2D view and your picture the motion must be almost only +Y or -Y (up or down) direction... Can you upload the original graphic and show your import settings?

svenhb commented 6 months ago

And also the height map

vinevinz commented 6 months ago

From lines 433, 434 -> A0.51 to A-0.54 are just 1° difference, where is the 180° jump!? It is a motion almost only on +X (right) direction. From the 2D view and your picture the motion must be almost only +Y or -Y (up or down) direction... Can you upload the original graphic and show your import settings?

Yes it is 1 degree difference but the blade goes from positive to negative value. Isn’t that will rotate the blade 180? I will share the file details later.

vinevinz commented 6 months ago

Shared here:

  1. SVG File
  2. Generated G-Code with Height Map applied
  3. Height Map
  4. Machine settings

You could try the gcode with path simulation, it shows the blade direction turning 180

Link removed for safety reasons

svenhb commented 6 months ago

I could reproduce the problem with your data and fix. Please try: https://github.com/svenhb/GRBL-Plotter/blob/master/GRBL-Plotter_Setup_1731h.exe

To reduce data, I would use this settings: image

vinevinz commented 6 months ago

I could reproduce the problem with your data and fix. Please try: https://github.com/svenhb/GRBL-Plotter/blob/master/GRBL-Plotter_Setup_1731h.exe

To reduce data, I would use this settings: image

Hi sven,

this version works like charm fixing that bug. Thank you.

Apparently I can’t use your settings suggestion. Those settings will work fine with pen with bigger tip, but with blades only 0.3mm thick, it will cut jagged edges not smooth curves

svenhb commented 6 months ago

Now included in new release: https://github.com/svenhb/GRBL-Plotter/releases