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

Possible to look back/ahead? #24

Open
pomeroyb opened this issue Jun 18, 2022 · 3 comments
Open

Possible to look back/ahead? #24

pomeroyb opened this issue Jun 18, 2022 · 3 comments

Comments

@pomeroyb
Copy link

Hello! I'm trying to use vpype-gcode with a controller that is expecting commands to tell it to travel to a point and draw a line. Essentially the "point" function is used as a G0 command, and the "line" function is used as a G1 command. The point command is easily solved with "segment_first", but the line command needs to look like the following:

line((start_x, start_y), (end_x, end_y), speed = 4)

Right now my custom profile looks like this:

[gwrite.pewpew]
document_start = ""
segment_first = "point(({x:.4f},{y:.4f}), delay = 0.25, burn = 0)\n"
segment = "line(({x:.4f},{y:.4f}),({x:.4f},{y:.4f}), speed = 4)\n"
document_end = ""
unit = "in"
invert_y = true
info= "This gcode profile is correctly inverted across the y-axis"

The problem is that the segment cannot (as far as I can tell) refer to the coordinates of the previous segment, so I end up making a zero length line at the coordinates of the current segment. Ideally my toml would have the following:

segment = "line(({prev_x:.4f},{prev_y:.4f}),({x:.4f},{y:.4f}), speed = 4)\n"

Is there a way to do this in vpype-gcode or is this outside of the capabilities of the project currently?

@tatarize
Copy link
Collaborator

It's outside the current capabilities. Though it could probably be added. There's some entries for dx, dy so if you could use that rather than the actual previous value you'd be in luck.

@abey79
Copy link
Member

abey79 commented Sep 23, 2022

Well we have last_x/last_y lying around for the computation of dx/dy. Wouldn't it be trivial to just add them to the template variables? Am I missing something?

@tatarize
Copy link
Collaborator

Super trivial. It's an oversight it already doesn't work.

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