discontinuedPackage jet_cad_floor_plan has been discontinued and replaced by jet_cad_2d_plan.

boxOfDefinition function

SymbolBox? boxOfDefinition(
  1. DraftDocument doc,
  2. Handle definition
)

The local box of the definition definition in doc, from its live leaves (the entities it owns); null when definition names no definition or none of its leaves draws.

Not memoised: O(entities) per call. The per-document memo cleared on a document change belongs to the caller (WallFaces, spec D3, D4).

Implementation

SymbolBox? boxOfDefinition(DraftDocument doc, Handle definition) {
  if (doc.tree.definition(definition) == null) return null;
  final entities = doc.entities;
  return boxOfLeaves([
    for (final slot in entities.liveSlots)
      if (entities.ownerAt(slot) == definition)
        (
          entities.kindAt(slot),
          doc.geometry.read(entities.geomIndexAt(slot)),
        ),
  ]);
}