I’m wondering if there is a way to globally move all texts.
I’v found the usefull dialogbox “Menu > Edit > Edit text and graphical elements properties”
( “Menu > Edit > Editer textes et propriétés graphiques” in French )
this dialogbox allow to move all items from a layer to another one (usefull !!! )
is it possible to moves texts relatively to owned parts center ?
( in my case : move all values to (0;0) to print assembling map )
It also be usefull to filter elements using values with wildcard or better using regular expression.
( in my case : moves all text “${REFERENCE}” to (0;0) to print another assembling map )
Does this is possible actually ?
Today I’m moving all parts manually one by one, but it’s so boring …
I haven’t found how to do that automatically.
I used Protel before KiCad and generating documentation was a pain. So when I was looking at KiCad (4.0.7) my first check was how to get it as easy as possible. In my footprint libraries all Ref** and Value are positioned at 0,0 so at PCB I have them ‘automatically’ positioned at 0,0 and I have to move only long value texts colliding with others. References are shorter so with references I typically have 0 work.
Why?
If you use a footprint verified by you you have no work with it. When you update footprint you have to check each update if you can accept it - lot of work.
When I first time used KiCad (2017 V4.07) I found KiCad 0603 resistor footprint being very interested. The distance between pads was 1mm. I thought that if I use 0.2mm tracks and 0.2mm clearance I will be able to route 2 tracks under it. I was happy with it until I asked our contract manufacturer and they said that maximum distance between pads they can tolerate is 0.85mm (absolute maximum 0.9mm).
So I made my version of this footprint and since 2017 never updated it.
until now, I was using my own footprint library for all classic parts ( C/R/L@0603/0805/1206 + SOIC + SOT23-* + TO* …etc… )
but i’m borred to duplicate every news part i need and to update all schematic that came with associated footprint … many many spent time …
so since a year I’ve decided to switch to pure kicad library footprints.
so now i need to find new solutions for doing my job and not only moving text on tech layers
if this interrest someone, i can post here the tools i will create.
thanks to the kicad team for your fantastic work,
thanks to the whole kicad community for spending time to ensure kicad is what it is actually
That I don’t understand. I use only my libraries and my footprints and after I get to my final decisions about how my libraries looks (it was at the beginning of V5) I didn’t updated any schematic ever from any library reason. I had only some work when moving from V5 to V6 and from V6 to V7. I opened each of my schematics and PCBs and saved them. I expect to do it once more when V8 will come.
I recently created a Python App to Search/Replace strings in Kicad’s MOD files (actually, any file) and seeing this post got me thinking about it…
I don’t need to move Ref’s/etc but I like to challenge myself/learn and, though Search/Replace is simple, the challenge is figuring out how to search footprints for various ‘unknown’ X/Y positions and creatively select and replace without injury to bystanders…
So, it’s all about String manipulation - I’ll do some homework - I expect it to be simple. I already tried it with known positions and it works so, for unknown positions a solution is right around the corner.
Having tried it out, it makes sense to me to have Value Input fields (or, select-able offset values) for them - mostly for the Y value so the REF**, Value-Text and User-REF aren’t sitting on top of one-another. It could be hard coded, too… Positions could be Left or Center justified…
And, with Python’s ‘Walk’ function, it would be easy to do the Entire library (or, selected files, folders…)
It’s not just “String” manipulation. KiCad’s files are based o S-Expressions, and as far as I know, you can read them into memory in an organized way with a library and a few command If there is some thought put into this, it may grow into a toolbox to do “weird” things efficiently with KiCad’s files. I write “Weird” things, because “normal” things should (and are) doable from within KiCad itself. And that is also why I write “toolbox”. Some loose scripted programs, with a bit of a manual of it’s intention so it’s relatively easy for newcomers to get to understand how it works. Most ideally, there would be a significant overlap with python scripting as it already works in the PCB editor, bus as I understand it, that is still mostly ad-hoc and scripting for the schematic editor is also still to be determined.
S-expressions are simply grouped text thus, they are strings.
I’ve Searched/Replaced plenty of files containing S-expressions including the App I wrote a few weeks ago to tweak .MOD (footprint) files.
Snippet example below - in this post, it’s about searching for the three Strings (s-expressions) and replacing the current values with 0.0 or other desired value).
Simple stuff…
ADDED:
Since the positions can be different for the footprint’s, use a conditional to test and take action to ensure not changing other/similar data…
The simplicity of Search and Replace by ‘Walking’ through the file/DIR’s is demo’d in Video using the App I referred to - in this case (using the App as-is), just replacing the already known string… Doing All/Multiple File’s and DIR’s is fast.
Of course S-expressions are “just text” and thus strings.
I do not understand the use of your application. What you show can be done with any text editor with a decent search and replace function. What I do like is that it can search and replace strings in multiple files. That is something that KiCad itself can not do, but there are a bunch of text editors that already can do this. I once used monodevelop to modify #define statements in a whole tree of projects for example.
I was thinking along the lines of an application (python script library) that is aware of the S-expressions, and can make use of them but limiting operations to a sub set of the values in the S-expressions. When it is manipulating KiCad files. It would never have to change existing Keywords, because those are what makes it a KiCad file. but it could manipulate the values of the S-expressions while maintaining context.
What I think about is a sort of text version of File / Edit / Edit Text and Graphic Properties combined with File / Edit / Edit Track and Via Properties, but more generic, so it can also be used to do unusual things that do not fit in those dialogs below.
When your program is aware of the S-expressions, it could also do things that span multiple lines. What if (for example) you only wanted to reset that text position for resistors in (multiple) schematic files, or if you want to insert keyword / value pairs in certain locations in the S-expressions. Those are things that are hard to do with text manipulation alone.
I’m sad about this, but I don’t have enough free time to jump inside kicad code and create a nice PR, sorry.
So “yes” : I will write “weird” console app in C# that only do what i need, this will take me about 2h and will be fine…
(no offence, i exactly understand what you mean and spoiler : << you are right ! >> … i’m freelance dev since about 15 years now :D, so I well know ‘customers’ doing weird things )
Naturally, useful code would do more than just string manipulation but, whatever is wanted is doable… Inserting Keyword and doing it for just Resistors (or for any specific part/footprint) is easy…
Yes, most Text-Editor’s do Search & Replace and some have check-box for ‘All’.
I wrote the App I showed to bulk change the Path’s (to the STEP files) that got corrupted when I updated Kicad.
I like the idea of combining the two panels.
Anything (well, most anything) can be done with Kicad’s file data and python has good string and file resources, including the Pattern (with Expression Matching) Module.
Whether or not the String’s are S-exp or ‘whatever’, all can be manipulated - it’s about having an idea, knowing what to do with it and how to do it and/or learn how to do it.
Heck, for fun I coded a Main Panel because the Plugins that populated the PCBeditor made the window too wide for my liking… rough-draft shown… will I actually use it? I don’t know…
Hi,
I’ve done my “tools”, if anybody is interrested, I can share it.
I’ve made a Net C# 7.0 console application (run on windows, linux & macOS).
It takes a *.kicad_pcb as input and deserialize the S-exp tree as List of object,
each element is a field or another List of object containing a tree …etc.
All fields are string actually (quoted or not quoted), but it’s easy to add int
I’ve made a small tree parsing for finding kicad > footprint > fp_text > value & user+ “$[REFERENCE]” > at and set x=0 and y=0.
(this part is really ugly !)
Then re-serialize the tree and saving that to file again (with backup for the origin file of course)
The file formating is lost but kicad (glory to him !) will redo the job during first save.
About 3 hours for the whole task.
— SOLVED —
I hope to put this in trash a day, when official kicad dialogbox can do that.