I wasn’t expecting to post a new version so soon but while preparing some features I discovered an actual bug! Here it is RenumKicadPCBV0203
The bug showed itself when sorting on reference designations and the component orientation was not typical. Unfortunately the Kicad file formats are not very well documented and I did not realize that the reference designation offset was relative to the module’s angular rotation, not absolute. Therefore if the ref des offset was 0.1, 0.2, that doesn’t mean it was 0.1 to the right and 0.2 down relative to the module – it means it was 0.1, 0.2 relative to the original grid of the component. Its actual location is a trigonometry problem which is simple enough to figure out once you figure out what is going on.
So, the adjustment is
X offset = (( Ref_X_Offset * cos( modangle )) + ( Ref_Y_Offset * sin(modangle )));
Y offset = (( -Ref_X_Offset* sin(modangle )) + ( Ref_Y_Offset * cos(modangle )));
In addition to this bug fix, I removed the “Verbose” and “Show Change Array” menu options and instead create three log files:
- _coord.txt, which shows the module or reference designation coordinates and their “rounded to grid function;
- _update.txt which shows the nets, reference designations, etc., which will be renamed, and to what
- _change.txt which is just the reference designation change plan and show how modules were renamed by the code.
These files are pretty small and making them does not seem to have a significant impact on run time. They make it a lot easier to figure out the decisions the software made and its easier to ask for a file than to ask someone to “cut and paste” from a DOS terminal screen.
Besides the obscure bug corrected in the V0203, which I discovered, I am not aware of any errors made in sorting, file updating, etc.. Thus far unexpected results are not the fault of the software but a mismatch between the options used and the design. I actually found the bug because my “test project” ice-zum, has the reference designation for C1 in the place of C2 and vice versa so when sort on modules it showed C2 C1. It was only while correcting that design mistake I realized there was an unrelated bug.
I also cleaned up the code “map to grid” is done only once.
As always feel free to contact me if you have any issues, can’t get it to work right, etc..