Commit Graph

135 Commits

Author SHA1 Message Date
Wayne Stambaugh 34ea79eddb Fix LIB_ID illegal character tests.
The '/' and ':' are reserved and cannot be used in symbol or footprint
names.  They will cause the LIB_ID parser and formatter to fail.  While
it seems like they should be legal in symbol alias names, they will
trigger a symbol rescue the next time the schematic is loaded.

Use ID_SCH as in the Eagle schematic plugin rather than ID_ALIAS to
ensure symbol names do not need rescued the next time the schematic is
opened.

Remove ID_ALIAS since the rules for alias names are the same as the
rules for symbol names.  Otherwise, allowing '/' and ':' in alias names
will force a symbol rescue on the next schematic load.

Fixes lp:1795600

https://bugs.launchpad.net/kicad/+bug/1795600
2018-10-07 09:09:27 -04:00
Maciej Suminski 2c217499b5 Eagle SCH importer: fix slash characters when fixing symbol names
Even though slash is a valid character in symbol names, it is a revision
separator, but is not the case with Eagle symbol names.

Fixes: lp:1791653
* https://bugs.launchpad.net/kicad/+bug/1791653
2018-09-12 10:13:13 +02:00
Seth Hillbrand 5bd959d92c Eagle: Fix NULL-dereference on malformed Eagle files
Eagle files that are edited may be missing required data.  While we do
not need to handle these files, we do need to prevent segfaults in KiCad
when reading them.
2018-08-19 19:48:10 -07:00
Mark van Doesburg 91e3d21d68 Eeschema: Copy attributes from eagle.
Eagle allows for variants of components to be listed in the schematic.
This patch copies the variant data into the imported schematic item,
prefixing the alternate variant names with "VARIANT_" and keeping the
alternate values.
2018-07-31 11:58:01 -07:00
Seth Hillbrand d30ac2967a eeschema: Rescue symbols with illegal chars
When parsing component names, we need to account for the possibility of
illegal characters (e.g. "/", ":") in the names from v4 libraries.  They
are fixed internally by the cache parser but if we don't fix them
in the rescue routine, the symbol won't match it's cache name.

This standardizes all schematic illegal character routines into LIB_ID

Fixes: lp:1774774
* https://bugs.launchpad.net/kicad/+bug/1774774
2018-06-27 14:15:30 -07:00
Maciej Suminski 228881f552 Eagle SCH import: validate package (footprint) names 2018-06-06 10:12:04 +02:00
Maciej Suminski 94f161b8c2 Eagle SCH import: validate imported symbol names
Fixes: lp:1753189
* https://bugs.launchpad.net/kicad/+bug/1753189
2018-05-29 09:29:22 +02:00
Maciej Suminski e789523632 Eagle SCH import: do not crash if nothing was imported 2018-05-29 09:29:21 +02:00
Jeff Young 62d6750ced Use default for attribute "display" if not found.
Fixes: lp:1767447
* https://bugs.launchpad.net/kicad/+bug/1767447
2018-05-11 16:11:38 +01:00
Maciej Suminski c8f4e1051b Eagle SCH import: keep multi-unit parts not interchangeable
Eagle supports more sophisticated unit swapping information,
so the safest choice is to prevent any unit manipulation.
2018-05-08 12:17:46 +02:00
Maciej Suminski 3f734eb1b5 Improved validation of library and entry names
Symbol/footprint library and entry have the same set of forbidden
characters with a single exception, space character. To accommodate for
this difference, LIB_ID validation and fix methods have been extended to
specify the LIB_ID type that is checked (schematic/board).

LIB_ID::HasIllegalChars() and LIB_ID::FixIllegalChars() had two different
sets of characters treated as invalid in LIB_IDs. The set has been
factored out to another function to avoid duplication.
2018-04-13 14:24:57 +02:00
Maciej Suminski 58c27398cb Eagle SCH import: improved implicit connections resolution
Nets assigned by power pins are weak, meaning they are valid
as long as there is nothing else attached to such pins. This patch
checks whether there are other wires or pins attached to a power pin
before placing a global net label.

Fixes: lp:1755191
* https://bugs.launchpad.net/kicad/+bug/1755191
2018-04-12 18:12:22 +02:00
Maciej Suminski e7ed415930 Eagle SCH import: handle implicit connections
Each named power input pin in Eagle creates an implicit connection to a
net with the name of the pin (e.g. GND, VCC). It is also done for the
units (gates in Eagle nomenclature) that have not been instantiated in
the schematics.

To emulate this behaviour in KiCad:
- Placed components are checked for power input pins, so they will have
global net labels attached to create the described implicit connections.
- As the components are placed, the remaining units of the symbol are
checked for power inputs to see if they need to be instantiated together
with global net labels.

Fixes: lp:1755191
* https://bugs.launchpad.net/kicad/+bug/1755191
2018-04-06 16:20:59 +02:00
Maciej Suminski 78c9b34b5d Eagle SCH import: moved sheet bbox calculation to a function 2018-04-06 16:02:58 +02:00
Maciej Suminski 9ee698bbcd Eagle SCH import: save the imported library file once the library section is processed
It is required to access symbol data in later import stages.
2018-04-06 16:02:18 +02:00
Maciej Suminski 71bf488507 Eagle SCH importer: fixed open-collector pin type, simplified pin direction matching 2018-04-03 14:26:15 +02:00
Maciej Suminski 6d06ed3579 Eagle SCH importer: minor fixes
- set correct reference for components
- handle "pwr" direction for pins
- discarded a redundant variable
2018-04-03 14:26:15 +02:00
Maciej Suminski eb9099238a Eagle SCH import: Improved net label placement algorithm
Eagle support net labels that are naming wires not directly connected to
the labels. In KiCad it is not possible, therefore such detached net
labels need to be moved, so they touch the corresponding wire.

The initial algorithm did not take into account that a moved net label
might be placed on a wire crossing, effectively shorting two nets. This
commit improves the placement algorithm by avoiding the wire crossing
points when placing a label.

Fixes: lp:1748502
* https://bugs.launchpad.net/kicad/+bug/1748502
2018-03-29 12:16:11 +02:00
Maciej Suminski 88915f7940 SCH_EAGLE_PLUGIN::addBusEntries(): prevent operating on deleted objects 2018-03-29 12:11:36 +02:00
Maciej Suminski 99e79c077a Eagle SCH import: Code formatting 2018-03-29 12:11:35 +02:00
Maciej Suminski 434b385a95 Eagle SCH importer: prepend # to references of symbols without assigned footprints
With hash character starting the reference value, schematic components
are considered as virtual and therefore netlist updater do not warn about
an unsigned footprint anymore. This approach is useful to handle logos,
frames or other virtual Eagle components.

Fixes: lp:1756281
* https://bugs.launchpad.net/kicad/+bug/1756281
2018-03-22 18:20:02 +01:00
Maciej Suminski e9537953cd Eagle SCH importer: reduced code duplication for importing labels 2018-03-22 18:20:02 +01:00
Maciej Suminski 260f680c6c Eagle import: fix memory leak on schematic sheets import 2018-03-04 16:47:26 +01:00
Russell Oliver 3d9c25494c Revert "Eagle importer: use only global net labels"
This reverts commit b1f456fade.
2018-03-04 16:42:55 +01:00
Carsten Schoenert ff305781fb fix misspelled 'neeeded' -> 'needed' 2018-02-25 17:10:10 -05:00
Maciej Suminski 24fcdb00cc Eagle importer: convert special characters in net names
Convert '!' to '~' to reflect overbar toggling and change '~' to '~~'.
Now it matches the net names in schematics import plugin.
2018-02-17 00:03:28 +01:00
Maciej Suminski b1f456fade Eagle importer: use only global net labels
Local net labels are preceded with sheetpath (even for single sheet
schematics it is '/') causing net name conflicts between schematics and
layout. It can be easily avoided by using exclusively global net
labels, at the cost having uglier schematics.
2018-02-17 00:03:28 +01:00
Maciej Suminski ac9fc949bd Code formatting for 013f7b4d 2018-02-13 14:56:11 +01:00
Russell Oliver 34b52c91b7 Add empty eeschema page layout for Eagle schematic import.
Fixes: lp:1729722
* https://bugs.launchpad.net/kicad/+bug/1729722
2018-02-13 14:56:11 +01:00
Russell Oliver e340e8a838 Eagle Schematic Import: Label Placement fix.
Extra labels to preserve eagle named nets feature are now placed at the
end of a wire segment instead of the middle of a wire. Prevents a label
being placed on crossing wires that are not connected by a junction
resulting in an incorrent netlist.
2018-02-12 15:35:28 +01:00
jean-pierre charras 8022f1cc01 fix code after renamin files 2018-01-30 11:49:51 +01:00
jean-pierre charras 795a36c9fe Fix code after renaming files, and a bit of code cleanup (remove useless includes and multiple includes of the same files) 2018-01-30 09:57:25 +01:00
jean-pierre charras 4c5bd01887 Rename a few files 2018-01-28 22:02:31 +01:00
Maciej Suminski 378846c2e3 Eagle Schematics Importer: support for UTF-8
Fixes: lp:1736083
* https://bugs.launchpad.net/kicad/+bug/1736083
2017-12-17 19:54:21 +01:00
Maciej Suminski 7665a839cd Eagle Schematic Import: try harder to generate a meaningful library name
The previous implementation relied only on the project name. When it is
set, the imported library was named '-eagle-import'. Now it tries
the project name and then the file name, using 'noname-eagle-import'
as fallback.

The library name is stored in the plugin to avoid changing the library
name after the project name has been set.
2017-12-17 18:45:40 +01:00
Simon Richter a9ccf1161b Fix quotes in UI messages
This replaces all single and angle bracket quotes in UI messages with
double quotes, for consistency.

Sorry to all translators.
2017-12-15 07:33:07 -05:00
Wayne Stambaugh b82bd8e0c5 Fix symbol names with illegal library ID characters.
Change the legacy schematic plugin to preserve illegal LIB_ID characters
when load schematics prior to version 4.

Check for illegal LIB_ID symbol names during project rescue.  Rename and
rescue any symbols with illegal LIB_ID names.

Add static methods to LIB_ID object for testing for and fixing names
with illegal characters so there is uniform code for doing so.

Update the Eagle plugin symbol loader to fix symbol names using the new
LIB_ID fix illegal names method.

Fixes lp:1732236

https://bugs.launchpad.net/kicad/+bug/1732236
2017-11-23 10:52:55 -05:00
Wayne Stambaugh 56d73f837d Fix build error caused by rebasing against commit 5eb56dd8. 2017-11-09 18:50:21 -05:00
Wayne Stambaugh 8fd89c881d Final symbol library table changes before merge.
Remove all symbol libraries from the project file after remapping to
prevent symbols that should be loaded from the cache being loaded from
a library further up the search order.  Save the project file to clear
all of the libraries so they never get reloaded again.

Remove the symbol library management dialog and menu entries.

Rename the symbol library table dialog menu entry.

Remove all symbol libraries from default project file to prevent clashes
with the cache library.

Fix illegal symbol naming in Eagle plugin.
2017-11-09 18:50:21 -05:00
Wayne Stambaugh 8d995f48de Update Eagle plugin to use symbol library table. 2017-11-09 18:50:21 -05:00
Wayne Stambaugh d5290bdfe0 Fix malformed symbol libraries when importing Eagle schematics.
KiCad library symbol text objects cannot contain carriage returns and/or
line feeds which isn't the case with Eagle symbol libraries.  Otherwise,
the library file will be corrupt when it is saved.  Fixing this in the
legacy plugin would break the current file format so just replace them
with underscores.  Ideally these text objects should be broken into
multiple text objects but the current plugin design doesn't support
this.
2017-11-04 21:36:47 -04:00
Maciej Suminski 5eb56dd8b0 Coverity fixes
CIDs:
102571
168696
168701
168704
168706
168708
168710
168713
168716
168717
2017-11-01 10:24:26 +01:00
jean-pierre charras 772dc2f24a Fix compil warnings 2017-10-20 13:48:36 +02:00
Maciej Suminski 59394fedbf Eeschema Eagle Import: fixed global net label rotation 2017-10-20 09:34:33 +02:00
Maciej Suminski 0ed7483868 Eeschema Eagle Import: support UTF-8 for fields 2017-10-20 09:34:33 +02:00
Maciej Suminski b77ba486ec Eeschema Eagle Import: fixed name and reference fields placement 2017-10-20 09:34:33 +02:00
Maciej Suminski 62156b9b69 Eeschema Eagle Import: refactored common code for setting text attributes 2017-10-20 09:34:33 +02:00
Maciej Suminski ee8012a5cc Eagle import plugin: Code clean-up and formatting 2017-10-20 09:34:33 +02:00
Maciej Suminski 25b8111341 Modified Eagle import plugins to use nanometers as the internal unit 2017-10-20 09:34:33 +02:00
Maciej Suminski 7f697de432 Handle empty texts correctly 2017-10-20 09:34:33 +02:00