elementSet.toEntityRef

The entity reference a diagnostic carries for this set, or null when diagnostics cannot name its kind.

GeometricSince 0.3.0

Usage

TypeScript
ElementSet.toEntityRef(s: ElementSet): KernelEntityRef | null

Parameters

  • sElementSet

    The element set.

    Required

Returns

A KernelEntityRef with the same kind: indices as numbers, edges as "lo:hi" strings, node and connection ids as given, total kept. null for kinds cv and instance and for persistent-id sets.

Guarantees

  • it round-trips: ElementSet.fromEntityRef(ref, { revision: s.revision, node: s.node }) deep-equals s for point, prim, vertex, edge, node and connection sets
  • ids.length === ElementSet.size(s) for a non-null result

Example

TypeScript
ElementSet.toEntityRef(ElementSet.edges([[3, 1]])) // → { kind: 'edge', ids: ['1:3'] }
ElementSet.toEntityRef(ElementSet.cvs([[0, 0]])) // → null

See also