Replies: 8 comments 5 replies
-
For backends which do not support clipping paths, viewport support would still be possible: The interior of the viewport could be rendered to an image by setting xlim and ylim like in #451 then rendered to the output using the backend method that would be necessary for drawing IMAGE entities: #525 (comment) looks like matplotlib should support clipping paths: https://matplotlib.org/3.2.2/api/_as_gen/matplotlib.axes.Axes.set_clip_path.html The frontend could also do some culling if an entity doesn't intersect with the clipping region at all then it can be skipped. |
Beta Was this translation helpful? Give feedback.
-
Individual VIEWPORT properties tested with BricsCAD:
Each paper space layout can have an individual CTB/STB plot style table. |
Beta Was this translation helpful? Give feedback.
-
First rudimentary viewport support for the Pillow backend: Same paperspace layout in BricsCad: Supports only top-view VIEWPORT entites and this can only change if the frontend gets proper 3D support. Still to do:
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
In contrast to the |
Beta Was this translation helpful? Give feedback.
-
Next try for the def __init__(...):
super().__init__()
self.ax = ax # current drawing axes
self.main_ax = ax
...
def set_clipping_path(self, path: ezdxf.path.Path = None, scale: float = 1.0) -> bool:
from matplotlib.transforms import Transform
if path:
clip_rect = ezdxf.path.bbox([path])
x, y, _ = clip_rect.extmin
w, h, _ = clip_rect.size
ax = self.main_ax.inset_axes([x, y, w, h])
setup_axes(ax)
mpl_path = ezdxf.path.to_matplotlib_path([path])
ax.set_clip_path(mpl_path, Transform())
self.ax = ax
else:
self.ax = self.main_ax # reset
return True # confirm clipping support This also does not work!!! |
Beta Was this translation helpful? Give feedback.
-
VIEWPORT properties override works: |
Beta Was this translation helpful? Give feedback.
-
Dear @mozman , thanks for the awesome package! May I know is there any update on the viewport drawing support? |
Beta Was this translation helpful? Give feedback.
-
For the support of the VIEWPORT entity in the drawing add-on are some additional features of the backend and frontend required:
ezdxf.path.Path
) if the backend has clipping path support. The frontend can't clip TEXT and the backend is maybe optimized for this task. The clipping path support could also be used to render only the LIMITS or EXTENTS stored in the HEADER section, although they are often incorrect, ezdxf itself does not maintain these values.Just the idea:
VIEWPORT support for the drawing add-on is only being considered and implemented in ezdxf version > 1.0, if at all.
Beta Was this translation helpful? Give feedback.
All reactions