pcbnew CPolyLine::AppendCorner should call CloseLastContour
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
KiCad |
Invalid
|
Undecided
|
Unassigned |
Bug Description
running latest code. Version info below.
I have a proposed fix below for which I'm happy to submit a patch. I don't yet know the code
enough to predict what side effects this could have. Hence, I'm filing this bug report.
Description
-----------
For those that use the python scripting interface to create zones, it is easy to not know that
one must call CloseLastContour() on an outline after any calls to AppendCorner
If CloseLastContour is not called, saving the layout will yield a corrupt kicad_pcb file. One of the needed closing ')' is omitted.
This problem has also been mentioned here:
https:/
To reproduce,
-------------
run this script:
https:/
on any pcb. The pcb needs at least one net.
Then saveas and try to load the resulting file.
Proposed fix
------------
add
m_CornersList-
to the end of
void CPolyLine:
This is the error message given when trying to load:
Error loading board.
IO_ERROR: Expecting 'net, layer, tstamp, hatch, priority, connect_pads, min_thickness, fill, polygon, filled_polygon, or fill_segments' in input/source
'/bubba/
line 2947, offset 4
from dsnlexer.cpp : Expecting() line:369
on ubuntu 16.04 using
cmake -DCMAKE_
Application: pcbnew
Version: (2017-03-15 revision 3cc90ce)-master, debug build
Libraries: wxWidgets 3.0.2
Platform: Linux 4.4.0-66-generic x86_64, 64 bit, Little endian, wxGTK
- Build Info -
wxWidgets: 3.0.2 (wchar_t,wx containers,
Boost: 1.58.0
Curl: 7.47.0
KiCad - Compiler: GCC 5.4.0 with C++ ABI 1009
Settings: USE_WX_
void CPolyLine: :AppendCorner( int x, int y ) appends a corner to a polyline.
It is not intended to close the current polyline.
You can (and must) close the *current* contour only after the last point is entered.
m_CornersList- >CloseLastConto ur() closes the current polyline, and a new polyline can be started.
(after CloseLastContour(), call AppendCorner() add the first point of a *new* polyline
(for a zone: a new hole in the outline already defined).
The Kicad code is good.
The Python script is incorrect.