← Back to team overview

kicad-developers team mailing list archive

Scripting/hacking tracks using new pcbnew format

 

Hi all,

In the absence of known compiled 'Kicad with scripting', and current
project on the go I have dug into scripting/hacking the file directly. My
circuit has 50 identical modules within the pcb (but sharing common
components so I can't just design the circuit once make 50x).

By parsing the new .kicad_pcb file directly I can successfully get/set
the position/rotation of any module (using its fp_text reference):

(module LUXEON_REBEL_COOLPAD   locked (layer Layer0) (tedit 515EAFE6)
(tstamp 512A9571)
    (at 369.89766 234.99826)
    (path /51225974/511E3F14/51192821)
    (fp_text reference D7001 (at 7.112 4.699) (layer F.SilkS)


But scripting nets/tracks is driving me crazy!:

(segment (start 122.9474 228.74) (end 122.795 228.8924) (width 0.2032)
(layer Layer0) (net 51))

My goal is to draw tracks in kicad for one of my 50 identical modules, and
then 'copy' the tracks. The would be done using the said script, which
would create new segments, and applying an offset for the x&y values. This
works to a point,
I can get/set the position of segment(track) and also changing its net
numer appropriately .. and it works SOMETIMES.

>From looking at the .kicad_pcb files generated when saving from pcb_new it
seems like there are added 'status' and/or 'tstamp' flags added at
different times for unknown reasons - I assume that it is these flags that
is causing the my segment/track hack to fail sometimes and work other
times. By fail, when the file is loaded there is just a blank screen.

How can I make it work at all? If I delete all these (extra?) flags will it
work... help!! I have been trying this for couple of days now, making
different test files and comparing the differences etc, in order work out
why it works in some instance and fails in other, and why certain tags are
only applied to certain segments etc etc help help!

Any help gratefully appreciated

Senthil

Follow ups