elementSet.fromEntityRef

The element set a diagnostic’s entity reference names, placed in a revision and node.

GeometricSince 0.3.0

Usage

TypeScript
ElementSet.fromEntityRef(ref: KernelEntityRef, scope?: Scope): ElementSet | null

Parameters

  • refKernelEntityRef

    The reference from a diagnostic’s entities.

    Required

  • scopeScope

    The revision and node the diagnostic refers to (its nodeId); omit for free-standing geometry. Default {}.

Returns

A set of the ref’s kind: edges parsed from "lo:hi" and reordered low first, node and connection ids as strings, other ids as numeric indices; total kept. null when an id is malformed: an index that is not a non-negative integer, or an edge that is not two of them joined by :.

Guarantees

  • result.kind === ref.kind
  • ElementSet.size(result) === ref.ids.length
  • it inverts toEntityRef (ElementSet.toEntityRef(result) deep-equals a ref built by toEntityRef)

Example

TypeScript
ElementSet.fromEntityRef({ kind: 'edge', ids: ['3:1'] }, { node: 'box1' }) // → { node: 'box1', kind: 'edge', edges: [[1, 3]] }

See also