Custom Component Attributes

Hi,

I’d like to put custom information in the footprint for an LED.

First, is there any way (or any attribute) to reference the number of copies of that device in the schematic? For example, I’d like to number the LEDs in the chain on the board without the PX prefix (currently using {{NAME}} ).

Secondly, I’d like to add a custom attribute to the footprint that is essentially the number in the chain (i.e. 33) plus some offset number (i.e. 50) specific to the board. Ideally this offset number would be some sort of board attribute and can be referenced with something like {{BOARD_OFFSET}} ( and in the end look like {{LED_NUMBER + BOARD_OFFSET}} ).

Thanks,

Luke

Hi,

Huh that’s a very special use-case. I’m afraid but both things are currently not possible.

Honestly I feel an attribute which contains only the number of {{NAME}} is too specific to be implemented in LibrePCB. In fact, a name does not necessarily need to consist of letters followed by a number, so such an attribute wouldn’t even work in some cases. I’d simply recommend to put a text label on the board with the hardcoded text “1”, “2”, “3” etc.

The second question could be considered a more generic feature: Supporting arithmetic expressions in attribute evaluation. Still kind of special but I agree it might make sense in some cases. But anyway, it is currently not supported.

The only thing I could imagine as a workaround is to work with string concatenation. E.g. specify a board attribute “LED_PREFIX” and then put “{{LED_PREFIX}}1” on the silkscreen to get something like “1.1”, “2.1”, “3.1” etc.

EDIT: Ohh I just realized, user-defined attributes are currently not supported on board level. Therefore the “{{LED_PREFIX}}” workaround doesn’t work either, I’m afraid.

Oh okay, thanks for looking into it anyways!

1 Like