All the footprints have a ref-des field by default in KiCad, but if the
silkscreen text isn't present in the imported file, we should hide it.
If we see a silkscreen refdes, _then_ show it.
These seem like footprint fields, but there is no obvious way
to associate them. Dumping them on the the silk/fab layers creates
huge overlapping spam on the board, so for now, just leave them
out.
Allegro has a more "2D" layer system with classes (e.g. DEVICE TYPE)
and subclasses (SILKSCREEN_TOP), which make things difficult to
make map cleanly to KiCad layers.
Some texts were left out of the GRAPHIC_ITEM -> BOARD_ITEM
dispatch in some paths. Unify this item creation to avoid
this possibility (and reduce duplication).
This seems to be a lossy export conversion - it's not possible
to tell apart a closed zone and a line that happens to end where
it started.
Look for features that indicate that a sequence of graphics are
"open" and should be rendered as a set of discrete graphics,
or "closed" and should be a single polygon.
At least for objects in the BeagleBone Black export, this seems
to work well.
This is a bit of a hack as it will still only allow
9 more layers and drop the rest, but it's a start and
allows testing using the Beaglebone Black board and the
board in issue 19174.
Some circles are represented as ARC with start == end, but there
are also CIRCLE elements.
For consistency with the existing code, actually use 360-degree
arcs for circles (which also allows them to be used in polygon
holes if needed)
These appear to be 'unplaced' components, which we don't really
have a good way to represent at the moment. For the time being,
skip them.
Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/19174
By adding points to holes as we go, we leave ourselves open
to adding invalid (<3 point) holes to the polygons. This causes
crashes if it happens, so we should never allow it to happen.
Instead of building holes in-place, construct them externally
and only add them if they are valid.
This probably wouldn't actually happen for a valid Fabmaster
file, but if it did, it would be bad new, and we shouldn't leave
crashable pathways facing user input.
In the layer_order vector, the first is F_Cu, the last is
B_Cu, and everything else increments in steps of two.
The file in #19174's file showed this problem, but it's not
unique to that one, and it's a separate 8.99 issue.
Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/19174
Parsing an empty string as double/int produces uninitialised data.
That is likely to cause an undefined amout of chaos later on,
so catch it explicitly with a wxCHECK.
It's still something that shouldn't happen, and could still cause
chaos, but it's at least deterministic. It also avoids putting
gigantic numbers into things that don't expect them. For example
normalising an angle of 1e303 is functionally an infinite loop.
This happens at least in files with missing fields in rows,
like in #19174's file, line 4:
S!U2306!IC!!!!!!SOT_23_5!!!!!SGM2576/TT9107!!!
The file is still broken, but now it loads.
Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/19174
CHANGED: PCB file format now supports saving/loading complex padstacks
CHANGED: PTH pads are now rendered per copper layer in the copper color;
the PTH pad color is no longer used.
ADDED: support for importing complex pad stacks from Altium PCBs
Enforce padstack-aware access to pad properties across KiCad
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8182
There was a gentle mish-mash of booleans, some with
true being left/right and some up/down, and some functions that
can flip in both axes (which is never actually done, and doesn't
really make geometric sense).
Replace all this with the FLIP_DIRECTION enum class, which makes
the intention completely unambiguous.
This also then allows a small scattering of simplifications,
because everything takes the same type and you don't have to
fiddle booleans to fit.
This is primarily to change all instances of wxLogDebug with wxLogTrace
so developers do not have to sift through debugging output that is always
dumped. The only exception is for code blocks built in debug builds and
called on demand for dumping object states.
Pads with zero width or height cause issues when rendering and
selecting. KiCad has never allowed these elements but hasn't prevented
importing systems where they exist. This prevents their import and
cleans existing designs where the pads are placed
Fixes https://gitlab.com/kicad/code/kicad/issues/12200
ADDED arc, circle and rectangle shapes for schematic. Shapes support
line styles and fill colors.
CHANGED sheet background color in Edit Text & Graphics Properties to
fill color (and it now affects shapes).
Pushed STROKE_PARAMS down into common and moved all shapes to using it
for stroke descriptions.
KiCad breaks a bit when dealing with 360° arcs, so convert them to
circles on import. The break happens when converting to polygons for
viewing, the arc is passed from start->mid->end format to
center->start->angle format. At 360°, the angle is normalized to 0