dbrgn
November 3, 2024, 6:09pm
1
It would be nice if there were an output job type where a rendered version of the PCB (e.g. top and bottom, maybe with configurable angle and margin) could be exported as PNG.
Actually this is already implemented, as it is used on LibrePCB Fab:
LibrePCB:master
← LibrePCB:pcb-preview-output-job
opened 01:44PM - 14 Feb 24 UTC
The graphics export (PDF/PNG/...) so far only supported to render boards the sam… e way as on screen. This PR adds the option to render boards in a realistic mode, with proper clipping of objects to the board area etc. We'll need this feature on the LibrePCB Fab website to generate the preview pictures since our current solution of using a 3rd-party Python library has some problems.
Example output of this new feature:
![preview1](https://github.com/LibrePCB/LibrePCB/assets/5374821/559e72bf-a6e3-4891-a8d2-041b058fbf56) ![preview2](https://github.com/LibrePCB/LibrePCB/assets/5374821/79d9373a-e428-421c-9f9a-44939f19162e)
I didn't add this option to the GUI yet because the data structure needs to be changed a bit for file format v2 anyway, which can be done together then. If someone still wants to use it already, just add these S-Expression nodes to the desired output job in `project/jobs.lp`:
```scheme
(content (type board) (title "Rendering Top")
(paper auto) (orientation auto) (rotate false) (mirror false) (scale auto)
(margins (left 10.0) (top 10.0) (right 10.0) (bottom 10.0))
(dpi 600) (min_line_width 0.1) (monochrome false) (background "#00000000")
(board default)
(variant none)
(option realistic)
)
(content (type board) (title "Rendering Bottom")
(paper auto) (orientation auto) (rotate false) (mirror true) (scale auto)
(margins (left 10.0) (top 10.0) (right 10.0) (bottom 10.0))
(dpi 600) (min_line_width 0.1) (monochrome false) (background "#00000000")
(board default)
(variant none)
(option realistic)
)
```
It’s just not in the UI yet and the file format is kind of “temporary”. You can add the (option realistic)
manually. For LibrePCB 2.0 there’s an issue to keep in mind to adjust the file format:
opened 01:47PM - 14 Feb 24 UTC
file format
export
##### SUMMARY
<!-- Describe what feature should be added or improved, or what u… sability flaw
you encountered. Provide screenshots if reasonable. -->
#1304 added the `realistic` option flag to the graphics output job. However, for file format v2 probably it makes more sense to use a dedicated page content type for the realistic mode, so a file format migration should be implemented.
1 Like