-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What I'ld like to automate #93
Comments
Is this a
Yes, you can generate it.
Automatically? Where do you get this info?
Currently KiAuto doesn't generate it.
Many users implement a tag replace, I would like to add such a feature, but I'm not sure about how to implement it.
KiBot can generate ZIP, RAR and tarballs with the output files. You can control various aspects (archive name, tree structure, etc.).
This looks like something you should do adding a tag to the repository.
Sound quite personal, but I'm curious about what information do you include there.
If you will be using KiBot I strongly recommend using it for the BoM, it uses KiCost engin, but also adds much more control about the output. |
@set-soft Happy to discuss !
I refer to the dates that appear on the schematic and on the PCB sheet - the ones that are visible when printed.
Good, I'll tick the checkbox, and look for it when using KiBot ;-).
I suspected so ;-). So it's a wish.
I suppose that you know how to replace a tag, so your question would be about methodology. The git hash is something that could be added to the filename and/or a PDF/SVG/GERBER property. In C SW projects, I add the git hash as a constant in the compiled code and I add "M" when there are modified files (as SVN does).
Ok, the idea is to have some kind of board version variable, used in appropriate locations.
Git can make a tag for me, but it is practical to have the gerber file available without having access to git. A copy of the zipped production folder should suffice. I keep copies of built versions in subdirectories that are themselved in git. I can compare versions without checking them out specifically. Once they are built, they exist in the real world - easy access comes in handy from time to time.
Once I get in to using KiBot, I may be using it for the BoM, but I already have a script allowing me to generate the BoMs from the CLI for multiple variants. I copy it from one project to the next. |
Adding a few more:
Note: to renumber, I rely on #!/bin/bash
# RENUMBER COMPONENTS
cat > RenumParameters.txt <<'EOF'
PCB file name=PROJECTNAME
Top Sort Direction=1
Bottom Sort Direction=5
Top Start Reference Designation=1
Bottom Start Reference Designation=101
Sort on Modules/Reference Designators=0
Sort Grid=1.000000
Log=0
EOF
#../RenumKiCadPCB/RenumKiCadPCB <<< "R"
../RenumKiCadPCB/RenumKiCadPCB |
@mdeweerd You may find my GitHub workflows useful to look at. I've got date/version replacement happening on GitHub for example. It also generates complete zipped output and attaches it to GitHub releases. See https://github.dev/neilenns/TBM930_De-ice_panel and the included CodeTour that walks through all of it. |
@neilenns Thanks for the hint, I'll have a look at it in more detail later. I am currently configuring the project's yaml.
|
@mdeweerd I just finished setting up a GitHub repository template since I keep doing the same thing over and over again, and added a bunch more documentation. |
@neilenns I made a reply yesterday, but my computer crashed - apparently it wasn't sent.
|
It can be added, but: how do you plan to use it? |
I currently set this in several targets: - name: 'pdf_pcb_fab'
comment: 'Exports the PCB to the most common exhange format. Suitable for printing.'
type: 'pdf_pcb_print'
dir: "%f_%r_%d%v/PCBA" And I think that 'dir' is designed there to be a subdirectory of the output directory which is currently only specifiable on the CLI. The CLI does not know the version, etc, this is only known after reading the files. globals:
dir: "%f_%r_%d%v"
- name: 'pdf_pcb_fab'
type: 'pdf_pcb_print'
dir: "PCBA" The -d option on the command line could override this and the '%' expansion could be allowed there as well. Also, when its in the yaml, we can just run 'kibot' without options and the outputs will be directed to the expected directory based on the PROJECT.kibot.yaml file(s) found. |
Hi @mdeweerd ! I added a global globals:
dir: "%f_%r_%d%v/"
- name: 'pdf_pcb_fab'
type: 'pdf_pcb_print'
dir: "+PCBA" Note the Also note that this doesn't affect the command line option |
@set-soft That perfect, more than I hoped for, certainly more generic. I pulled the update.
Imported file (common to several projects):
Local file (TEST.kibot.yaml):
and the directory generated was .PDF (with the dot). |
By default only
I agree this is more convenient. Done. |
@set-soft Thank you for the update. |
More than half of the tickboxes are checked now ;-). I think that several items are not to be "natively" implemented in kibot, but would be manageable through custom outputs (#109) that allow us to get design information as parameters to the script (date, ...) and output parameters (directory, output filename, options) as well. And there are those that I think are a task for kibot: B&W (monochrome) schematic, and updating date nand time (@neilenns does so in his flow, but I'ld prefer to have it in kibot), Updating a template could be implemented by providing information (as JSON) the custom script, and would ideally get some information not currently available that would require extra scripts to be added to KiAuto (e.g., minimum drill, minimal clearance, track width, etc). So with custom scripts, this could be done in part already. Generating a QRCode is yet another UI action, or calling the existing python script (KiCad/share/kicad/scripting/plugins/kicad_qrcode.py ) with the proper setup. This could be a custom script, or an addition to KiAuto & Kibot. Borderline really. Renumbering references is something I do occasionnaly with BrianAtDocumentedDesigns/RenumKicadPCB (explained here. Could be handled through a custom output as well. But it could also in KiAuto and Kibot natively. I prepared some prototype production files this WE. I managed to have all files generated automatically - there were some minor limitations/issues I had to work around (issues already opened and one fixed today). |
I added monochrome schematic in KiAuto 1.5.12, please test it, was tested with some trivial example. |
Monochrome schematic: tested in project & works! Box ticked! 👏 . |
Can you elaborate it? |
Yes. The comments from the Page Settings. In Comment 4, I put the PCB reference. This can then be added automatically to the filename. And later - with custom commands or filters - this could be used to fill in a text file with some of the PCB information. Thanks ;-). |
Added
|
Related to #93, but also an old idea floating around.
Added two new pre-flight options to do:
The replacements are constrained:
To reduce the changes of breaking the PCB/SCH. If you need to introduce these characters you must do it in the original file and perform small replacements. They can replaced fixed text, or the output of a shell command. So you can customize the date origin and format and add things like the git hash. |
@set-soft Ooooooh those are nice changes. I see the info in the docs, do you have an example of a file showing it in use? Also is this change available in a Docker tagged image somewhere? |
Hi @neilenns !
:-)
The PCB replacement test is pcb_replace_1.kibot.yaml and is applied to light_control.kicad_pcb (date and comment 4 of the title box are changed). The SCH replacement test is sch_replace_1.kibot.yaml and is applied to test_v5.sch and its sub-sheets: deeper.sch and sub-sheet.sch (similar changes).
You need the development tag: |
Now you can manually add them to a compressed output. I know this isn't the ideal, but you can create an archive containing the files. The compress_sources_1.kibot.yaml is a very naive test (no lib or similar stuff). |
Ok, I'm sure that the current report functionality isn't enough to cover every nice report you can imagine, but is a good starting point. I was able to generate the following report that includes the schematic and top/bottom PCB layers. The full report is actually a markdown file. The above file was generated using pandoc. I first generated an ODT and then exported it to PDF (using LibreOffice). |
Thanks for following up (I am not back yet to PCB design activities). This is definitively very good for generating a "technical" datasheet of the manufacturing requirements for the PCB. Which are in turn needed to prepare an order and to make sure that the target goals are met. I use pandoc regularly and you may find some inspiration in these two scripts I have in my bin directory (with some "lua" scripts that are used). I work on Windows with Cygwin, so there is some cygwin specific stuff that is easily converted to "*nix" - you probably just need to throw out the cygpath stuff. (You can reuse those scripts I wrote, the lua's are probably not needed for this use - they are probably from https://gist.github.com/MyriaCore/75729707404cba1c0de89cc03b7a6adf#file-fix-links-lua and https://gist.github.com/lierdakil/00d8143465a488e0b854a3b4bf355cf6 ). |
I didn't go down far enough in your sample to see that you've also added schematic and PCB drawings - very nice! So an even better start to generate documentation ! |
They are currently PDF files, but I plan to add PNG outputs to have better control on the quality. |
I don't like using PNG outputs that much because they pixelize and make the document "heavier". After adding rsvg-convert to my setup, I could generate the following PDF using the generated SVG files. The viewBox of the generated SVG files needs to be cropped to the right size, but the quality is good. |
Did you try to generate a document using KiBot and pandoc? Or is just a custom flow. BTW: SVGs can be used for schematics, but not for PCB printed layers (only plotted) |
Using the SVGs with Markdown and pandoc was a test to see if that flow was possible. I do not know what is not possible for the PCB layers. |
As I wrote: print is the problem, not plot. |
FYI, personnally I only used the "Plotted" SVGs but as far as I remember the issue is that they are not limited to the board size so I had to "crop" them using a manual method. (I understand now that it's more a limitation of KiCAD with regards to the methods implemented in KiBOT). The KiBOT bug is annoying of course, but probably an easy fix that will make it in the next version. |
I'm adding a workaround for the SVG issue. |
Excellent! 👍 |
I have some doubts about it: KiBot is all about automating routine tasks, and this seems to be a one time thing. |
I agree that renumbering is not something that should be done in a CI/CD routine task, but that does not mean it doesn't call for automation (I have a script to call the renumbering tool). Personnally, I see kibot as a "single stop shop". The kibot target does not have to be a default target but if I can do "kibot renumber" and it's done, then that's perfect. Not "many" scripts or manual operations (already greatly reduced bit kibot), but "only" kibot. It"s not a "one time thing" because when you think you're done, there's always something that needs to be added or (re)moved. Having all the configuration settings in a single file is great (I use a yaml configuration that I share accross designs through git submodule). Doing this between two official releases for a few minor changes is not a good idea of course, but between prototypes and before the board is "final", I do repeat this. Regarding pushing (git) things: in the end a human is responsible for it. You still have to review things. Automation can go wrong for plenty of reasons (not only SW bugs). BTW, that's where diffing is interesting. When I make a new release I overlay the new version with the previous one, I carefully check the BOMs manually (using tools to help of course). So it's on my wishlist ;-) and it will be something that I will always have some kind of automation for - I often say that if you need to do something once, you often have to do it twice or more - so I start scripting from the first try. |
The problem with this tool is that this is a Windows + GUI tool, not even compilable using free software (I mean really free, not gratis) and that won't work for the currently stable KiCad (6.x). So we need a replacement. I implemented the power annotation, but I'm not sure about a full annotation. |
I am using a CLI version: And this is my script (unfortunately I still have to type the R to run) and I did not make the projectname variable.
|
My sample script in the repository is better than what I have in my project ;-) - I made the project name variable: |
I took a look to this tool. Is interesting, but isn't what most people like. I now realize it numbers the components according to their PCB position. This is something you don't do on a medium (or big) project, because you work plenty of time on the schematic and then do the PCB. The numbers assigned during schematic work won't change, and you don't want them to be changed because you already used them on your design notes (and shared their reference with other people in the team). I agree that looking at a PCB where components are numbered according to their physical position is nice, but I see it practical only for small projects. BTW tools like BoardView are designed to help with the "mess" of physical positions. Also: this tool is for KiCad 5 and KiCad 6 schematic changed a lot. As I already have some annotation code, and the Python API allows a cleaner access to the PCB (this tool relies on heuristics to patch the netlist of the PCB and collect modules information) I'll play with the concept. |
I do not know what most people like, but it's appreciated in the field whan you are looking for R68 on the PCB, and more when the board drawing or tools are not available on location. I also find it useful in the lab. I know of one company that refused to add component values on the schematic claiming that they are already mentioned in the BOM and always subject to change. Every team/person will work differently, but somebody made this tool, and I am a user of the tool. KiCad itself has an integrated renumbering feature, but it renumbers based on the position in the schematic and to ensure consistency between the schematic and the PCB it (can) use(s) another key value ( you can choose how to update the PCB from the schematic). In the beginning of my career and a project that was composed of one main board that was about "A4" size, with several daughter boards covering about as much, the team responsible for drawing the PCB renumbered the components without asking the designer's opinions. But I hear that you're going to play with the concept and appreciate your openness on the topic. |
This is why we use individual numbering for each page in the schematic. Each page starts its numbering from PAGE*100. And is also useful when you know that R101 and C201 doesn't belong to the same function and that you'll find what's R101 in page 1 and C201 in page 2 ;-) And yes, I'm open, in fact I already implemented the PCB renumbering code. Needs a lot of testing (8 possible orders ...) and I need to feed the changes back to the schematic (trivial for KiCad 6). |
There are advantages in each numbering method, but I personally find that we need to go from schematic to board more often than from the board to the schematic. |
Ok, I added some implementation. Has most of the options found in the original tool. I did some tests, but will need adjusts. |
Ok, I think is time to close this discussion and test the new goodies. |
Very soon now, thanks. I'll try to share my setup more officially than through a project used for debugging. |
I am just about to look into KiBot, AFAICS, KiBot can help with most things, but I am not sure that it generates B/W and color schematics, or generates the PNG files from the 3D viewer.
So just I am sharing what I like to do when wrapping up a KiCAD project, which may give some ideas for future updates. I'll try to tick the boxes that are already possible.
The 2D function is not fully functionnal, and does not look as nice as the export from the 3D viewer. I am ticking boxed below for what is currently configureable.
Edit: The "3D Viewer" is now intergrated into pcbnew_do to generate captures from it allowing all of the following.
I am not sure that we can copy files to the output directory using the project yaml (not the workflow).
The BOM file would already be generated using KiCOST.
(Adding a few more:)
I run most things through native scripts, but this project, once I get it working, may help getting the 3D images and STEP file through automation. Several other steps are automated using local scripts started under cygwin. Edit: -> I am moving this to KiBot using the prebuilt docker files.
The text was updated successfully, but these errors were encountered: