SuperAPI AI Directory

ifc-syntax-quantities

Testing & quality

View repository

Updated 10-15 22:18

About this skill

IFC Syntax : Quantities

An IFC model carries measured magnitudes (the length of a wall, the net volume of a slab, the count of items in an assembly) in a dedicated container : IfcElementQuantity. Quantities are the data behind quantity take-off and cost estimation. This skill covers the quantity entities, how they attach to elements, and how they differ across versions.

Applies to IFC2x3, IFC4, and IFC4.3. Three things changed across versions : see the Version Differences section.

Quick Reference

Properties vs quantities : the conceptual rule

ALWAYS keep these two apart. They live in different containers.

  • A property (IfcPropertySet) carries a descriptive or design attribute : fire rating, IsExternal, thermal transmittance, a load-bearing flag.
  • A quantity (IfcElementQuantity) carries a measured magnitude derived from the element's geometry or specification : gross side area, net volume, count of items.

NEVER put a measured magnitude in a property set, and NEVER put a descriptive attribute in a quantity set. A quantity-take-off reader looks only in IfcElementQuantity containers ; a magnitude hidden in a Pset_ is invisible to it.

The quantity container : IfcElementQuantity

IfcElementQuantity is the container for measured quantities. Verified verbatim (IFC4.3) :

ENTITY IfcElementQuantity
 SUBTYPE OF (IfcQuantitySet);
	MethodOfMeasurement : OPTIONAL IfcLabel;
	Quantities : SET [1:?] OF IfcPhysicalQuantity;
 WHERE
	UniqueQuantityNames : IfcUniqueQuantityNames(Quantities);
END_ENTITY;
  • MethodOfMeasurement names the standard of measurement used (for example a national take-off standard). It is OPTIONAL.
  • Quantities holds one or more IfcPhysicalQuantity instances. The set is never empty ([1:?]).
  • The UniqueQuantityNames rule forbids two quantities in the set sharing a Name.

Supertype chain (IFC4 / IFC4.3) : IfcElementQuantity -> IfcQuantitySet -> IfcPropertySetDefinition -> IfcPropertyDefinition -> IfcRoot. Because IfcQuantitySet is an IfcPropertySetDefinition, an IfcElementQuantity is attached to elements through the exact same relationship as a property set.

Attachment : the shared IfcRelDefinesByProperties machinery

A quantity set is not a child of the element. It floats in the file and is linked by the objectified relationship IfcRelDefinesByProperties :

  • RelatedObjects : SET [1:?] OF IfcObjectDefinition : the element occurrences receiving the quantity set.
  • RelatingPropertyDefinition : IfcPropertySetDefinitionSelect : the IfcElementQuantity being assigned (it qualifies because it is an IfcPropertySetDefinition).

ALWAYS attach an IfcElementQuantity to an element occurrence with IfcRelDefinesByProperties. NEVER point that relationship at an IfcTypeObject : the NoRelatedTypeObject rule rejects it. A type carries quantity sets through the HasPropertySets aggregation populated by IfcRelDefinesByType. See ifc-syntax-property-sets for the full attachment machinery shared by both.

The quantity hierarchy

IfcPhysicalQuantity (abstract)        attributes : Name, Description
├── IfcPhysicalSimpleQuantity (abstract)   adds : Unit (OPTIONAL IfcNamedUnit)
│   ├── IfcQuantityLength    LengthValue : IfcLengthMeasure
│   ├── IfcQuantityArea      AreaValue   : IfcAreaMeasure
│   ├── IfcQuantityVolume    VolumeValue : IfcVolumeMeasure
│   ├── IfcQuantityCount     CountValue  : IfcCountMeasure
│   ├── IfcQuantityWeight    WeightValue : IfcMassMeasure
│   ├── IfcQuantityTime      TimeValue   : IfcTimeMeasure
│   └── IfcQuantityNumber    NumberValue : IfcNumericMeasure   (IFC4.3 only)
└── IfcPhysicalComplexQuantity   groups child quantities by a Discrimination

IfcPhysicalQuantity is abstract with two direct subtypes : IfcPhysicalSimpleQuantity and IfcPhysicalComplexQuantity. It carries Name (IfcLabel, required) and Description (OPTIONAL IfcText).

The seven simple quantity subtypes

IfcPhysicalSimpleQuantity is abstract and adds one attribute : Unit : OPTIONAL IfcNamedUnit. IFC4.3 has seven concrete subtypes ; IFC2x3 and IFC4 have six (IfcQuantityNumber is IFC4.3 only).

Subtype Value attribute Value type Unit type (WR21)
IfcQuantityLength LengthValue IfcLengthMeasure LENGTHUNIT
IfcQuantityArea AreaValue IfcAreaMeasure AREAUNIT
IfcQuantityVolume VolumeValue IfcVolumeMeasure VOLUMEUNIT
IfcQuantityWeight WeightValue IfcMassMeasure MASSUNIT
IfcQuantityTime TimeValue IfcTimeMeasure TIMEUNIT
IfcQuantityCount CountValue IfcCountMeasure none (no unit rule)
IfcQuantityNumber NumberValue IfcNumericMeasure none (IFC4.3 only)

Every subtype also has Formula : OPTIONAL IfcLabel (IFC4+). Each measured subtype (Length, Area, Volume, Weight, Time) carries two WHERE rules :

  • WR21 : if a Unit is present, its UnitType MUST match the quantity's kind. An area quantity with a length unit is schema-invalid.
  • WR22 : the value MUST be >= 0. A negative measured quantity is rejected.

IfcQuantityCount has one rule only : WR21 : CountValue >= 0. IfcQuantityNumber has no WHERE rules.

How a quantity gets its unit

IfcPhysicalSimpleQuantity.Unit is OPTIONAL IfcNamedUnit. If Unit is omitted, the project-level IfcUnitAssignment supplies the unit for that quantity's measure type. If Unit is given, it overrides the project unit for that one quantity, and it MUST be the matching unit type (the WR21 rule). Note Unit is an IfcNamedUnit, not a generic IfcUnit : a quantity's explicit unit cannot be an IfcDerivedUnit or IfcMonetaryUnit. See ifc-syntax-units.

IfcPhysicalComplexQuantity

Groups child quantities that share a discrimination (for example one group per material layer). Verified verbatim (IFC4.3) :

ENTITY IfcPhysicalComplexQuantity
 SUBTYPE OF (IfcPhysicalQuantity);
	HasQuantities : SET [1:?] OF IfcPhysicalQuantity;
	Discrimination : IfcLabel;
	Quality : OPTIONAL IfcLabel;
	Usage : OPTIONAL IfcLabel;
 WHERE
	NoSelfReference : SIZEOF(QUERY(temp <* HasQuantities | SELF :=: temp)) = 0;
	UniqueQuantityNames : IfcUniqueQuantityNames(HasQuantities);
END_ENTITY;

Discrimination (required) names what distinguishes the group, for example 'layer' or 'steel bar diameter'. NoSelfReference forbids the complex quantity containing itself.

The Qto_ naming convention

Standardised quantity sets are published by buildingSMART with a Qto_ prefix, parallel to the Pset_ prefix for property sets. The Name of the IfcElementQuantity carries that identifier. Verified example : Qto_WallBaseQuantities applies to IfcWall and defines Length, Width, Height (Q_LENGTH), GrossFootprintArea, NetFootprintArea, GrossSideArea, NetSideArea (Q_AREA), GrossVolume, NetVolume (Q_VOLUME), GrossWeight, NetWeight (Q_WEIGHT).

ALWAYS use the published Qto_ name when a standardised quantity set fits the element. NEVER give a custom, project-specific quantity set a Qto_-prefixed name : that prefix is reserved for the buildingSMART library.

Version differences (compact)

Item IFC2x3 IFC4 IFC4.3
IfcQuantitySet supertype absent (chain skips it) present present
Formula on quantity subtypes absent present present
IfcQuantityNumber absent absent present (IFC4.3.0.0)
Concrete simple subtypes 6 6 7
Standardised set naming implementer agreement Qto_ prefix Qto_ prefix

In IFC2x3 the supertype chain is IfcElementQuantity -> IfcPropertySetDefinition -> IfcPropertyDefinition -> IfcRoot : there is no IfcQuantitySet layer.

Decision Trees

Is this a property or a quantity?

What kind of data are you attaching?
|
+-- A measured magnitude derived from geometry or specification
|   (length, area, volume, count, weight, duration)
|   --> IfcElementQuantity. Pick a subtype from the table below.
|
+-- A descriptive or design attribute (fire rating, IsExternal,
    U-value, load-bearing flag, a name, a status)
    --> IfcPropertySet. See ifc-syntax-property-sets.

Which simple quantity subtype?

What does the value measure?
|
+-- A 1D length, width, height, perimeter   --> IfcQuantityLength
+-- A 2D area (footprint, side, surface)    --> IfcQuantityArea
+-- A 3D volume                             --> IfcQuantityVolume
+-- A mass / weight                         --> IfcQuantityWeight
+-- A duration                              --> IfcQuantityTime
+-- A whole-item count (integer of items)   --> IfcQuantityCount
+-- A dimensionless numeric, IFC4.3 only    --> IfcQuantityNumber
    (targeting IFC2x3 or IFC4? use IfcQuantityCount instead)

Occurrence or type attachment?

Is the quantity set the same for every occurrence of a type?
|
+-- It is per-occurrence (measured from this element's geometry)
|   --> attach the IfcElementQuantity to the OCCURRENCE with
|       IfcRelDefinesByProperties. This is the normal case.
|
+-- It is a type-level default shared by all occurrences
    --> add it to the IfcTypeObject.HasPropertySets aggregation.
        NEVER point IfcRelDefinesByProperties at a type :
        the NoRelatedTypeObject rule rejects it.

Patterns

Pattern : Attach an IfcElementQuantity to an element occurrence

ALWAYS create one IfcElementQuantity, fill its Quantities set with the individual IfcPhysicalSimpleQuantity instances, and link it to the element occurrence with an IfcRelDefinesByProperties whose RelatingPropertyDefinition is the IfcElementQuantity and whose RelatedObjects holds the element. ALWAYS give every quantity in one IfcElementQuantity a unique Name : the UniqueQuantityNames rule rejects a duplicate. NEVER attach the quantity set by pointing IfcRelDefinesByProperties at an IfcTypeObject : use the type's HasPropertySets aggregation instead.

See references/examples.md for a worked STEP scenario.

Pattern : Pick the matching simple quantity subtype and unit

ALWAYS pick the subtype whose value attribute matches the measured kind (IfcQuantityArea for an area, IfcQuantityVolume for a volume). ALWAYS leave Unit unset to inherit the project IfcUnitAssignment, or set it to an IfcNamedUnit of the matching unit type. An IfcQuantityArea with a length unit breaks the WR21 rule and the file is schema-invalid. NEVER write a negative value : the WR22 rule requires value >= 0 on every measured subtype, and WR21 on IfcQuantityCount requires CountValue >= 0.

Pattern : Choose between IfcQuantityCount and IfcQuantityNumber

ALWAYS use IfcQuantityCount for a whole-item count (the number of bars, panels, or fixtures). It exists in every version this skill covers. ALWAYS use IfcQuantityNumber ONLY when the target schema is IFC4.3 and the value is a dimensionless numeric that is not a whole-item count. NEVER emit IfcQuantityNumber into an IFC2x3 or IFC4 file : the entity does not exist before IFC4.3.0.0 and the file will fail schema validation.

Pattern : Group quantities with IfcPhysicalComplexQuantity

ALWAYS use IfcPhysicalComplexQuantity to group child quantities that share a discriminator, for example one length-plus-area-plus-volume group per material layer of a wall. Set Discrimination to the discriminator name ('layer'). ALWAYS give the child quantities unique names within the complex quantity : the UniqueQuantityNames rule applies to HasQuantities too. A complex quantity is itself an IfcPhysicalQuantity, so it can sit directly in an IfcElementQuantity.Quantities set alongside simple quantities.

Pattern : Name a standardised quantity set with Qto_

ALWAYS set the IfcElementQuantity.Name to the published Qto_ identifier when a standardised quantity set fits (Qto_WallBaseQuantities for IfcWall, Qto_SlabBaseQuantities for IfcSlab, and so on). NEVER reuse a Qto_ name for a custom set with different quantities : a custom set MUST use a project-specific name without the reserved Qto_ prefix.

Pattern : Honour the version differences

ALWAYS treat the supertype chain as version-dependent : in IFC4 and IFC4.3 IfcElementQuantity is an IfcQuantitySet ; in IFC2x3 it is a direct IfcPropertySetDefinition with no IfcQuantitySet layer. ALWAYS omit the Formula attribute when authoring IFC2x3 : it was added in IFC4. ALWAYS restrict IfcQuantityNumber to IFC4.3 output. For IFC2x3 standardised quantity sets there is no schema-level naming rule : the IFC2x3 spec states recognisable names are agreed in implementer agreements. The Qto_ prefix is an IFC4 formalisation.

Reference Links

  • references/methods.md : the complete verified entity definitions : IfcElementQuantity, IfcQuantitySet, IfcPhysicalQuantity, IfcPhysicalSimpleQuantity, all seven concrete subtypes with their WHERE rules, IfcPhysicalComplexQuantity, the attachment relationship, and the per-version difference matrix.
  • references/examples.md : worked STEP scenarios : a Qto_WallBaseQuantities set attached to a wall, each simple quantity subtype, a complex quantity grouped per layer, and an IFC2x3 versus IFC4 comparison.
  • references/anti-patterns.md : the failure modes this skill prevents, each with the reason it fails and the rule it breaks.

Official sources

Related skills

  • ifc-syntax-property-sets : the shared IfcPropertySetDefinition and IfcRelDefinesByProperties attachment machinery, and the property entities.
  • ifc-syntax-units : IfcUnitAssignment, IfcNamedUnit, and how a quantity value resolves to a concrete unit.
  • ifc-impl-property-extraction : reading quantities back out of a model for quantity take-off.