Skip to content
Shapemetry

Model

Guide

What it is: the RUNTIME parametric kernel - load ModelJSON, build a node graph, evaluate(), emit scene vocabulary for hosts.

Headless and deterministic. Depends on geometry and io.

Pipeline

ModelJSON → Model.fromJSON({ registry }) → model.evaluate(params?)
         → EvaluateResult { geometry, materials, params, … }
         → scene Entity / Material (hosts + @huukhanhnguyen/io)

Document shapes

type ModelJSON = {
  title: string
  parameters?: (Operation | Container)[]   // header value bindings
  objects?: Container[]      // scene body folds (Entities steps); key required at the root
  materials?: (Operation | Container)[]
  layers?: (Operation | Container)[]
  views?: …; lights?: …; cameras?: …; …
}

// No nodeType field - discriminate by method vs operations[]
// Entity chains (objects[], component bodies/openings, sheets) use Entities;
// the config lanes use Operation, which adds children? + animation?.
type Entities  = { method: string; args?: { key: string; input: string }[]; key?: string; … }
type Operation = Entities & { children?: (Operation | Container)[]; animation?: … }
type Container = { operations: (Entities | Container)[]; key?: string; … }

Args are expression strings evaluated at runtime. Producers concat into the stream; transforms map/reduce; containers nest folds.

Entry points

SpecifierRole
@huukhanhnguyen/modelFull runtime
@huukhanhnguyen/model/computeCompute-only import graph
@huukhanhnguyen/model/nodesDefault method registry
import { Model } from '@huukhanhnguyen/model'
import { nodeRegistry } from '@huukhanhnguyen/model/nodes'
const model = Model.fromJSON(json, { registry: nodeRegistry })
const result = model.evaluate()

Method tables (AUTOGEN): REFERENCE.md, ENTITIES.md.

Nodes

Every authorable method, with its args, types, defaults and meanings. Generated from the live NODE_REGISTRY.

Expression

Every function callable inside an expression, generated from the live FUNCTION_REGISTRY.

API reference

One page per source module, grouped by source directory. Each page's intro names the entry points it is reachable from (., ./compute, ./nodes); the registry surface is on Nodes.

src/

src/commandRegistry/

src/conventions/

src/core/

src/document/

src/export/

src/functionRegistry/

src/graph/

src/import/

  • STL - 1 symbols
  • USD - 2 symbols

src/lanes/

src/nodeMethods/

src/nodes/

src/registry/

src/schema/

src/utils/

src/validate/

Last updated: 📖 4 min readEdit on GitHub