hertzforge.record¶
record
¶
A geometry's animation recorded to a video with no window open (hertzforge record).
The animation is the one the app's 3-D view plays for the same selection (service.show):
a shape set's modes on their geometry, or data played on it, measured motion or modal
coordinates through their shape set. It is drawn by the app's own 3-D view, in the report
viewer's page (report/viewer.html) with a recording in place of a report, so it looks as the
app does. Headless Chrome draws the page; each frame is drawn on demand at its own time, not as
the page plays, so a slow machine records the same video as a fast one; ffmpeg writes the
frames to an H.264 MP4.
Chrome (or Chromium, or Edge) and ffmpeg are found on the machine, or named by the
HERTZFORGE_CHROME and HERTZFORGE_FFMPEG variables. Nothing else is needed: Chrome is driven
over its DevTools protocol with websockets, which the service already uses.
Classes:
| Name | Description |
|---|---|
RecordError |
A recording that cannot be made, in words for the person running it. |
Recording |
What a recording is made of, and how it is drawn and timed. |
Functions:
| Name | Description |
|---|---|
coloring |
How the recording colors its elements ( |
animation_view |
The |
drawn_scale |
The amplitude the view is drawn at, as a multiple of the app's own: the recording's |
record_page |
The report viewer's page with the recording's view in it, ready for a browser to draw. |
stage_page |
The report viewer's page with |
frame_times |
Where each frame is drawn: for measured motion a sample (from 0), for a mode a fraction |
find_chrome |
Chrome, Chromium or Edge on this machine, or the one HERTZFORGE_CHROME names. |
find_ffmpeg |
ffmpeg on this machine, or the one HERTZFORGE_FFMPEG names. |
chrome_arguments |
The command that starts headless Chrome on a fresh profile at |
opened |
The recording page at |
frame_at |
Where one picture of the recording is drawn ( |
picture |
One frame of the recording, as the video would show it at |
record |
The recording drawn and written to |
Classes¶
RecordError
¶
Bases: AnimationError
A recording that cannot be made, in words for the person running it.
Recording
dataclass
¶
Recording(geometry: str, data: str | None = None, shapes: str | None = None, mode: int = 1, width: int = 1920, height: int = 1080, fps: float = 30.0, speed: float | None = None, seconds: float | None = None, cycles: float = 3.0, scale: float = 1.0, magnification: float | None = None, opacity: float = 1.0, view: str = 'iso', eye: Sequence[float] | None = None, up: Sequence[float] | None = None, frame: Sequence[str] | None = None, theme: str = 'dark', records: Sequence[int] = tuple(), strain_stress: str | None = None, quantity: str = 'stress', color: str = 'von_mises', color_max: float | None = None, color_groups: Sequence[str] | None = None, units: str = 'm-kg-N-s')
What a recording is made of, and how it is drawn and timed.
geometry is drawn; with data that data plays on it (modal coordinates through shapes,
or their own set when the project knows it); with only shapes, its mode mode (from 1)
swings. speed is the fraction of real time measured motion plays at, or seconds the
video's length; a mode swings for cycles cycles unless seconds says otherwise. scale
multiplies the app's own amplitude (the largest deflection drawn at 7.5 % of the model's
size). opacity is how solid the surface is drawn, 1 solid. view names a camera from
animation.VIEWS ('iso' the geometry's own view), or eye and up give one. frame names
element groups of the geometry to fit the camera to, in place of the whole model: the rest
is still drawn, running out of the frame, and the amplitude is still a share of the whole
model's size, so framing closer does not change how far the motion is magnified.
magnification, in place of scale, states that directly for measured displacement: the
displacement drawn over the true one, so recordings of different models share one scale.
strain_stress names an element shape set of the geometry whose elements are colored as
the model moves, the rest drawn gray: with data, modal coordinates of the shape set it was
read from, each element's tensor summed over the modes at each instant; with no data, its
own modes, each through its cycle. quantity is 'stress' or 'strain', and color the
scalar of the summed tensor the elements are colored by: 'von_mises', 'tresca',
'max_principal', 'mid_principal', 'min_principal' (stress), a component ('xx' ... 'xz'), or
'largest', the component that reaches furthest. color_groups names the element groups
colored (every element read when None). color_max states the top of the color scale, a
stress in units' pressure (MPa for 'mm-kg-N-s', psi for 'in-slinch-lbf-s'), so recordings
of one model under different loads read on the same colors; the clip's largest value, or
each mode's own, when None. The legend, drawn into every frame, names the scalar, its unit
in units, and a stated scale.
Functions:¶
coloring
¶
coloring(project: Any, recording: Recording) -> dict[str, Any] | None
How the recording colors its elements (service.show.element_coloring), None when it
colors none; RecordError for a setting that cannot be read one way.
animation_view
¶
animation_view(project: Any, recording: Recording) -> dict[str, Any]
The shape3d view the app shows for the recording's selection, opening at its opacity
and from its camera, or RecordError saying why there is none to play.
drawn_scale
¶
drawn_scale(view: dict[str, Any], recording: Recording) -> float
The amplitude the view is drawn at, as a multiple of the app's own: the recording's
scale, or for a magnification the multiple that draws the motion's largest true
displacement (motion.peak, in meters as the nodes are) that many times over.
record_page
¶
record_page(project: Any, recording: Recording) -> str
The report viewer's page with the recording's view in it, ready for a browser to draw.
stage_page
¶
The report viewer's page with view alone on it, drawn by the app's 3-D view at
setup's size, scale and mode, in the light or dark theme.
frame_times
¶
frame_times(info: Mapping[str, Any], recording: Recording) -> list[float]
Where each frame is drawn: for measured motion a sample (from 0), for a mode a fraction
of its cycle. Motion plays at speed of real time (once through, at real time, when
neither it nor seconds is given); a mode swings cycles cycles of the app's own length.
find_chrome
¶
Chrome, Chromium or Edge on this machine, or the one HERTZFORGE_CHROME names.
chrome_arguments
¶
The command that starts headless Chrome on a fresh profile at profile. It keeps no
cookies or passwords, so it is told not to use the system's keychain
(--use-mock-keychain, --password-store=basic): a browser with no keychain item of its
own yet, such as a Chromium for testing, otherwise has macOS ask for the login password.
opened
¶
The recording page at path opened in browser and drawn, ready for its frames, or
RecordError saying why the page did not draw it.
frame_at
¶
Where one picture of the recording is drawn (frame_times' terms): for motion the sample
at time at in the data's own time (its first sample when None), for a mode at of its
cycle (a quarter, its full deflection, when None).