Allows placing parts from an external database that reference symbols from another loaded library.
Includes:
- nanodbc wrapper
- database schematic library plugin
- basic tests
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7436
The commit bumps the schematic file format version in order to fix the
initial symbol default instance data to the first instance of each symbol.
It also sets the initial instance data to undefined in the SCH_SYMBOL
ctor so on the first schematic save, the default instance will be set
to the first instance of the symbol.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12190
The legacy and s-expression (prior to version 20200828) file formats only
supported symbol unit and reference fields so the newly added value and
footprint fields must be updated from the original symbol fields.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12226
The fractional part of Altium schematic units is an integer number of
1/10000 mil segments, which is 2.54 nm. The internal unit of eeschema
is 10 nm, so each fractional unit in Altium is 0.254 base eeschema
units. To be consistent with
cf33cfcad1
we round to the nearest 10nm for each element
Fixes https://gitlab.com/kicad/code/kicad/issues/11742
The original decision to escape the legacy symbol library names results
in them being escaped every time they are opened which cause the curly
braces '}' from the original escaping to be escaped on subsequent
openings. This resulted in the symbol library names in the rescue
library not matching the library ID in the schematic.
This fix is likely to have other corner case bugs given the potential
for escaped characters in legacy symbol libraries. Given that we now
have escaped rescue libraries in play, removing the escaping will only
result in more issues so we will have to fix the corner cases as we go.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/11563
Prior to fixing the schematic file change churn do to instance data
changing to the last selected sheet instance, the symbol instance data
was set rather than empty. This change allows for users to set the
default instance data which is used for every new instance of the
schematic.
ADDED: Default schematic symbol instance data (unit and reference, value,
and footprint fields) can be set to be used as the default settings
for all new instances of the schematic.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/11113
In symbols, a polyline descr is already a true polyline / polygon descr.
In schematic, a polyline descr was restricted to only 2 points (a line).
A true polyline / polygon descr is now allowed in schematic that support already
polygons.
For compatibility reason, a 2 points polygon (SCH_SHAPE) is converted to a SCH_LINE.
Previously, coordinates were clamped to +- 60 inches. It makes no sense to
clamp them at plotter level: max cooed depends on the editor (schematic/board...)
Rename MAX_PAGE_SIZE_MILS to MAX_PAGE_SIZE_EESCHEMA_MILS and use it only for Eeschema.
Fixes#11196https://gitlab.com/kicad/code/kicad/issues/11196
The previous solution cleared all of the fields and force the unit setting
to unit one which would have less than desirable effects when reusing a
schematic in another project. This solution forces all of the instance
settings to the first sheet instance of the current project to prevent file
change churn when changing shared sheets in the current project.
This will not prevent shared schematic file changes when the first sheet
instance data differs between projects.
Arcs can be altered by the process of changing from on-disk
representation to in-memory representation. Saving back to disk without
modifying the arc should not modify the calculated values.
This stores a copy of the on-disk representation that is only used to
save back to disk in the event that the arc is not modified during
editing.
Fixes https://gitlab.com/kicad/code/kicad/issues/10442
Removes the ability to hide symbol units in file formats. This was
mostly the case for a while but there remained corner cases where we
left a default/hidden option
Fixes https://gitlab.com/kicad/code/kicad/issues/10888
KiCad has stricter requirements for what consititutes an annotated
symbol. This checks for and corrects annotations that begin with '#',
do not begin with a non-numeric character or do not end with a number
gcc doesn't need it and computes during compile regardless, but experimenting in godbolt, both clang and MSVC actually do need it or else it's partially computed at runtime
Also fixes some plot bugs with arcs.
Also moves polygonization of arcs (when required) in plotting code
from 5 degrees to calculated based on ARC_HIGH_DEF.
Fixes https://gitlab.com/kicad/code/kicad/issues/5017
This one is primarily about pushing TEXT_ATTRIBUTES in to the GAL
API, but it also includes adding EDA_ANGLE signatures to some trig
routines to ease integration.
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.
It is no longer acceptable to set a LIB_FIELD index to -1. This was
trashing the sorting on load cause all kinds of false field comparison
failures. There are now assertions when attempting to use -1 as a field
index.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9811
Always use full sheet paths when storing sheet instances. Partial sheet
paths cannot be full resolved resulting in lost page numbers when renaming
sheet file name.
Fixes#9782
Remove duplicate instance data saved in both root SCH_SCREEN and SCH_SHEET
objects that was causing them to be out of sync. All sheet instance data
is stored in the SCH_SHEET object itself and rebuilt on the fly so it is
always current.
Remove Get/SetPageNumber from SCH_SHEET_PATH object so it doesn't obfuscate
where the actual sheet page number information exists.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9782
Symbol library IDs included the library nickname which is incorrect
and meaningless since it will be overwritten by the symbol library
table code. This is not a file format change as there are no behavioral
differences.
1) we're storing it now anyway
2) the root sheet UUID is the one UUID that's *not* in the instance
array, and previously we were erroneously grabbing the first sub-sheet's
UUID (producing duplicate UUIDs).
For some reason, escaped double quotes in wxString::Format cause issues
on Mac. We can replace them with single quotes in most places without
loss of clarity
Don't attempt to calculate bounding box of text variables. We do not
know the resolution of the text variable inside the importer. The
resolved text could be shorter than the text variable (e.g. ${#}
page number)
KiCad doesn't support multi-line text in fields, so we can't load it as
a text field (even if that would be the closest thing).
We should update this when KiCad supports multi-line text in fields.
The tests for file existence and write status perform two file stats
which cause performance issues on slow network shares. Now the file
state is determined at load time and stored in the SCH_SCREEN object
so file access is no longer required.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9343
Escaping the document file (.dcm) alias names breaks the link between the
document file and the library (.lib) file. This causes the information in
the document file to be lost.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9130
- Update sch text help (~~ no longer gets converted to single ~)
- Update Eagle importer to correctly handle new overbar syntax
- Update CADSTAR importer to correctly handle new overbar syntax
For historical reasons they are stored in a string using spaces as separators.
So each fp filter is now escaped to remove spaces (replaced by {space})
Fixes#9009https://gitlab.com/kicad/code/kicad/issues/9009
This has actually been there since dot, but the old escaping method
just deleted chars it didn't like so you could run it as many times
as you wanted.
Fixes https://gitlab.com/kicad/code/kicad/issues/8694
They don't define a KiCad string class, so the header file name was
somewhat misleading. But the fact that they didn't match definitely
made coding more difficult.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8844 (power port text positioning, only use 0, 90deg for text)
Adjust text justification due to rotation on import
Set field position through SCH_FIELD::SetPosition
Honor hidden net names at power ports
Calculate start/end points for imported arcs in symbols
Found via `codespell -q 3 -S *.po,./thirdparty -L aactual,acount,aline,alocation,alog,anormal,anumber,aother,apoints,aparent,aray,dout,einstance,modul,ot,overide,serie,te,,tesselate,tesselator,tht`
1) Fix a couple of bugs in case processing
2) Make case processing more explicit to prevent more (1)
3) Move label processing to AltiumSpecialStringsToKiCadVariables
4) Strip double-quotes from special strings (and add test cases)
5) Change PROJECTNAME to just filename, not full path
6) PROJECTREV and REVISION are two different things
7) Add support for Altium's Application_BuildNumber
8) Fix some issues in trimming spaces around special strings
ADDED CURRENT_DATE titleblock token (to go with existing ISSUE_DATE)
ADDED PROJECTNAME schematic token (to go with FILENAME and SHEETNAME)
Converts other parameters to project text variables.
Note that there's still a bunch of stuff we don't support regarding
textframes such as wordwrap and background colours, but this at least
keeps the text from getting lost.
Fixes https://gitlab.com/kicad/code/kicad/issues/8741
Also fixes a bug where an empty window would get left when loading
a file from the KiCad manager window errored out.
Also fixes a bug where we were getting the wrong exception because
we were rethrowing the type-casted one (rather than just calling
throw).
Fixes https://gitlab.com/kicad/code/kicad/issues/8604
It's tempting to say that we don't need to exclude filename chars
from symbols, but we might regret that decision down the road. Better
to just escape them.
Fixes https://gitlab.com/kicad/code/kicad/issues/8694
wxString::Format is redundant in a wxLogXXX call.
Error messages should generally be translatable.
Error messages should use generally consistent sentence forms.
You probably do want it in VALUE, but not REFERENCE, and certainly
not FOOTPRINT or DATASHEET. User fields are more likely to be
part numbers, etc. (and don't want conversion).
Fixes https://gitlab.com/kicad/code/kicad/issues/8617
1) Make sure we set an absolute path on the sheet.
2) Don't mix RTree iterators; wires get skipped between buses.
3) Implement a real ERC error so we don't assert.
Fixes https://gitlab.com/kicad/code/kicad/issues/7042
Simplify logic by adding quadrant-based BUS_ENTRY ctor.
Fix issue with bus entry size having been in mils rather than IU.
Fix issues with logic.
Fixes https://gitlab.com/kicad/code/kicad/issues/7042
The same logic block to resolve possible symlinks exists in 5 different
places now. This change moves this duplicated code to a static member
function of WX_FILENAME instead.
Use `realpath(3)` instead of `readlink(3)`, which offers support for
relative and absolute symlinks alike, since all symbolic links will be
resolved to the absolute path of the linked-to file.
Fixes#8082
This was leaking windows headers and partial wx headers to 1084 compilation units......
This also means math/util.h is leaking to 1084 compilation units which seems a bit high too.
In CADSTAR pins are single points. We can replicate the original look
of the schematic in most cases by searching the symbol for straight
segments that are coincident with the pin and use those to calculate
a suitable pin length and angle.
Create a new LIB_PART for scaled symbols. These will be then embedded
into the schematic file. However when "update from library" is done,
it will revert to the unscaled symbol.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8494
Differentiates better between the EDA_ITEM IsModified(), referring to
items themselves changing and the EDA_SCREEN IsContentModified(),
referring to whether we have made any unsaved changes.
Use justification instead of orientation relative to the anchor point when
describing text direction and alignment. This seems to be the preferred
method by most users so hopefully this will eliminate some confusion.
Fix a bug in the s-expression schematic parser that failed to take into
account how graphical text alignment is defined for graphic text objects
compared to label text objects.
Fixes https://gitlab.com/kicad/code/kicad/issues/6489
Save sheet and symbol instance information to the clipboard on copy
Load sheet and symbol instance information from the clipboard on paste
and renumber page numbers after loading.
Correctly handle pasting in a multiple hierarchy by ensuring symbol and
sheet instances are updated for all instances of the destination sheet.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8207
Avoid code duplication by moving all common code to a new function
SCH_SEXPR_PLUGIN::saveInstances
Also fixes a bug that was resulting in footprint and value information
not being saved for subsheets that were root sheets in a different
project.
This change is a bit more invasive than the description above would
suggest. UUIDs have been added to all schematics. For now, it's only
useful to the root schematic so that the UUID in the project file does
not change every time the project file is save. In the future, it may
be useful to store and check the schematic UUIDs against the one's saved
in the project file.
Fixes https://gitlab.com/kicad/code/kicad/issues/7763
If a field name is already in use, try to rename the new field name
(adding the suffix "_1" or "_2" or ... )
This is especially critical when a non mandatory field has the same name as
a mandatory field (was crashing before)
Fixes#8081https://gitlab.com/kicad/code/kicad/issues/8081
The previous assumption was that a part definition would always hold
the information about the symbol. However some designs have symbol
instances that refer to a different symbol definition than that
specified in the part.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7808
Always add a label at bus terminals to ensure connectivity. The original
design might already have a bus terminal with a given location.
If the original design does not have a label, just make it very small
to keep connectivity but make the design look visually similar to
the original.
This fix required sorting all of the LIB_PART draw items to ensure
accurate comparison between the symbols stored in the schematic and the
original library symbols. This has a noticeable impact on symbol library
load performance. It may also cause significant changes the next time
the library is saved due to changes in the draw item sorting. Hashing
may be a better solution here but this addressed the immediate problem.
A skeleton method SCH_SCREEN::SwapSymbolLinks() was added because there
is most likely an issue with orphaned symbols in the schematic library
symbol cache during undo/redo operations. More testing is required to
verify this.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7263
Rewrite of the calculation to convert CADSTAR to KiCad coordinates,
rounding half way cases away from zero.
Use integer division instead of double, to ensure precision.
Previous assumption of 100mil grid in CADSTAR schematic designs has
been proven to be incorrect. Let's use the "working grid" in the
original design instead.
- Rename member variable names to use the 'm_' prefix
- Rename a few object types that clashed with KiCad object names, such
as BOARD and SCHEMATIC, to avoid the use of '::' to access the KiCad
objects.
- Remove some unused code.
* Fix multi line text alignment.
* Parse schematic frame objects and convert them to lines.
* Make implicit global labels normal size so they can easily be seen.
* Move sheet fields to a more sensible position.
* Parse schematic symbol instances before wires so that the implicit power
connections can properly be tested. This will be used at a later time.
* Scale label text size down to allow for differences in label offset and
graphical items.
cacheLib() can cause a re-load event, which requires the C-locale.
LOCALE_IO needs to be set before this event to prevent mistaken ','/'.'
mixups
Fixes https://gitlab.com/kicad/code/kicad/issues/6434
Fixes an issue on some designs that would not be able to find the
symbol definition referenced by the part due to different
capitalisation of the symbol name in the part definition and
the symbol definition.
Use terminal pin number (i.e. from the symbol definition) when the pin
number is undefined in the part.
This fixes a bug that resulted in symbols with "0" as the pin numbers.
- Load Fields in the library items as well as schematic instances
- Remove invalid characters (e.g. '\n', '\t', '\r') in fields
- Load footprint field (assume that the footprint library name
is the same as the filename of the schematic)
This also makes sure that the user gets a warning before saving over
an older s-expr format. While that won't always be wanted, it's now
in the infobar (like in PCBNew), so it's not too onerous.§
Fixes https://gitlab.com/kicad/code/kicad/issues/7347
ADDED a new pin electrical type "free" for internally unconnected pins.
CHANGED the "unconnected" pin electrical type is now represented by
"no_connect" in files and netlists. (The legacy syntax is also accepted
in files.)