Skip to content
Shapemetry

Types - SavedView

API reference for ./evaluate/savedView on @huukhanhnguyen/types.

See the Guide for the package's role.

API reference

Signatures are generated from the live package .d.ts - not hand-written.

SavedView

type

A saved/folded view definition — family + projection + stacked filters + style name. No authoring chain, no expression inputs: the authoring View chain (with operations: (Operation | Container)[]) is in ../model/modelDocument.ts, and this is what a fold of it produces.

type SavedView
// = {
    key: string;
    label?: string;
    family: ViewFamily;
    /** Projection POSE; absent for a headless preset and for a detail view
     *  that frames 2D content 1:1 (no camera, nothing to project).
     *
     *  A pose, not a full {@link Camera}, because a fold cannot honestly
     *  claim a frame: a plan/section/elevation head is drawn in PARALLEL and
     *  takes its frame from the sheet cell and the drawing scale, and a
     *  `view3d` restored into a viewport takes it from the window. A head
     *  that DID resolve a complete camera (`view3d`'s `camera` arg naming a
     *  `cameras[]` entry) passes that camera through here unchanged — a
     *  Camera is a CameraBase. */
    camera?: CameraBase;
    /** Detail views only — the component key whose flat content IS this view. */
    source?: string;
    /** Crop rectangle from the head's `window` arg; absent = no crop (the
     *  extent is computed from what actually drew). */
    window?: ViewWindow;
    filter?: ViewFilterRule[];
    style?: string;
    /** True when the view frames something placeable on paper. */
    placeable: boolean;
}

ViewFilterOverride

type

Per-rule graphic override — rides the same channel per-layer graphics ride to SVG export: color/lineStyle/lineWidth win over the entity's layer/material lookup. halftone renders at a fixed reduced opacity.

type ViewFilterOverride
// = {
    color?: string;
    lineStyle?: LineStyle;
    lineWidth?: number;
    halftone?: boolean;
}

ViewFilterRule

type

One AND-combined test against a field of an entity — key "layer" reads the entity's own .layer; any other key reads attributes[key]. equals/notEquals accept a single value OR an array (any-of / none-of). override applies a graphic override to every entity the rule matches.

type ViewFilterRule
// = {
    key: string;
    equals?: string | string[];
    notEquals?: string | string[];
    override?: ViewFilterOverride;
}

ViewWindow

type

A view-plane crop rectangle, in the model's unit, measured from the camera's own position in its projection basis — the parsed form of a view head's window = [left, bottom, right, top] arg. It rides the VIEW, not the camera: an orthographic camera's frame is one height (OrthographicCamera), while this is what the drawing is cropped to, and the two are independent. NOT the sheets Rect, which is a paper-space placement envelope.

type ViewWindow
// = {
    left: number;
    bottom: number;
    right: number;
    top: number;
}
Last updated: 📖 1 min readEdit on GitHub