Hi,
I’d like to have PCB editor Y axis point upward (so the “Z axis” would point out of the screen) and I tried changing the preference below.
While this changes the value displayed in the editor status bar, it seems like the plugin (one I’m developing) still sees the Y axis pointing down.
This does not seem right to me. Is it the expected behavior?
Yes. The setting only changes displayed values, it doesn’t change the file format or the data in the pcb file.
Yup, that was the intended behavior from the inception of the feature.
Imagine for a moment how much fun you would have writing your plugin if you had to handle KiCad layouts with X axes going left or right, Y axes going up or down, and the (0,0) origin in any of three different locations? Now extend that fun to all of the internal functions of PCBnew. It’d be a nightmare.
Note also that Origins & Axes is a user preference, and is not recorded in the PCB file. Personally, I think these should be part of the PCB file so that all users see a consistent view of a given PCB. But the core developers disagreed, so I implemented it as it is now.
yep, not much fun indeed. I just need to get used to the whole upside-down thing while working with vector rotations. I’m spoiled by the top-down view of the typical mechanical CAD.
And I’m kinda curious, is the Z pointing in for historic reasons (heritage from fab standards or alike)?
cheers
There is no Z, it’s a 2D cad.
Y is pointing downwards because it’s a common convention for computer graphics with roots coming from early CRT TVs having their scanning order top to bottom. Every graphics library and every major OS drawing API works that way.
Rotations work exact same way just with swapped clockwise/counterclockwise directions. I.e. negate your angles and everything will work out.
Circa 1980 I was in a team that developed a 405-625 line TV converter for the BBC. This needed input and output frame stores to do the interline interpolation. Naturally the store addressing counted from the top downwards. About the same time, early home computers used domestic televisions as displays, they also had to count top to bottom.
And don’t forget left to right scan.
Probably all started with imitating the pages of books published in the language of the country where that then new technology was developed.
This is utterly irrelevant. While this may explain how the odd Y-axis orientation came about, it is certainly not a valid justification for it.
Graphic displays represent locations in units of pixels. Do we expect PCB layout engineers to convert measurements to pixels before entering them in a CAD package? No, we don’t. It’s the responsibility of the CAD package to present data to the user in a format useful to the user, not the internal representations whatever they may be.
It’s too late to change the internal representation of the Y axis. Changing this would require far too much work for a very limited benefit.
Never underestimate the inertia of software legacy and libraries. Because early hardware worked top to bottom, using the same structure in software saved cpu cycles when they really mattered for screen drawing performance. KiCad, like many other CAD software started off in DOS times, when software control of the screen was far more direct.
These days changing the convention would have no effect on screen draw, but would take months of code changes and testing to ferret out every line of code that assumed -ve Y
I’ve worked as a software engineer since the early 1980s. Other CAD packages from the DOS days managed to disassociate the hardware scan direction from the user interface without serious performance penalties.
Changing the direction of the Y axis is a single subtraction operation, which most CPUs execute in a single instruction cycle – the same as simply loading the value. Scaling (used in zoom in/out) is a far more expensive multiplication.
As I said before, the hardware scan direction can explain the negative Y axis, but does not justify it.
I don’t think anyone is trying to justify it, merely to answer OP’s question:
Its the way the compiler works so its easier to go with the flow.
KiCad is the first PCB design software I have seen having Y increasing towards down.
I have never pay any attention on it, but I believe that I would be not so surprised with it if I have ever seen such behavior previously.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.