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..
7 thoughts on “RenumKicadPCB V0203”
Are there any known KiCad PCB features that could cause a failure if this program? Multiple layers, copper pours? What is the native units of measure? I use inches, not mm. So far I have not been successful in getting this very useful program to work. Thanks in advance for your help
I have not had any situations where the program “breaks”. The only bug I am aware of, and is summarized in the release notes, is due to a bug in Kicad. I tested the software on the most challenging board I was aware of, which has pours, 4 layers, and interesting characteristics like cloned sheets.
The system uses Kicad’s internal dimensions (which I believe are mm). All the Kicad dimensions are in the files and are not affected or changed by the program. If you use inches, Kicad still uses mm but shows you inches (it turns out that an inch is 2.54 cm to, like 6 significant figures).
Of course, the fact i have not encountered a problem yet doesn’t mean there are no bugs: just no bugs I am aware of.
Can you tell me what OS you are using?
It might be easier to communicated with me directly at brian(at)documenteddesigns.com If you are willing to give me as much information as possible, including (if possible) an archive of your project I will definitely look into it.
I understand you make not be willing to send me your project but I am sure we can work out something like a minimal project or something.
If you email me and I don’t reply, please post here again.
I just compiled and used your utility successful! Thanks. Just a note to compile I needed to ad -lm at the end of the gcc order: gcc RenumKiCadPCB.c -o RenumKiCadPCB -lm my system is linuxmint 18.3, after that it worked perfectly.
That’s great news! I’ll add a note to the post about your experience.
Sent a test case Kicad archive to email@example.com, but it bounced back! Now what??
I a sent an email to your direct email address with the hope it somehow “clears” rejection of your files. If you get a bounce back, please set up a drop box or something and send me a link via email (firstname.lastname@example.org or email@example.com).
1) What OS are you using?
2) What is your system configuration?
3) What are the symptoms of the crash?
4) Does renumbkicad PCB flag any errors/issues? Does it produce log files (these are typicall ….txt.
Make sure you zip up your libraries along with the sch and PCB files.