PCBNew: Global/Batch modification of dimensions

Hi,
In V6.0.1, I’m looking for a simple way to globally modify/edit the dimensions in PCBNew.

For instance, the current dimensions are .0000 accurate (which is a bit high for my needs) but furthermore, I’d like to have them without the trailing zeros.

However, there’s a lot of dimensions in this project and I’d like to do a batch modification, instead of editing each dimension, one by one…
Is there such tool available?

Thank you very much.
David

I do not know of a way to do this directly in the GUI.

You can select a dimension, and then edit it’s properties, but if you select two dimensions at the same time, you can not change their properties at the same time. This also does not work for other graphic items such as lines and arcs. It only works on a selection of multiple track segments. For those you can for example change the layer of the selected tracks.

Pcb Editor / Edit / Edit Text and Graphic Properties also does not work for dimensions.

The Footprint editor has a nice way of setting all pads to the same properties, but there is no equivalent for dimension objects.

I see only two options left to automate this.
One is to write a python schipt in Pcbnew. I’m guessing this can be done with a handful of lines, but I do not have experience in this direction.

The other way is with a text search and replace in a text editor.
All of KiCad’s files are human readable text files and can be edited in a text editor.
Below is what a few dimensions with different settings look like:

  (dimension (type aligned) (layer "F.Cu") (tstamp 0847b7d3-501a-4c52-b4e0-7f51a1d59aa6)
    (pts (xy -11.3 11.6) (xy -36 25.8))
    (height 23.092656)
    (gr_text "28,49" (at -36.056628 -2.880545 29.89454342) (layer "F.Cu") (tstamp 3cad4871-f357-423c-bb38-142f118d87a8)
      (effects (font (size 1.5 1.5) (thickness 0.3)))
    )
    (format (units 2) (units_format 0) (precision 2) suppress_zeroes)
    (style (thickness 0.2) (arrow_length 2) (text_position_mode 0) (extension_height 0.58642) (extension_offset 1) keep_text_aligned)
  )
  (dimension (type aligned) (layer "F.Cu") (tstamp 400448d0-a4cc-4753-9bb1-9726da57fbff)
    (pts (xy -58.5 -10.6) (xy -32.1 -17.7))
    (height -9.44946)
    (gr_text "27,33807" (at -48.22161 -25.01345 15.05292077) (layer "F.Cu") (tstamp f41e4c05-0e99-458b-9ab8-02cf11d5f8ca)
      (effects (font (size 1.5 1.5) (thickness 0.3)))
    )
    (format (units 2) (units_format 0) (precision 5))
    (style (thickness 0.2) (arrow_length 2) (text_position_mode 0) (extension_height 0.58642) (extension_offset 1) keep_text_aligned)
  )
  (dimension (type aligned) (layer "F.Cu") (tstamp 71070041-e598-4cf8-9b6e-932bbf134d95)
    (pts (xy -26.3 -33.9) (xy 23.1 -33.4))
    (height -21.93167)
    (gr_text "49,4" (at -1.359813 -57.380455 359.420103) (layer "F.Cu") (tstamp 6dcbae78-6cb9-4665-af59-4f3b0374b146)
      (effects (font (size 1.5 1.5) (thickness 0.3)))
    )
    (format (units 2) (units_format 0) (precision 2) suppress_zeroes)
    (style (thickness 0.2) (arrow_length 2) (text_position_mode 0) (extension_height 0.58642) (extension_offset 1) keep_text_aligned)
  )
  (dimension (type aligned) (layer "F.Cu") (tstamp da5e2eb9-cffc-4a6d-876e-eb7dcbbad407)
    (pts (xy -48.6 -33.5) (xy -86.5 6.6))
    (height 18.080601)
    (gr_text "55,1763" (at -81.998461 -27.105777 46.61560648) (layer "F.Cu") (tstamp cc55bf8f-d3a8-4da6-a5f8-64c109c81511)
      (effects (font (size 1.5 1.5) (thickness 0.3)))
    )
    (format (units 2) (units_format 0) (precision 4))
    (style (thickness 0.2) (arrow_length 2) (text_position_mode 0) (extension_height 0.58642) (extension_offset 1) keep_text_aligned)
  )

So I’m guessing you want to set the Units to “two” and add the text “suprress_zeroes” in the “format” line. Do make a backup before you start editing with a text editor, as a simple mistake can ruin your PCB. Also put a bit of thought in what you search for and what you replace it with. Making the search string longer selects less false positives, but may skip more dimensions you actually want to change.

Also, an ability to do this from within KiCad’s GUI seems a valid feature request for Gitlab. I have not checked there if such a feature request already exists though.

Thank you @paulvdh .
That’s what I suspected… I ended modifying the dimensions one by one, after moving a lot of less useful dimensions to an other layer, thanks to that awesome Action plugin!
I’ll take a look at the python script of PCBNew.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.