Searching and queries

Most of what is in your model can’t be clicked on. Property sets, classifications, materials, tasks, cost items - none of it has geometry to draw in the viewport, and the objects that do are frequently buried behind other objects.

So clicking can’t be the main way you reach the model, and if it is the only way you know, you are working with the small visible fraction of your project.

Select by what things are

The way in is to describe what you want rather than to find and click it. Bonsai, which edits your building model as an IFC file, will select by class, by the storey or space something sits in, by its type, by its material, by a classification code, or by any property in any property set.

“Every external wall” and “everything on Level 2” and “every door of type DT03” are questions about the data, and the answer arrives as a selection whether or not the things are visible.

The selection is also what you then act on. A type, a classification or a corrected class is applied to everything selected at once, which is how a file that arrived with gaps in it gets put right.

There is a query language, and it is worth ten minutes

Underneath the filters is a small textual query language called the selector syntax, and it is the durable interface - it is written down, it can be saved, and it doesn’t move when the buttons do.

IfcWall

Every wall. Narrow it by adding terms separated by commas:

IfcWall, Pset_WallCommon.IsExternal=TRUE

Only the external ones. A comma means and, so each term you add takes things away:

IfcWall, location="Level 2", type=WT01

Walls, on Level 2, of type WT01. One exception looks like an inconsistency and isn’t:

IfcWall, IfcSlab

Two plain class names separated by a comma give you both, since nothing can be a wall and a slab at once.

Comparisons other than = are available - != for is not, > and < for numbers, and *= for contains:

IfcDoor, Pset_DoorCommon.FireRating!=FD30
IfcSpace, Name*=Store

The first of those finds you a problem: every door whose fire rating isn’t what you assumed. The pair also shows the two shapes a term can take. A dotted Pset_DoorCommon.FireRating is a property inside a named set; a bare Name is an attribute of the object itself, spelled exactly as the schema spells it - the difference between an attribute and a property, as two ways of typing a question.

Note the negation goes on the comparison. You can’t put a ! in front of a property term - that is a syntax error - though you can put one in front of a class name, to take that class back out of what you have already asked for. On its own, ! IfcWall returns nothing at all, because negation needs a set to subtract from.

A + between groups gives you a union, for when a single narrowing chain won’t express it:

IfcWall, location="Level 1" + IfcSlab, location="Level 2"

A search is a thing you keep

Selections are ephemeral and queries aren’t. You can save a query, name it, and load it again next week. Where it is saved matters: the query is kept in the model itself, so it travels with the file. Send somebody your model and they get your searches along with it.

The first time you work out how to select every fire door on a floor, that is a piece of work; saving it means you did that work once, and whoever opens the model after you inherits it.

Colouring by property, which is how you look at data

The other tool here is easy to overlook and is the fastest way to see something wrong. Bonsai will colour every object in the model according to the value of a property you name.

Colour the model by fire rating and the walls that have none are suddenly obvious, in a way that no amount of clicking through each object’s properties would ever have made them. Colour it by classification, or by type, or by whether something is load bearing, and you are looking at the non-geometric part of the model using the one faculty that reads a whole floor at a glance. Colour schemes save and load in the same way queries do.

The selector syntax is used everywhere

The selector syntax isn’t just a feature of the search tools. It decides which elements appear on a drawing, picks the rows of a schedule, and turns up in several other places too, which the page on scripting lists. So learning to say external walls on Level 2 of type WT01 is learning the sentence that a drawing, a schedule and a clash test are all built out of.

Once you can ask the model what it contains, you can ask whether that is what somebody required, which is checking the model.