Paint tool behavior isn't the expected for imported svg polygons with holes
Importing a .svg file containing a path that defines a polygon with a hole seems to work fine, at least it is displayed properly by canvas. Try to perform a paint operation and notice that FlatCAM isn't actually dealing with a polygon, in fact the geometry was imported as multiple LineStrings.
Trying to perform a paint operation on the polygon with a hole yields the following behavior.
Case 1 - Trying to paint the single geometry. [WARNING_NOTCL] Click inside the desired polygon. (Clicked in the red area of the attached polygon debug_rebaixo.svg) Painting polygon... [WARNING] No polygon found. (Nothing gets painted)
Case 2 - Trying to Paint all the the geometries: Some painting is done this time, however the results are unexpected. --The LineString (in green) shouldn't be painted --The polygon is painted as a whole, so the hole is ignored. (results presented in Bad Painting.png)
In both cases, the expected result should be Expected Painting.png
Comments (8)
-
reporter -
reporter - attached Expected Painting.png
- edited description
Added a picture showing the expected result for the painting operation.
-
- changed status to resolved
Fixed by the reporter, Victor Benso, merged in commit 0cca691
-
I am having problems with this on FlatCAM 8.993 Beta (2020/06/05). Specifically, I’m importing an SVG with large bold letters on it. I can paint shapes that don’t have holes in it (e.g., MNZLKJT, etc…) but I cannot paint shapes that have holes in them (e.g., QOPRB). When I click on a shape with a hole in it, it says that it can’t find a polygon where I’m clicking.
This isn’t just limited to the paint tool. If I try to trace the outlines of these shapes using the Isolation tool (1. import svg as a gerber, 2. apply isolation tool) only the shapes without holes get traced. Shapes with holes do not get traced.
-
- attached debug_rebaixo_with_o.svg
I saw that I could get the paint tool to work with the debug_rebaixo.svg. I copied an “O” from my svg file into the debug_rebaixo.svg, to see if it would paint. When I import debug_rebaixo_with_o.svg into FlatCAM, the rebaixo icon paints just fine, but the o does not. I saw that the o was rendered as a group in my original attachment. I tried ungrouping it in inkscape, but that didn’t fix the problem either. I tried copying the xml style tag from one of the other shapes and that didn’t fix it either.
-
- changed status to open
-
Hi,
This was a closed issue so I could not have seen it. In any case I re-opened it.
In the latest commit on my fork of FlatCAM here is how your SVG is loaded:1. As Gerber:
2. As Geometry:
If I paint the Geometry (step 2 above) with All method:
Or if I paint in Paint Plugin only the poly from the center of the letter ‘O' you’ve added:
Or the outer poly of the letter 'O':
Please also understand that there are some limitations in the support for the SVG (or for that matter for the DXF) imported geometries.
As far as I am concerned this works as expected in the current sources.
BR, Marius -
Thanks for the follow-up. It seems like there must be some underlying difference in the way that the circle vs the square is set up. But I don’t know enough about SVGs to be able to intelligently debug it.
- Log in to comment
Weird fact, even that the file debug_rebaixo.svg has two paths, (check its source inside the .svg if you don't believe) the browser's preview doesn't show both paths.