pyflightstream.workspace.scale (provisional)¶
Generated from the docstrings at build time: every one of the 1 names in the __all__ of pyflightstream.workspace.scale has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
Scale an OBJ mesh uniformly about a point into a new output folder (PFS-2222).
Pipeline role: the workspace layer's geometry verb behind pyfs-mesh scale. Every
vertex p of the OBJ becomes c + factor * (p - c) for the scale centre c (the origin
unless about is given), a homothety: lengths grow by the factor, angles and the face
topology do not change. The file is rewritten line by line as bytes and only the three
coordinates of each v line change; face order, group and component names, normals, texture
coordinates, comments and line endings stay byte for byte, because the solver's results depend on
the face order. The scaled OBJ is written under the input's own name into an output folder the
verb creates (<stem>_scaled<factor> beside the input by default), with a JSON record beside
it: the input digest, the factor, the centre, the vertex and face counts and the bounding boxes
before and after. The input is never overwritten, and an output folder that already holds a file
of that name is refused unless overwrite is given.
Advanced¶
pyflightstream.workspace.scale.scale_mesh
¶
scale_mesh(
mesh: str | Path,
factor: float | str,
*,
out: str | Path | None = None,
about: str | tuple[float, float, float] | None = None,
overwrite: bool = False,
) -> dict[str, Any]
Scale every vertex of an OBJ or .fsm by factor about a point into a new folder.
The file suffix chooses the format: .fsm scales only the x, y and z node rows of its mesh
block (the sidecar <stem>.boundaries.toml is neither read nor copied), anything else is
read as an OBJ.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
str or Path
|
The source OBJ or .fsm, read only. |
required |
factor
|
float or str
|
The uniform length multiplier, finite and above zero (text such as |
required |
out
|
str or Path
|
The output folder, created with its parents. The scaled OBJ goes there under the input
file name, with |
None
|
about
|
str or tuple of float
|
The scale centre |
None
|
overwrite
|
bool
|
Replace a same-name file already in the output folder instead of refusing. |
False
|
Returns:
| Type | Description |
|---|---|
dict
|
The record also written to JSON: input name and sha256, factor, centre, output paths, vertex and face counts and the bounding boxes before and after. |
Raises:
| Type | Description |
|---|---|
InputValueError
|
The factor or centre is unusable, the OBJ holds no usable vertex, or the output would
overwrite a file without |
InputArtifactError
|
The mesh file does not exist. |