Robotips / uConfig

Datasheet pinout extractor from PDF and library Stylizer for Kicad.
GNU General Public License v3.0
517 stars 58 forks source link

Wrong pin assignment due to same pin number #27

Open Exorcismus opened 5 years ago

Exorcismus commented 5 years ago

While using the tool, I found the below case image

it seems the application logic will skip the already associated pins, noting it was mis-assigned. like in the above case, wrong pin 10 was already assigned to a package so the correct pin which had the same value was skipped

I have modified the logic abit to get the nearest point in that case, please check it

datasheet.cpp void Datasheet::pinSearch(int numPage) please find the intended block as the function is too large `foreach (DatasheetPackage package, packages) { // get last inserted pin DatasheetPin lastpin = package->pins.last();

                if (lastpin->pin == pin->pin){
                    //modify logic to handle different pins with same number
                    //continue;

                    if(package-> pins.length() >2){

                    //out << " executing tech2 for pin nummber "<<pin->pin << " and size is "<< pins.length()<< endl;
                    DatasheetPin *beforeLastPin =  package-> pins.at( package-> pins.length()-2);

                    qreal newPinDistance = pin->distanceToPoint( beforeLastPin->numPos.center());

                    qreal lastPinDistance = lastpin->distanceToPoint(beforeLastPin->numPos.center());

                    if(newPinDistance < lastPinDistance){

                        //out <<"pin number is :"<<pin->pin<< " replacing pin  "<<lastpin->name << " with "<< pin->name<< endl;

                        package->pins.replace(package->pins.length()-1,pin);

                        continue;

                    }

                    }
                    continue;

                }
                if(  lastpin->pin + 4 < pin->pin)
                    continue;

                qreal newdist = lastpin->distanceToPoint(center);
                if (newdist < dist)
                {
                    dist = newdist;
                    nearPackage = package;
                }
            }`