Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error of 2D viewer when loading gcode files with G2/G3 arcs #1433

Closed
neofelis2X opened this issue Jun 17, 2024 · 3 comments
Closed

Error of 2D viewer when loading gcode files with G2/G3 arcs #1433

neofelis2X opened this issue Jun 17, 2024 · 3 comments

Comments

@neofelis2X
Copy link
Contributor

Hi, I just noticed that when I use the 2D viewer and try to load a gcode file with G2 and G3 movements (arcs), then I get the following error message. And the visualisation fails.

Traceback (most recent call last):
  File "printrun\gviz.py", line 432, in paint
  File "printrun\gviz.py", line 384, in repaint_everything
  File "printrun\gviz.py", line 351, in _drawarcs
TypeError: DC.DrawArc(): arguments did not match any overloaded call:
  overload 1: argument 1 has unexpected type 'numpy.float64'
  overload 2: argument 1 has unexpected type 'numpy.float64'

As an example you can try this file from printables. But it seems to happen with all files that contain G2/G3 moves.

It is the same error on windows and macOS. It occurs from version 2.0.0 but NOT in version 2.0.0rc8.
Probably pretty easy to fix.

@DivingDuck
Copy link
Collaborator

DivingDuck commented Jun 17, 2024

Good catch. I had test this with 3D view as I had wrote a test macro for testing my firmware but never tried to test it in 2D view...

Guess I know where the problem is. This came with Python 10 introduced stricter type verification. We had a lot of troubles with this in the past (e.g. #1224). It seems to be one of the so fare not identified parts of the code in this module.

gviz.py, line 334+:

    def _arc_scaler(self, x):
        return (self.scale[0] * x[0],
                self.scale[1] * x[1],
                self.scale[0] * x[2],
                self.scale[1] * x[3],
                self.scale[0] * x[4],
                self.scale[1] * x[5],)

I will change this.

Macro ArcModeG2G3:

G2 X10 Y20 I30 J40 F8000
G3 X10 Y20 I30 J40 F8000
G2 X10 Y20 I30 J40 F8000
G3 X10 Y20 I30 J40 F8000
G2 X10 Y20 I30 J40 F8000
G3 X10 Y20 I30 J40 F8000
M84

@DivingDuck
Copy link
Collaborator

@neofelis2X
Copy link
Contributor Author

That was superfast! And yes, works perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants