Skip to content

Commit

Permalink
Add support for project variables in texts
Browse files Browse the repository at this point in the history
  • Loading branch information
yaqwsx committed Oct 17, 2023
1 parent 4fcea6a commit 1a7bcae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 6 additions & 4 deletions docs/panelization/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,12 @@ Fiducials based on a plugin.

Add text to the panel. Allows you to put a single block of text on panel. You
can use variables enclosed in `{}`. E.g. `{boardTitle} | {boardDate}`. The list
of all available variables in listed bellow. In the case you need more
independent texts on the panel, you can use sections names `text2`, `text3` and
`text3` to add at most 4 text. All these sections behave the same and accept the
same options.
of all available variables in listed bellow. You can also use the variables
specified in the project. They are prefixed with `user-`. That is, to include
your variable `revision` in KiKit text, use formatting string `Rev:
{user-revision}`. In the case you need more independent texts on the panel, you
can use sections names `text2`, `text3` and `text3` to add at most 4 text. All
these sections behave the same and accept the same options.

If you need more texts or more sophisticated placing options, see `script`
option from `postprocess`.
Expand Down
3 changes: 3 additions & 0 deletions kikit/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,7 @@ def kikitTextVars(board: pcbnew.BOARD, vars: Dict[str, str]={}) -> Dict[str, Any
for i in range(10):
availableVars[f"boardComment{i + 1}"] = Formatter(lambda: board.GetTitleBlock().GetComment(i), vars)

for var, value in vars.items():
availableVars[f"user-{var}"] = value

return availableVars

0 comments on commit 1a7bcae

Please sign in to comment.