plottertools / vpype-gcode

gcode extension for vpype
MIT License
35 stars 7 forks source link

Feature: add offset control #12

Closed abey79 closed 3 years ago

abey79 commented 3 years ago

This PR adds the following features:

This PR further addresses two issues:

cc @theomega

theomega commented 3 years ago

Funny, I noticed this yesterday evening that it is not great that the invert function actually touches the document as the show after the gwrite then displays not the original document anymore.

What I'm not understanding completely is how the scale and offset parameters would allow to invert the axis? If you want to invert the y axis, would you then set the scale_y to -1 and the offset_y to the maximum way of the y axis on the pen plotter?

theomega commented 3 years ago

I also think the invert_axis method is now unused and can be removed. And the README still contains an example with the old invert_y = true

tatarize commented 3 years ago

Ah, I had only checked the bundled for that.

tatarize commented 3 years ago

Yeah, pulled the reference, the function and bumped the version.

abey79 commented 3 years ago

What I'm not understanding completely is how the scale and offset parameters would allow to invert the axis? If you want to invert the y axis, would you then set the scale_y to -1 and the offset_y to the maximum way of the y axis on the pen plotter?

@theomega yeah exactly. If you use scale_x = -1, you most probably need to set offset_x to some value that is the width of the target plotter's usable space.

abey79 commented 3 years ago

Thanks @tatarize for cleaning after me. I did do this in a rush this morning without waiting for the full caffeine effect.

tatarize commented 3 years ago

If you want I've no qualms moving the whole repository over http://github.com/PlotterTools at some point or just having you slurp up all the code and then deprecate the whole thing. Especially if you correct your write routine such that you could do this without some gwrite stand-in command. I figure that would be the solid point to do integration or whatnot.

This lemme waste 4 hours thing, has literally the highest stars/time spent ratio. 8 / 5-8 hours. Whereas MeerK40t's sitting at 71 / 2000+.

tatarize commented 2 years ago

@theomega's point seemed to have gotten lost ithinkido has highlighted the issue for me again, and the implication in @abey79's comment was in error. Since the transformation between vpype's and the target's coordinate system does not depend on what needs to be drawn, this approach was erroneous IMO. -- This actually does depend on what needs to be drawn. Flipping the origin point from the upper-left to lower-left requires that we actually flip the image across the center of the image. You could do this with scale and offset. But, only if you offset the drawing by 50% of the size of the drawing which isn't something you know from within the toml.