visualdynamics.viz¶
viz
¶
The 3-D scene: geometry, DOF arrows and moving mode shapes.
PyVista over VTK, shown in the app's own pane or rendered
off-screen to an image. The plots on an axis are visualdynamics.plot;
this is the half that has a camera in it.
Functions:
| Name | Description |
|---|---|
geometry_scene |
Build (or add to) a PyVista plotter showing the geometry. |
plot_geometry |
Show the geometry interactively, or render to |
plot_waterfall |
Show the waterfall interactively, or render it to |
waterfall_scene |
Build (or add to) a PyVista plotter showing the waterfall. |
undeferred |
Make this Qt plotter render synchronously, and return it. |
Functions:¶
geometry_scene
¶
geometry_scene(
geometry: Geometry,
unit_system: UnitSystem | None = None,
plotter: Any = None,
node_size: float = 8.0,
line_width: float = 2.0,
show_edges: bool = True,
opacity: float = 1.0,
labels: Sequence[str] | None = None,
off_screen: bool = False,
theme: Any = None,
components: Sequence[str] | None = None,
) -> Any
Build (or add to) a PyVista plotter showing the geometry.
theme is 'light', 'dark', or a colors dict; it sets the scene
background and annotation color. components limits what is drawn to a
subset of {'nodes', 'tracelines', 'elements'} — selecting one in the
project tree shows just that part. Returns the plotter; call .show() on
it (or .screenshot() if off_screen).
Source code in src/visualdynamics/viz/geometry.py
plot_geometry
¶
plot_geometry(
geometry: Geometry,
unit_system: UnitSystem | None = None,
screenshot: str | None = None,
theme: Any = None,
show: bool = True,
**kwargs: Any,
) -> Any
Show the geometry interactively, or render to screenshot headlessly.
Shown, it comes up in the app's own 3-D pane — the labelled axes and
the orientation triad are toggles on the bar over it, exactly as in
the window. Returns the pane (its .plotter is the PyVista one), or
the image array when rendering to a file.
Source code in src/visualdynamics/viz/geometry.py
plot_waterfall
¶
plot_waterfall(
data: DataArray,
records: Sequence[int] | None = None,
*,
screenshot: str | None = None,
unit_system: UnitSystem | None = None,
theme: Any = None,
component: str = "magnitude",
show: bool = True,
quantity: tuple[str, str | None] | None = None,
) -> Any
Show the waterfall interactively, or render it to screenshot.
The scriptable face of the plot bar's 3-D reading, like
plot_geometry for the geometry scene. Returns the pane (its
.plotter is the PyVista one), or the image array when rendering
to a file.
Source code in src/visualdynamics/viz/waterfall.py
waterfall_scene
¶
waterfall_scene(
data: DataArray,
records: Sequence[int] | None = None,
unit_system: UnitSystem | None = None,
plotter: Any = None,
off_screen: bool = False,
theme: Any = None,
component: str = "magnitude",
budget: int = POINT_BUDGET,
quantity: tuple[str, str | None] | None = None,
) -> Any
Build (or add to) a PyVista plotter showing the waterfall.
Same shape as geometry_scene: theme is 'light', 'dark' or a
colors dict; returns the plotter — .show() it, or .screenshot()
if off_screen. The camera is placed once, here: from the front-left
and above, abscissa reading left to right, records receding.
Source code in src/visualdynamics/viz/waterfall.py
undeferred
¶
Make this Qt plotter render synchronously, and return it.
On macOS pyvistaqt wraps render() in a worker thread that emits
a signal back to the GUI thread, so every render becomes a queued
metacall delivered later by the event loop. That indirection exists
to make render() safe to call from another thread — which
nothing here ever does — and it opens a race that nothing here can
close: if the widget's native window goes away between the emit and
the delivery, the queued call walks into vtkCocoaRenderWindow
with a dead QPlatformWindow and the process dies with SIGSEGV
(seen in the field: QPlatformWindow::window() dereferencing
null out of NSOpenGLContext update).
Calling the unthreaded path directly is what the queued delivery
would have done, minus the window between emit and delivery in
which the target can die. _rendered is forced the way the
threaded override forces it, because BasePlotter.render skips
the flag when it skips the render, and pyvistaqt marked that flag
"crucial".
Bound on the instance at construction rather than patched on the class, so a pyvistaqt used by anything else in the process keeps its own behaviour.