I’m trying to set the location of components in PCB view by typing values into the 2 “location” property boxes in the inspector pane. My goal is to perfectly align components on each other, either vertically, horizontally or both. This works fine so long as all the components I’m trying to align have a rotation value of zero, or have equal widths and lengths. But if neither of those is the case then the results make no sense to me whatsoever. See the screenshot below for what I mean.
I guess what I’m asking is: what is the “origin” used for placement? When rotation=0 the origin seems to be the top-left corner of the component. When rotation=90, it seems to be based on the component’s width and length. I can “zero” a component’s whose rotation=90 with offsets equal to height/2-width/2 and -(height/2-width/2) for horizontal and vertical, respectively.
Apologies if this has already been answered somewhere, in which case, please just post a link.
While I don’t know the answer, experimentation provides some clues. First however what Fritzing version are you using? If it is 1.0.4 (the current version) you should be fine. There was a scaling bug back about 0.9.10 and possibly later that if you were not zoomed all the way out the location numbers were scaled and thus distorted. In 1.0.4 (and I think earlier) that has been fixed and doesn’t appear to be the issue here (this is on 1.0.4)
I think what is happening is rotation is important. It appears (but I’m not dead sure that is correct!) that the center of the part is where the y coord applies.
I don’t know what the reason for the offset in the header is though (the second header is rotated and that appears to be what is doing it) I expect a different reference for the center of the part for some reason. This does make things difficult and may be worth making an enhancement request on github to see if there is willingness to change it (it may be a very complex change though!) With the rotations all set to 0 the parts align as expected to what appears to be the top of the pin:
Yeah, it looks like your experiments match my own. I’m using version 1.0.1, but it sounds like it is behaving similarly to 1.0.4 (I hit a paywall when I tried to download the update, and didn’t have time to bother with it).
From my experience, when components are rotated to 90 degrees (or 270) then it looks like the origin is implicitly moved to x=-(height-width)/2 and y=(height-width)/2, so you can compensate by adding the negative of those values to a component’s location.
Here for example, the vertical IC is set to 0.2",0.2" on a PCB set to 0,0 and they align as you would expect. The horizontal IC chip (rotation=90) is set to x=0.2"+(height-width)/2 = 0.2 + (1.1-0.4)/2 = 0.55" and y = 0.2" - 0.35" = -0.15"
In the receipt for your donation there is a link which bypasses the paywall (I think for about a year) which will allow the upgrade. It is worth upgrading to 1.0.4 as there are important fixes in it. 1.0.1 may have had the fix that corrected the scale issue (they are pretty obvious, the number you get isn’t the number you set by a fair margin although zooming out will fix that.) It is annoying enough that it may get support for an enhancement. That assumes there isn’t an issue I don’t know of in how the code works though. Things that seem to be easy often are not.