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

Wrong Dimension when open this file #414

Open zengfanfan opened 2 months ago

zengfanfan commented 2 months ago

Describe the bug When open a g-code file, the minimal Z value is not right. ( should be 0, but we got 10)

Screenshots image

the g-code file bug.gcode.txt

svenhb commented 2 months ago

Ok will check. You can also upload files, instead of copying the content....

stujoult commented 2 months ago

Reproduced in older version. It treats z0 as non number. grblplotter Moving z0 to new line also fixes [Min X] grblplotter2

svenhb commented 2 months ago

In your example the difference is G0/G1: example 1: g0 x-1y0z0 example 2: g1 z0

G0 is a fast movement and therefore not part of a contour of the object = not relevant for the dimension. Only the movements G1, G2 and G3 are used to calculate the dimension.

I don't remember why I did it this way: dimension was only updated for Z, when z-position is not actual grbl z-position: if (posWasSet && (newLine.actualPos.Z != Grbl.posWork.Z)) { xyzSize.SetDimensionZ(newLine.actualPos.Z); } Is fixed now, I make a new release after finishing other changes...

zengfanfan commented 2 months ago

ok. looking forawd to it.