ReferenceRequires BRL

BRL

The BIM.works Report Language — a report document with pages and blocks (tables, charts, KPIs, callouts, viewports, trees), let/foreach/when over embedded BQL queries, embedded BCL checks and BVL styles, interpolation, and how a report is generated.

BRL defines a reusable report: pages of tables, charts, figures and 3D views whose data come from BQL queries run at generation time over whatever models are loaded. The document is structure only; the built-in stylesheet owns the presentation. The grammar builds on BCL, BVL and BQL (BRL grammar), so a report embeds queries, checks and styles as first-class values.

Where it runs#

A Report action (type REPORT3) in the Actions tree stores the document and generates it on demand as HTML or PDF (Use the Actions tree); the chat proposes the same kind. The RunReport3 task takes models and input (the BRL text) with format html (default) or pdf, and returns the self-contained document as html or pdf_base64; it needs the query:run scope. The BRL feature puts Report in the Actions tree's Add new… menu; the task does not check it.

Document#

Text#
brl 1
report "<title>" {
    meta { <key>: <value> ... }
    let <name> = <value>
    page "<title>" { <blocks> }
    foreach <var> in <value> { <items> }
    when <expression> { <items> } [else { <items> }]
}

The header brl 1 states the language version. Items are let bindings, foreach loops, when conditionals and elements. An element is name [ "label" ] { body } or the compact name: value; whether name: value is a configuration key of the enclosing block or a content block is decided by the block catalogue. Names are camelCase identifiers.

Values#

Value Example
Embedded query bql GET type AS Type, COUNT(qid) AS Count GROUP BY type
Embedded check bcl select (type = IFCWALL) { require property.Pset_WallCommon.IsExternal; }
Embedded style bvl if (type = IFCSPACE) { HIDE; }
Markdown (shown as written, not formatted) md``` **Bold** prose ```
Ratio (parsed; no key reads one) 1:100
Array [Type, Count], ["a", 2, 1:50]
Expression 300, 1.1 m, "text with {storey.Name}", true, row.Count > 10 and not empty, format(storey.Elevation, "0.00 m")

Expressions know or, and, not, the comparisons ==, !=, <, <=, >, >=, literals, paths (report.title, and the names a let, a foreach or a table's row binds: storey.Name, row.Count) and the calls now(), count(rows), format(value, "0.00 m"), coalesce(a, b, ...) and bcol(...); there is no arithmetic, data mathematics belongs in BQL. A "string" interpolates {expression}. A $parameter inside an embedded query binds by name to a let, foreach or row variable in scope.

bcol("<definition>"[, <version>]) compares the report's model with an earlier version of it — the version before it, or the version with that number — for a change report (BCOL). The definition is a built-in one (default, everything, inventory, geometry) or BCOL text. The value has left and right ("v3", "v4"), counts (added, removed, changed, unchanged, ignored), categories (rows with Category, Kind and Count, for a table or a chart), records (the first 500 added, removed and changed objects: Status, Category, Type, Name, Changed) and clusters (similar changes: Change, Count); it is empty for a first version.

BRL#
brl 1
report "Changes" {
  let changes = bcol("default")
  page "What changed" {
    text: "From {changes.left} to {changes.right}: {changes.counts.added} added, {changes.counts.removed} removed, {changes.counts.changed} changed"
    table {
      source: changes.categories
      columns: [Category, Count]
    }
  }
}

Blocks#

Block Keys
meta pageSize (A0 to A6, letter or legal; A4 when absent), orientation (portrait, the default, or landscape), header, footer (a line on every page; {page.number} and {page.count} are filled in), strict (true: the first failing block fails the report instead of showing an error), css (the name of a stylesheet; only the built-in one exists, which every other name falls back to)
page "title" orientation, header, footer (this page's, instead of the report's), showTitle (false leaves the heading out)
section "title", text: "..." none: a section is a heading over its blocks, text a paragraph
metadata source (a single-row query) and free label: value rows
table source, columns, caption, row, sort (the source's column aliases to order the rows by, each with an optional asc or desc: ["Count desc", "Type"]); column "H" { value: row.X } sub-blocks for computed columns, column "H" { viewport { entity: row.Qid } } for per-row renders
chart type (bar, the default, column, line, pie, donut), source, label, value, caption; the first 40 rows are drawn
kpiGrid, kpi label, value
callout level (info, warning, error, ok), text
viewport view, output, projection, mode, storey, cutHeight, cut, direction, angle, filter, style, highlight, labels, labelSize, caption, entity (reference/brl#viewports)
tree source, levels, value, caption — a hierarchy from a GROUP BY result, nested by the levels columns, with value summed per group (the rows counted without it)
toc none: the titles of the pages, linked
ifcValidation the stored check-in validation per model (STEP, IFC schema, geometry): rules with exact counts and their findings. Optional stage: ("step", "schema", "geometry", "geometry2d"), minSeverity: (INFO, WARNING, ERROR, FATAL), rules: ["<ruleId>", ...]
keep, break paging control

Only meta and page are allowed at report level. Unknown blocks and keys are validation warnings with a did-you-mean, among them the blocks and keys that earlier drafts of the language named but the renderer does not implement: the blocks image and columns, class on any block, numbering of meta, scale, height, size, dpi and background of viewport, rollup, columns and expand of tree, and depth of toc. An unknown block renders as a placeholder; an unknown key has no effect. A pageSize or orientation the renderer does not take is a warning too.

Viewports#

A viewport renders the loaded models, as a vector drawing or as an image. It is a vector drawing when it has view: plan or view: section, cut:, output: vector, projection: orthographic or mode: hiddenLine: with storey: (a storey's qid) a floor plan, cut at cutHeight: when given; without one an orthographic projection of the whole model from view: top (the default), front, back, left or right, or elevation with direction: north, south, east or west. Any other viewport is an image of the whole model from the camera preset angle:: isoFrontRight (the default), isoFrontLeft, isoBackLeft, isoBackRight, front, back, left, right or top; view: does not change it, and a mode: other than hiddenLine has no effect. In a vector drawing labels: [spaces] (the only layer) writes each space's name and floor area, and labelSize: sets the text size (labelSize: 2.5 mm). filter: restricts a viewport to a subset (an inline bql GET qid ... query, or a qid collection from scope such as check.failedEntities); style: embeds BVL for colours, visibility and VIEWFIT; highlight: paints a qid collection against a ghosted model. Spaces, openings and spatial containers are hidden by default and revealed by a filter: or style: SHOW that names them. The camera fits the visible subset. entity: renders one object, for per-row previews (below).

Objects and slices#

entity: on its own is a shaded 3D thumbnail. With vector output the object is drawn alone, as a drawing: output: vector with view: top, front, back, left or right projects it, and a slice cuts through it perpendicular to the view, removing everything between the cut and the viewer:

  • view: plan is a horizontal slice, view: section a vertical one; both cut through the middle of the object.
  • cut: places the slice on any vector view: cut: 0.3 keeps that share of the object's depth, measured from its far side; cut: 1.1 m cuts that far in front of the far side (in a top view, 1.1 m above the object's bottom). A plan of an object also takes cutHeight:.
  • A section or elevation of one object looks along the object's own axes, so every window is cut the same way whichever wall it is in: direction: side looks at its edge and direction: face at its face. A section is seen from the side by default — the cross-section, such as a door's head and sill — and an elevation (view: elevation output: vector) shows the face. north, south, east and west look along the world axes.

On whole-model and filtered views cut: and view: section slice what the view shows; the whole model takes a fraction (cut: 0.5), not a length. In a table column each row gets its own drawing:

BRL#
brl 1
report "Openings" {
  meta { pageSize: A3  orientation: landscape }
  page "Windows and doors" {
    table {
      source: bql GET qid AS Qid, attribute.Name AS Name, type AS Type WHERE type IN (IFCWINDOW, IFCDOOR)
      column "Name" { value: row.Name }
      column "Plan" { viewport { entity: row.Qid  view: plan } }
      column "Section" { viewport { entity: row.Qid  view: section } }
      column "Elevation" { viewport { entity: row.Qid  view: elevation  output: vector } }
      column "3D" { viewport { entity: row.Qid } }
    }
  }
}

Example#

BRL#
brl 1
report "Model report" {
  meta { pageSize: A4 }
  let wallsByType = bql GET type AS Type, COUNT(qid) AS Count WHERE type = IFCWALL GROUP BY type
  page "Walls" {
    text: "Wall usage by type."
    table { source: wallsByType  columns: [Type, Count] }
    chart { type: bar  source: wallsByType  label: Type  value: Count }
    viewport { view: perspective  style: bvl if (type = IFCWALL) { SHOW; } else { HIDE; } }
  }
  page "Doors" {
    table {
      source: bql GET qid AS Qid, attribute.Name AS Name WHERE type = IFCDOOR
      column "Preview" { viewport { entity: row.Qid } }
      column "Name" { value: row.Name }
    }
  }
  foreach storey in bql GET attribute.Name AS Name, qid AS Qid WHERE type = IFCBUILDINGSTOREY ORDER BY attribute.Elevation {
    page "Storey {storey.Name}" {
      viewport { view: plan  storey: storey.Qid  output: vector }
      table { source: bql GET type AS Type, COUNT(qid) AS Count WHERE buildingStorey.qid IN $storey GROUP BY type }
    }
  }
}

Reusability#

A report is written once and generated against any model set, so it must not hard-code model-specific content: no storey names, qids or counts in the text, no page per instance. "One page per storey" is a foreach over a storey query; anything model-specific comes from an embedded query at generation time. Qids are internal identifiers used for entity:, storey: and parameter bindings, never shown to the reader.

Common mistakes#

  • Hard-coded qids anywhere.
  • An unknown block or key — the validator lists the allowed ones with positions.
  • Column names that do not match the query's aliases (the table renders empty).
  • A query or check inside an array — arrays hold names, strings, numbers and ratios only.

Used in#

Pages#

  • BRL grammarThe Xtext grammar of BRL as shipped in this release.