Skip to content
Shapemetry

@huukhanhnguyen/model / lanes/views/viewChain

lanes/views/viewChain

VIEW_FILTER_METHOD

const VIEW_FILTER_METHOD: "viewFilter"


VIEW_HEAD_METHODS

const VIEW_HEAD_METHODS: Set<string>

The method names that may head a view chain, type-pinned to the lane's one vocabulary declaration (schema/vocabulary/laneMethods.ts, which the catalog derives its nodeType "view" entries from): a head naming a method that table does not declare stops compiling (step 7, 2026-07-27).


VIEW_METHODS

const VIEW_METHODS: Set<string>

Every declared view method — heads AND steps, straight off the vocabulary table, so a method added to the catalog is legal here the same moment.


VIEW_PLACEABLE_METHODS

const VIEW_PLACEABLE_METHODS: Set<string>

Paper placement accepts every HEAD; only a HEADLESS chain (a filter/style preset, which frames nothing) is unplaceable.

view3d joined the set 2026-07-27. It used to be excluded on the theory that a perspective bookmark cannot be drawn — but the drawing pipeline projects in PARALLEL from whatever direction the camera looks (views.ts's basisFromForward handles an arbitrary forward vector), and a parallel projection down an oblique direction is exactly an AXONOMETRIC drawing: the isometric that every drawing set carries next to its plans. So a placed view3d renders as an axonometric; its fov/zoom are ignored on paper, since a drawing has no perspective.


VIEW_STEP_METHODS

const VIEW_STEP_METHODS: Set<string>


VIEW_STYLE_METHOD

const VIEW_STYLE_METHOD: "viewStyle"


chainView()

chainView(key, record?): View

Test/UI helper: build a chain View from a record-shaped description.

Parameters

key

string

record?

camera?

{ far?: number; fov?: number; height?: number; near?: number; position: Point; target: Point; up?: Point; }

camera.far?

number

camera.fov?

number

camera.height?

number

camera.near?

number

camera.position

Point

camera.target

Point

camera.up?

Point

filter?

ViewFilterRule[]

"viewPlan" | "viewSection" | "viewElevation" | "view3d" | "viewDetail"

label?

string

style?

string

Returns

View


clearViewArg()

clearViewArg(node, key): void

Parameters

node

Operation

key

string

Returns

void


findSectionObject()

findSectionObject(objects, key): SectionObject | undefined

A section object by its objects[] key. Walks blocks. Falls back to the first section object in the scene — same contract as findSectionPlane.

Parameters

objects

readonly SceneObject[]

key

string

Returns

SectionObject | undefined


findSectionPlane()

findSectionPlane(entries, key): SectionData | undefined

The scene's section plane — authoring-time + viewSection.plane resolve. Matches by the owning object's key (a SectionData payload alone carries no identity — see SectionPlaneRef's doc); falls back to the first section plane in the scene when no entry's key matches, same contract as findSectionObject. Same helper views.ts re-exports.

Parameters

entries

readonly SectionPlaneRef[]

key

string

Returns

SectionData | undefined


foldViewChain()

foldViewChain(view, options?): FoldedView

Config-fold a views[] chain into a resolved definition.

Parameters

view

View

options?

FoldViewOptions = {}

Returns

FoldedView


isFlatView()

isFlatView(view): view is FlatView

Parameters

view

FoldedView

Returns

view is FlatView


isProjectionView()

isProjectionView(view): view is ProjectionView

Parameters

view

FoldedView

Returns

view is ProjectionView


isSectionView()

isSectionView(view): view is SectionView

Parameters

view

FoldedView

Returns

view is SectionView


isViewPlaceable()

isViewPlaceable(view): boolean

True when the chain has a paper-placeable head (plan/section/elevation).

Parameters

view

View

Returns

boolean


operationsFromRecordView()

operationsFromRecordView(record): Operation[]

Inverse of the fold: a resolved view definition (head + pose + filter/style; crop and scale belong to the sheet placement, never to the view) back into the chain operations that produce it. The authoring UI and tests build fixtures through it, so a fixture can still think in projection terms.

head names the head method — it is NOT inferred from camera fields any more (the type tag it used to read is gone, and a pose alone cannot say whether an author meant a plan or a 3D bookmark). Everything else about the head is still derived from the pose: which principal elevation it faces, whether a plan is cut, where the section plane sits.

Parameters

record

camera?

{ far?: number; fov?: number; height?: number; near?: number; position: Point; target: Point; up?: Point; }

camera.far?

number

camera.fov?

number

camera.height?

number

camera.near?

number

camera.position

Point

camera.target

Point

camera.up?

Point

filter?

ViewFilterRule[]

head?

"viewPlan" | "viewSection" | "viewElevation" | "view3d" | "viewDetail"

style?

string

Returns

Operation[]


reasonOf()

reasonOf(error): string

Exported so Model._foldViewOptions reports an unreadable view expression in the SAME words this module does — one gate, one message.

Parameters

error

unknown

Returns

string


sectionDataFromObjects()

sectionDataFromObjects(objects): SectionPlaneRef[]

Section-plane objects from the scene-object stream (not tessellated leaves), each paired with its objects[] key. viewSection.plane resolves against these (findSectionPlane).

Parameters

objects

readonly SceneObject[]

Returns

SectionPlaneRef[]


sectionDepthOf()

sectionDepthOf(view, evaluateArg?): number | undefined

Depth from the authoring head — not stored on the fold (one extra field).

Parameters

view

View

evaluateArg?

(input) => unknown

Returns

number | undefined


setViewArg()

setViewArg(node, key, input): void

Parameters

node

Operation

key

string

input

string

Returns

void


setViewStyleStep()

setViewStyleStep(view, styleName): void

Set/replace the viewStyle step (last wins; creates one when missing).

Parameters

view

View

styleName

string | undefined

Returns

void


viewArgInput()

viewArgInput(node, key): string | undefined

Arg get/set on a view operation node.

Parameters

node

Operation

key

string

Returns

string | undefined


viewExprJson()

viewExprJson(value): string

Parameters

value

unknown

Returns

string


viewExprNumber()

viewExprNumber(n): string

Expression-literal helpers for authoring ops (UI + tests + migration).

Parameters

n

number

Returns

string


viewExprPoint()

viewExprPoint(p): string

Parameters

p

[number, number, number]

Returns

string


viewExprString()

viewExprString(s): string

Parameters

s

string

Returns

string


viewExprWindow()

viewExprWindow(w): string

Parameters

w

[number, number, number, number]

Returns

string


viewHeadOf()

viewHeadOf(view): Operation | undefined

First head operation in a view chain (skipping containers / disabled not checked).

Parameters

view

View

Returns

Operation | undefined


viewStyleNameLiteral()

viewStyleNameLiteral(view): string | undefined

Style name from the last viewStyle step (literal or any — no eval).

Parameters

view

View

Returns

string | undefined


VIEW_HEAD_METHOD_NAMES

Re-exports VIEW_HEAD_METHOD_NAMES

Last updated: 📖 6 min readEdit on GitHub