Mirror X pos coordinates for bottom layer generation

One of the assembly companies that I usually work always complains about my pos generated files. They say that SMT position coordinates on bottom layer must be mirrored in order to program their P&P machines :man_shrugging:

ā€¦and what I always end up doing is editing the file to meet their requirements.

Iā€™ve checked the KiCad Generated Placement Files options and Iā€™ve found the ā€˜Use negative X coordinates for footprints on bottom layerā€™ checkbox. This just change the X sign so does not solve the problem.

Can this be done via scripting?
A feature request maybe?

There should be option for that in the pos file creation dialog.

You mean this option should be available and then it should be implemented? Sorry if I misunderstood.

English ā€œshouldā€ is ambiguous and therefore I ā€œshouldā€ have been more careful with the wording. If I remember correctly there is an option in the dialog.

Well, there isnā€™tā€¦ or I am not able to see it.

Iā€™m not sure but it seems that Altium has this option but along the y-axis instead of the x-axis. In this case, I really donā€™t understand why flipping can only be activated along the y-axis and not for the x-axis. Mirroring? Flipping? I hope it is not another language ambiguity

My first thought here is that you have a weird assembly house, but I donā€™t have much experience here either. For the PCB itself it is normal to use coordinates as if viewed from the front for all layers. Iā€™m guessing this is standard too for position files (I donā€™t read much about problems for this on this forum).

I do find it curious that there are settings for:
PCB Editor / File / Fabrication Outputs / Component Placement / Use negative X coordinates for footprints on bottom layer
PCB Editor / File / Fabrication Outputs / Drill Files / Drill File Format / Excellon / Mirror Y axis

Why X axis for the placement, and Y axis for the drill?

The first setting is relevant here.
I wouldnā€™t tamper with the second one, itā€™s relevant to Excellon CNC PCB drilling machines and very old. I doubt that itā€™s still used.

Totally agree but it is the most cost-effective company in my area for series. Iā€™m not an expert on this subject either but Iā€™m sure that an ā‚¬80K insertion machine would have no problem to mirror the bottom layer coordinates.

I donā€™t think it is worth asking for this feature. Especially if hardly anyone uses it.

1 Like

I guess that anyone with a bit of experience in programming can write a script that does this coordinate modification in a few hours. It is just a bit of text manipulation.

Does your assembler have a web preview to test whether such a script would work for them?

Hereā€™s my workaround. For example 2 layers mount PCB with R1 on TOP and R2 on BOTTOM. Grid and Drill/Place File Origin are placed in the right bottom corner of the board

image

The pos file for the TOP layer is

Ref Val Package PosX PosY Rot Side
R1 100k R_0603_1608Metric -2.170424 3.000424 90 top

The pos file for the BOTTOM layer is

Ref Val Package PosX PosY Rot Side
R2 100k R_0603_1608Metric -2.170424 3.000424 90 bottom

For the assembly company this is wrong because X coordinate should be -9.83mm instead -2.17mm
To fix it and make them happy I insert this formula in the PosX column: - PCB_x_width + PosX_value = -12mm + 2.17mm = -9.83mm

Then I copy the formula for the rest of the references and voilĆ . No more complains :grinning:

Ref Val Package PosX PosY Rot Side
R2 100k R_0603_1608Metric -9.829576 3.000424 90 bottom -2.170424
1 Like

Mmm have you try to use this setting ?

My file looks like this when I select it.

notice that my origin is defined in the lower left corner of my PCB

This option is for switch the sign (-) instead (+) for the x pos coordinate.

As you can see, it does not perform the mirror function I mentioned before. I donā€™t know how useful this can be eitherā€¦

IMO, your P&P subcontractor is nuts.
In any mechanical design, you have a reference point for all coordinates.
Often at the lower left corner as X,Y= 0,0.
Moving to the right will increase the X-value, moving up will increase the Y-value.
Now, letā€™s flip the board left to right to expose the bottom side.
This will not change the Y-values
But the X-values will change.
If the defined reference point is kept (X,Y=0,0, itā€™s now at the lower right corner of your board. To manage that, the X-values need to be negative, and thatā€™s exactly what KiCAD does.

Fully correct to any machinst doing drilling, milling, engraving, whatever.

What your supplier wants to do is to take the X-dimension of the board, creating a new reference point in the lower left corner, and compute new X-values from that new reference.
Itā€™s a no-go, and to a machinist not acceptable. With a new reference point based on a milled X-dimension, tolerances start to accumulate.

Find a new board stuffer, or tell him to rethink the workflow. He probably has a fixture thatā€™s only calibrated in one corner. Perhaps fiducials could help?

1 Like

KiCad has a Drill / File place origin which you can place anywhere on your PCB and then use as the (0, 0) reference for the artwork outputs. I still donā€™t know what is the best way to handle this part. In theory any location works, I guess that the center of pin 1 of an important footprint on your PCB is a good location for this origin.

But ā€œBoard Stuffersā€ sometimes have weird wishes. Some need positive coordinates for all parts for example, and the weird mirroring that your fab house desires.

Opinions about fiducials also vary a lot. They used to be considered important but apparently they are becoming obsolute. I guess that faster computers and better picture analysis makes it easier to use the actual pads as orientation marks for placing footprints. With high density PCBā€™s there is also not much room to place fiducials. But there probably are still many assembly houses which use fiducials.

@paulvdh, Iā€™m with you all the way here.

But the problem is apparently, that the board stuffer has either old machines, or machines with limited capability (and zero capability for double sided mounting).

This means mounting one side (and perhaps soldering), and then manually flipping the board to do the other side, needing a new ā€œmirroredā€ reference point.
Modern machines do not have that limitation.

I see no need for a KiCAD feature here. If someone want to write a plugin or a script, fine.

Apparently gschelotto is happy with with his spreadsheet. Iā€™d also espect that if a board stuffer has old machines, heā€™d have plenty of experience to do some coordinate magic himself.

My last post was partially just to mention the options that are available in KiCad for others searching the forum and reading this thread later.

Well, thatā€™s your opinion. I prefer to think that he has very little time to modify different setups and needs fabrication data to be the way he wants it in order to save time/cost as I use their EMS for long series fabrications.

I have to say that, of all the assembly houses I work with, it is the only one that gives me these ā€˜problemsā€™. However it is super fast and very affordable price.

I personally prefer to tweak the P&P spreadsheet as I have explained before. I wouldnā€™t know if KiCad should have this feature but I can live without it.