Proper support of slots in BXL-to-KiCAD - #7
Conversation
Updated kicad pin export so that it stores unit number and electrical type from source. Also updated kicad pin number to be set to source description field if the description field happens to store BGA coordinates of the pin.
When no pins are defined in slot 0, the functions which return bounding coordinates of pins will try a null dereference. This fixes the dereference by using a global constant as initial value for these functions.
This makes only one variable which stores slots/units number remain. The additional one is unneccessary.
The slot property was added to SymbolElement, so that all descending classes can store its slot index. Also removed previous slot/unit index definition from SymbolPin.
The polyline KiCAD export algorithm was dividing polylines into separate single lines. This may be useful, but is not always what user wants. The patch introduces a class property to choose whether polyline should be divided on export or not. It also adds proper inclusion of slot/unit index into the resulting lines.
Functions fron the pins list array can now be used with slot index, which alows dividing components into proper units during export.
Instead of creating separate symbol for each input slot, this patch allows creating multi-slot/multi-unit KiCAD models. It uses slots support introduced in previous patches, and provides more division between exporting SYM files and KiCAD LIB files.
|
Nice work. I will need to do some testing to ensure gschem (.sym) schematic symbols aren't broken. I will put this onto my todo list, and integrate the changes once tested. |
|
@mefistotelis I like your enhancements, however, there seems to be an issue with composite components. It seems to be starting over its pin numbering on each sub-part within the So that you'll have it for your testing, the component I was trying to convert was I liked the way the sub-parts were named better with your changes and the generally cleaner output, but I had to rollback my local merge of this pull-request to the original version @erichVK5 had to get a part with the correct pin numbers. |
|
Though I should also add, that the original version @erichVK5 had didn't do the sub-parts right either. It made them as three distinct parts rather than one part with three sub-parts, meaning KiCAD won't let you assign them to the same reference designator. So in that regard, @mefistotelis , your pull-request has better output. The only problem is that the pin numbers on the sub-parts are starting over rather than having the correct values. I'm starting to look through this code to see if there's an easy fix, but I may (to get on with my circuit design) just manually tweak the output, merge what is correct from each version (since both are wrong), to get my library component for KiCAD. |
|
@mefistotelis Ah, I figured it out. The // In KiCAD, pin number is not neccessarily a number; it can also store BGA pin coords, A1-ZZ99
String bestNumber = pinNumber;
if (Pattern.matches("^[A-Za-z]{1,2}[0-9]{1,3}$", pinDesc))
bestNumber = pinDesc;
return ("X "
+ pinName + " " // name displayed on the pin
+ bestNumber + " " // pin no. displayed on the pin, may be in col+row form
+ (kicadX + xOffset) + " " // Position X same units as the lengthIt should just be the return ("X "
+ pinName + " " // name displayed on the pin
+ pinDesc + " " // pin no. displayed on the pin, may be in col+row form. Was pinNumber, but samarjit tells me this is wrong for BGA
+ (kicadX + xOffset) + " " // Position X same units as the lengthIf I change that part of |
|
Good work chaps. I just need to ensure it does not break gschem .sym output. |
|
Thanks. I didn't see anything too broken in the .sym files, but yes, you should verify since I'm not totally sure what to look for, as I'm mainly after the .lib and .fp files. I opened a pull-request with @mefistotelis with these parts merged and once @mefistotelis verifies it on his end and merges that into his fork, it should automatically update this pull-request, which you can then merge once you have the .sym files verified. |
|
I'd leave some checking sanity checking of pinDesc, ie. whether it contains at least one digit inside. But the change looks ok. In the file I converted, the pin numbers were preceded by a letter; I assumed the use of pinDesc is mandatory only if the letter is there. |
These patches provide even better support of BXL files published by Texas Instruments.
After naming over 400 pins in a BGA device, I decided to update the conversion to convey proper BGA pin numbers, not just incrementing indexes. But while at it, I also noticed KiCAD has slots support, though they're named 'units' there. The converter even had some base elements of multi-slot symbols support, so I built on that.
Please check whether SYM files are generated correctly after this update - I don't even know what opens these. Since I changed the way pins are stored (from array to single object), it could have affected SYM format.