Importing netlist without resetting ref/value positions

A quick search didn’t turn up an answer, so I thought I’d ask here:

I have a board I’m getting ready to put into production. I need to update all the 0603 components from hand soldering versions to reflow versions. I have always done this by running CvPcb, making the new footprint associations and then reimporting the netlist in Pcbnew and checking ‘Change’ in the Exchange Footprint section of the dialog.

Problem is that when I do this it resets the positions of all the reference and value texts, as well as their font size. Up until now this was just a mild inconvenience and I would just manual move the text for each changed footprint back to where I needed it. BUT, my current board has several hundred 0603 parts and the position of the reference and value text has been adjusted for almost all of them, so this is no longer a viable way of changing footprints.

Is there a way to systematically change a bunch of footprints and reimport the netlist without resetting the ref/value positions?

1 Like

Many people would find that behavior useful, but I believe it is not supported at this time.

Dale

Only way I can think of would be to write a script (outside of KiCAD) that stores the VAL/REF field positions and after you’re done it restores them.
The kicad_pcb file is human readable and depending on your script foo it might be faster than doing it manually.
Example section:

  (module SOTx:SOT-23-5 (layer B.Cu) (tedit 5821BAA1) (tstamp 57463798)
    (at 201.99 66.9 90)
    (path /572E5E2C)
    (attr smd)
    (fp_text reference U108 (at 1.4 0) (layer B.Fab)
      (effects (font (size 0.6 0.6) (thickness 0.1)) (justify mirror))
    )
    (fp_text value MIC5205 (at 0 0) (layer B.Fab)
      (effects (font (size 0.6 0.5) (thickness 0.1)) (justify mirror))
    )
    (fp_text user %R (at 0 1.2 270) (layer Eco1.User)
      (effects (font (size 0.3 0.3) (thickness 0.03)))
    )

You’d have to take care of the (at x y) parts in the fp_text fields.

yes, this is what I suspected was required. I’m hoping I can just do a find and replace of the module so that module lib:old_module gets changed to module lib:new_module. The problem is that this leaves the netlist with the old footprints and all this would be undone on a re-import. I suppose I could do the same thing to the netlist file. my scripting skills are negligible. I will investigate further, but I agree the option to change footprints while preserving ref/value text properties would be a very useful/essential feature!

Default locations of VAL and REF are rarely final, especially REF
Sometimes different footprints use various REF fonts and sizes.
What would be nice is for VAL/REF to be exported to a separate table when footprints are first imported.
This table would contain x,y, orientation and allow imposing a uniform font size.

When a part footprint gets updated, nothing changes.
When a VAL or REF is changed, the text data is changed in the table
When a footprint is deleted the table entry is deleted

1 Like

I understand that approach, and appreciate the power and versatility it offers.

Can it be implemented without increasing the overall complexity of KiCAD, as seen from the user’s perspective? As things stand now, many new users - and even people with experience in other layout programs - are baffled by KiCAD’s library system, and annoyed by the co-ordinate system’s origin location and sense. Adding another task (i.e., editing the “Table of Silkscreen Fields”) to the process of laying out a board doesn’t seem very user-friendly.

Dale

This table would normally be hidden from the user.
It would be useful for it to be a CSV structured file somewhere for others to use.
Complications come from sometimes having to reset VAL/REF for a part as the substituted footprint is very different.

In the end when you click on a part in pcbnew, you want the associated REF/VAL to also be highlighted

Hi,

last month I made two programs to solve this issue. It only works for References, since I never use visible values on the board.

Before exchanging any footprint I read all the references coordinates (x, y, angle) of the board into a csv file.
After exchanging footprints, I restore the read positions.

I decided to program this after I needed to relocate hundreds of references that I had placed before.

Drawbaks: programmed in plain C, only test under linux, command line executable, filename add ons hardcoded.

If you are interested, I can send you the files.

Regards,
Pedro.

3 Likes

I don’t think a separate table would be necessary, in fact it might get rather messy trying to keep it in sync.

I think KiCAD just needs to replace existing footprints a little more intelligently. Also having a default font/size for REFs and VALs would be handy while allowing each footprint to override the default. Then there would be no need for this data to be in the library.

Quick&dirty fix would be to edit current 0603 footprint (hand soldering to reflow), then use the Change footprint/Change (all same) footprints function. This will leave their position intact. However this will reset the Ref/Value text size and position.