mozman / ezdxf

Python interface to DXF
https://ezdxf.mozman.at
MIT License
937 stars 191 forks source link

Optional content groups in muPDF backend #1155

Closed mbway closed 3 months ago

mbway commented 3 months ago

This PR introduces the option for the muPDF backend to tag entities as belonging to 'optional content groups' which are similar to layers in that visibility of entities in the groups can be toggled in supported viewers. muPDF OCG documentation. This feature was requested in #1154 .

The current implementation only outputs visible layers as entities on invisible/hidden layers are filtered out by the frontend. A future improvement could be to use --all-layers-visible together with an option for the backend to set the layer visibility in the output independently from their visibility in the dxf.

Some fixes have also been applied to the ezdxf draw command as the --all-layers-visible had stopped working.

mbway commented 3 months ago

the output of ezdxf draw examples_dxf/visibility.dxf --backend mupdf --out out.pdf

image

mozman commented 3 months ago

I would not add support for exporting turned off or frozen layers, as this is often not the intention of the DXF file creator, although BricsCAD supports this as an option.

It is very laborious to implement and test and may break other functionality.