[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: pick and place ?plugin?footprints.c? for



Dave N6NZ wrote:
> Dan McMahill wrote:
> 
>> This doesn't address your bigger picture problem, but the xy data from 
>> pcb actually does not depend on where the center is drawn in the 
>> library.  It is calculated as the centroid of the pin/pad centers.  So 
>> for any symmetric part, I can actually say with some confidence that the 
>> center will be correct in pcb's output. 
> 
> Very cool.
> 
>> The orientation is based on an 
>> algorithm that looks for which quadrant pin #1 is in and then has some 
>> rules for what you do if it is along an axis.  
> 
> I'm a little fuzzy on this.  Can you be more specific about how you 
> calculate rotation?

the description follows

http://pcb.sourceforge.net/pcb-20080202/pcb.html#Centroid%20File%20Format

the full details start on line 322 of:

http://pcb.cvs.sourceforge.net/pcb/pcb/src/hid/bom/bom.c?revision=1.13&view=markup

hopefully the code there isn't too bad to read even if you're not up on 
pcb code internals.

The astute code reader will note that only multiples of 90 degrees work 
and that if you have multiple pins/pads with the same number, they are 
counted individually for the purposes of finding the centroid.  There 
are probably other ways of confusing the code.  I'd welcome someone to 
poke at the algorithm with a sharp pointy stick and see where it fails.

I'm not sure how to make the algorithm properly deal with angles other 
than multiples of 90 degrees.  That is a pretty major assumption.

I think before I entertain ideas of modifying that code I'd like to get 
a regression testsuite in place.  I'm thinking of several individual 
footprint files that are each exported from the command line and the 
output compared to a hand verified output.  I suppose one large layout 
might be ok for this too since you could sort the output on refdes so 
that a diff took you right to which element got changed.  That would 
probably run faster.

-Dan


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user