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

Curved Line Spacing Problem #661

Open
TarGz opened this issue Sep 19, 2023 · 4 comments
Open

Curved Line Spacing Problem #661

TarGz opened this issue Sep 19, 2023 · 4 comments

Comments

@TarGz
Copy link
Sponsor

TarGz commented Sep 19, 2023

Issue Description:

I am encountering inconsistency in line spacing, particularly with curved lines.

Problem Details:

The issue manifests as inconsistent spacing between curved lines. When lines are drawn in one direction, they are positioned too closely together, while lines drawn in the opposite direction have excessive spacing.

Initially, I suspected that plotting in the opposite direction might be causing issues with my pen plotter. However, after a series of tests, I have concluded that this is not the root cause of the problem. Intriguingly, I created an SVG in Illustrator where half of the lines were reversed, and there were no issues encountered during the plotting process.

Steps to Reproduce:

  1. Enable the "linesort" option (note: the "flip" option is activated by default).
  2. Attempt to create a plot.
  3. Compare the line spacing consistency with a plot created without enabling the "flip" option.

Test Results:

  • Test0: linesimplify + linesort → (KO)
  • Test1: No options → (OK)
  • Test2: linesimplify → (OK)
  • Test4: linesimplify + manually reversing half of the lines → (OK)
  • Test5: linesimplify + linesort --two-opt → (KO)
  • Test6: linesimplify + linesort --no-flip → (OK)

This issue affects the consistency of line spacing in curved lines. I would greatly appreciate your assistance

vpype version 1.12.1

vpype --config gwrite.config read $1 layout -m 0mm a3 linemerge --tolerance $simplify_tolerance linesimplify linesort --no-flip stat forlayer gwrite -p megaplot $opt_filename"_%_name or _lid%.svg".gcode show end
My gwrite.config 

[gwrite.megaplot]
document_start = "M3S120\nG21\nG17\nG90\nG28\n$H\n"
segment_first =  "G1 Z0 F10000\nG0 X{x:.4f} Y{y:.4f} F15000\nG1 Z0 F6000\n M3S80\n\nG4 P0.5\n"
segment = "G1 X{x:.4f} Y{y:.4f} F10000\n"
segment_last = "G1 X{x:.4f} Y{y:.4f} F10000\n M3S120\n\nG4 P0.5\n"
document_end = "M3S120\n"
unit = "mm"
vertical_flip = true
info= "gwrite w04 :megaplot profile"

image

@abey79
Copy link
Owner

abey79 commented Sep 19, 2023

Wow, that's one well documented issue—thanks for that! 👍🏻

Off the top of my head, I don't have a direct hypothesis to explain why this happens. I suggest we investigate this more using the vpype viewer. I'm assuming you have various SVG files corresponding to the various trials. Let's overlay one over the other on the vpype viewer and see what happens there. This could be done as follows:

vpype read --layer 1 file_v0.svg  read --layer 2 file_v2.svg  color --layer 1 blue  color --layer 2 red  show

This loads both files in layer 1, respectively 2, and colors them differently.

In the viewer's menu, choose "Outline Mode" and "Show Points". That way, we can inspect how well both files overlap geometrically.

Also, I'm happy to take a look myself if you are will to share the files (ideally the original file, which I assume has actually SVG circles/arc(?) and the various test versions you produced.

@TarGz
Copy link
Sponsor Author

TarGz commented Sep 20, 2023

Thank you for the prompt response. I'll follow your recommendation to overlay the different versions. As of now, the half circle does not overlap in the test files I used. I plan to overlap them later and will send an update. In the meantime, here are the test files I've used:

https://www.dropbox.com/t/Tb2qoce6UIKjeimY

@TarGz
Copy link
Sponsor Author

TarGz commented Sep 20, 2023

I followed on your recommendation and conducted a test of overlapping an SVG file that was flipped with one that wasn't flipped and to display them in the viewer, and the results were surprisingly accurate. I also have checked the files in Inkscape and everything was perfectly aligned.

image

So I conducted another test to check if the issue could come from Vpype-gcode by merging two Gcode files (one with flip, one without) into the same document and viewed them in various Gcode viewers. It appears that they have a perfect match.

image

To check if the issues could be finally be related to my plotter, I plotted the merged Gcode file twice, once with a fine liner and the other time with a parallel pen. Surprisingly, the problem only occurred with the parallel pen. It may be due to some play in the pen itself, I will need to investigate further and try with different pen, but It's safe to conclude that the issue is not related to Vpype and you can close the issue.

image

I apologize for having incriminated to Vpype in, the first place :-). Thanks for your help on this and for making this great piece of software.

@abey79
Copy link
Owner

abey79 commented Sep 22, 2023

Again, some thorough follow-up 👍🏻 I'm glad vpype isn't too broken, but I wished we'd figure that one out.

I'm shooting a bit in the dark here, but maybe there is some weird interaction in with the plotter controller which could be affected by vertex density. It might be interesting to run a few test with various values of read -q XXX input.svg, which will yield a greater/lesser point density.

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

2 participants