svg-pcb
svg-pcb copied to clipboard
KiCad export: component refdesing using label instead
Currently, KiCad export seems to generate refdes based on the Javascript variable name (and falling back to undefined if it is not assigned to a variable). However, this is inconsistent with the labels shown in SVG-PCB, which uses the label
property of the object passed to board.add
. Using the variable name also makes programmatic generation (e.g., array of LEDs in a for
loop) difficult, since they all need to be given unique names (unless there's some container construct?).
Would it be possible to change the refdes generation to use the label
property - both for consistency and to better support programmatic generation?
I made the refDes the id of the component. It can be passed explicitly: const ic = board.add(thing, { id: "myRefDes" })
. It defaults to a random alphanumeric string. This can be retrieved by ic.id
.