eechema Plot/Export to SVG closes polylines incorrectly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
KiCad |
Fix Released
|
Low
|
Seth Hillbrand |
Bug Description
The patch https:/
I encountered this issue plotting an SVG of this project schematic: https:/
An earlier KiCad version (5.0) plotted the schematic correctly:
```
Application: kicad
Version: (5.0.0-3-g5ebb6b6), release build
Libraries:
wxWidgets 3.0.4
libcurl/7.30.0 SecureTransport zlib/1.2.5
Platform: Mac OS X (Darwin 13.4.0 x86_64), 64 bit, Little endian, wxMac
Build Info:
wxWidgets: 3.0.4 (UTF-8,STL containers,
Boost: 1.67.0
OpenCASCADE Community Edition: 6.9.1
Curl: 7.51.0
Compiler: Clang 8.0.0 with C++ ABI 1002
Build settings:
USE_
USE_
KICAD_
KICAD_
KICAD_
KICAD_
BUILD_
KICAD_
KICAD_
KICAD_SPICE=ON
```
I first encountered the incorrect rendering with KiCad version 5.1.2 (which also had another black & white SVG plotting bug):
```
Application: kicad
Version: 5.1.2-f72e74a~
Libraries:
wxWidgets 3.0.2
libcurl/7.59.0 mbedTLS/2.8.0 zlib/1.2.11
Platform: Linux 4.15.0-55-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
wxWidgets: 3.0.2 (wchar_t,wx containers,
Boost: 1.58.0
OpenCASCADE Community Edition: 6.8.0
Curl: 7.47.0
Compiler: GCC 5.4.0 with C++ ABI 1009
Build settings:
USE_
USE_
KICAD_
KICAD_
KICAD_
KICAD_
KICAD_
KICAD_
BUILD_
KICAD_
KICAD_
KICAD_SPICE=ON
```
I tested yesterday with a nightly version of KiCad and verified that the incorrect SVG plotting still occurs (though the other black & white plotting SVG bug I encountered appears to have been fixed):
```
Application: Eeschema
Version: 6.0.0-unknown-
Libraries:
wxWidgets 3.0.4
libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Platform: Linux 4.15.0-55-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
wxWidgets: 3.0.4 (wchar_t,wx containers,
Boost: 1.65.1
OpenCASCADE Community Edition: 6.9.1
Curl: 7.58.0
Compiler: GCC 7.4.0 with C++ ABI 1011
Build settings:
KICAD_
KICAD_
KICAD_
KICAD_
KICAD_
KICAD_
BUILD_
KICAD_
KICAD_
KICAD_SPICE=ON
```
Here is a partial diff between the correct plot in version 5.0 and the incorrect plot in 5.1.2 (note the addition of the "Z"):
```
@@ -10467,19 +11446,23 @@
<g style="
stroke:#000000; stroke-width:100; stroke-opacity:1;
stroke-
-<polyline fill="none;"
-points=
+<path style="
+stroke:#000000; stroke-width:100; stroke-opacity:1;
+stroke-
+d="M 91500,14250
91750,14500
92000,14250
92500,14250
-" />
-<polyline fill="none;"
-points=
+Z" />
+<path style="
+stroke:#000000; stroke-width:100; stroke-opacity:1;
+stroke-
+d="M 92500,13250
91250,13250
91250,14250
91000,14500
90750,14250
-" />
+Z" />
</g>
```
This example SVG file patch results in a correct plotting (for that portion of the component):
```
--- /<path>
+++ /<path>
@@ -11462,7 +11462,7 @@
91250,14250
91000,14500
90750,14250
-Z" />
+" />
</g>
<g style="
stroke:#000000; stroke-width:60; stroke-opacity:1;
```
Note that the code patch in question removed a conditional check (potentially due to the fact that the later "Close/(fill) the path" comment didn't really reflect what the last piece of code was doing):
```
@@ -492,16 +505,7 @@ void SVG_PLOTTER:
fprintf( outputFile, "%d,%d\n", (int) pos.x, (int) pos.y );
}
- // ensure the shape is closed, for filled shapes (that are closed polygons):
- // (svg does not close automatically a polygon
- if( aCornerList.front() != aCornerList.back() && aFill != NO_FILL )
- {
- pos = userToDeviceCoo
- fprintf( outputFile, "%d,%d\n", (int) pos.x, (int) pos.y );
- }
-
- // Close/(fill) the path
- fprintf( outputFile, "\" /> \n" );
+ fprintf( outputFile, "Z\" /> \n" );
}
```
I'm guessing but haven't verified that moving the output of the "Z" back inside the original conditional may fix the issue--but I don't know if that would have any unintended consequences elsewhere.
Changed in kicad: | |
importance: | Undecided → Low |
assignee: | nobody → Seth Hillbrand (sethh) |
milestone: | none → 5.1.5 |
tags: | added: eeschema export plot sag |
tags: |
added: svg removed: sag |
Changed in kicad: | |
status: | Fix Committed → Fix Released |
I just realised that this also affects all the arrows the LEDs. (See new attachment.)