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

Re: gEDA-user: Part Rotation in XY-data



On Sun, Nov 9, 2008 at 6:02 AM, Duncan Drennan <duncan.drennan@xxxxxxxxx> wrote:

> I expected the parts to be rotated relative to their library
> references, but the SOIC part has an extra 90º rotation. Rotation in
> pcb increase in a clockwise direction. I've attached a test .pcb file
> and the resulting xy coordinates.

The calculation does not compare the placed part to the library.
With the centroid at (0,0) zero degrees of rotation is when pin one
is in the upper left quadrant.

The angles should increase with counter-clockwise rotation. It sounds
like there is a bug.

> I am guessing that rotation (like centroid data) is calculated by some
> algorithm, what is the basic thought behind the calculation?

This is from the PCB manual ---

Computation of Centroid and Rotation

The center of each element is found by averaging the (X,Y) coordinates
for the center of each pin and pad in the element. For example if an
element has 2 pins, 1 at (1,0) and another at (1,4) then the centroid
will be at (1,2).

The calculation of rotation is a bit more complex. Currently a
rotation is not stored for each element but rather the rotated element
is stored. In other words if the element from the library has a pin at
(0,0) and (0,2) and it has been rotated by 90 degrees, then the .pcb
file will store (0,0) and (2,0) for the pin locations with no
indication that they have been rotated from the original.

In the event that the element has only 1 pin, then the rotation is set
to zero.  If the element has only one pad (as opposed to a
through-hole pin), then the rotation of the pad is used.

When the element has multiple pins, the location of pin #1 is placed
in the coordinate system which has the centroid of the part at
(0,0). Then which quadrant pin #1 falls in determines the
rotation. Zero degrees of rotation is defined as pin #1 being in the
upper left quadrant. Increasing angles correspond to counterclockwise
rotation so a rotation of 90 degrees places pin #1 in the lower left
quadrant. Currently, the only allowed rotations are 0, 90, 180, and
270 degrees.

If pin #1 happens to be at the centroid of the part, then pin #2 is
examined to see which quadrant it is located in. The same rules apply
for the definitions of rotation. In other words, when pin #1 is at the
centroid of the part and pin #2 is in the upper left quadrant, the
rotation is declared to be zero degrees.


(* jcl *)

-- 
http://www.luciani.org


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