how do I interpret the orientation and mirror style of a unit in the schematic file ? It is pretty cryptic specified in lines as show below. I commented their individual results, but I can only guess how to read it.
1 0 0 -1 #orientation 0, mirror normal
0 -1 -1 0 #orientation 90, mirror normal
1 0 0 1 #orientation 180, mirror normal
0 1 1 0 #orientation -90, mirror normal
I looked at the source code and found that these appear to represent a 2d transformation matrix.
The matrix is x1, y1, x2, y2, which I assume is:
Then I needed a review of 2d transformation The important section for us is the left side of page 3 (I don’t see how to post pictures from mobile).
The final matrix can’t be explained by simple mirror and rotate because it depends on the order of operation. For example, the following are equal:
Rotate -90, vert mirror
Horiz mirror, rotate -90.
(Try it with your hand, I did )
Note that the “normal” you’ve indicated is a transformation matrix of
and is equivalent to a vertical mirror (see reference . This is transforming +y up to +y down, which may be because KiCad coordinates on screen are +y down. It’s possible the screen translation happens elsewhere, this is just a guess.
Based on this, you hopefully can derive the answer you need.
A little experiment later, looks like eeschema applies Mirror before Orientation, as listed in the properties.
so if you rotate CCW first (which is +90) then mirror horizontal, the properties will be mirror horizontal and orientation -90 (which is CW). It’s kind of the difference between ‘action’ and ‘state’ where actions can be done in any order (rotate, flip) and state is defined as a flip in the mirror direction occurring before the orientation applied as a rotation.
Thanks for your help. I’m still trying to understand what you wrote. However, the last two lines in my initial post seem to be wrong written by eeschema (version 4.0.5) as they are exactly the same for a different orientation. I presume the last four lines as a whole are wrong. Can anyone confirm my assumption ?
In eeschema, when I apply the orientation 180 or -90 on a unit combined with “mirror |” then eeschema writes the mentioned lines in the schematic design file. I expect them to differ but they don’t. So I suspect a bug.
It’s a not a bug, but it took me a little while to work out.
Only rotation and X mirror (–) are required to describe all possible states. Although Y mirror (||) is given as a command for the user, it is implemented as an equivalent combination of rotation and X mirror, and only those properties are stored in the schematic. Only the first 8 lines you describe are used.
That has the result that what is shown in Component Properties may change when you reload the schematic.
Is there are reason why you need to decode these lines, or is it just for general interest?