SuperAPI AI Directory

ifc-syntax-geometry-brep

Office & productivity

View repository

Updated 10-15 22:18

About this skill

IFC Syntax : Geometry Brep, CSG and Clipping

Boundary representation (Brep) describes a solid by explicitly listing the surfaces, edges and vertices that bound it, instead of by a parametric recipe such as an extrusion. Brep is the escape hatch of IFC geometry : imported meshes, free-form shapes, anything a tool cannot round-trip as a swept solid. This skill also owns CSG (Boolean combinations of solids) and clipping (the half-space subtract that cuts openings and sloped tops into extruded elements).

Applies to IFC2x3, IFC4, and IFC4.3. The faceted Brep, CSG and clipping families exist from IFC2x3 ; the advanced (curved-face) Brep family is IFC4 and later. See Version Differences.

Quick Reference

When to use Brep, CSG, or clipping

  • A faceted Brep (IfcFacetedBrep) : an explicit watertight mesh of planar polygons. Use it to carry imported or irregular geometry. RepresentationType = 'Brep'.
  • An advanced Brep (IfcAdvancedBrep, IFC4+) : a watertight solid whose faces may be curved (NURBS, cylinders, cones). Use it to round-trip true CAD free-form geometry. RepresentationType = 'AdvancedBrep'.
  • CSG (IfcBooleanResult, IfcCsgSolid) : a solid built by Boolean union, intersection and difference of simpler solids and primitives. RepresentationType = 'CSG'.
  • Clipping (IfcBooleanClippingResult) : the DIFFERENCE-with-a-half-space special case that cuts openings, recesses, chamfers and sloped tops into an extruded element. RepresentationType = 'Clipping'.

The Brep family tree

IfcGeometricRepresentationItem
└── IfcSolidModel
    └── IfcManifoldSolidBrep (abstract)   attribute : Outer : IfcClosedShell
        ├── IfcFacetedBrep                planar polygonal faces  (IFC2x3+)
        │   └── IfcFacetedBrepWithVoids   adds Voids : SET OF IfcClosedShell
        └── IfcAdvancedBrep               curved IfcAdvancedFace faces  (IFC4+)
            └── IfcAdvancedBrepWithVoids  adds Voids : SET OF IfcClosedShell

IfcManifoldSolidBrep defines exactly one attribute, Outer : IfcClosedShell : the watertight shell bounding the solid, with normals pointing away from the interior. Dim is derived and always 3.

IfcFacetedBrep : the workhorse

IfcFacetedBrep is a manifold solid Brep whose faces are all planar bounded polygons. It is the lowest-common-denominator Brep, present since IFC2x3. It adds no attributes : it inherits the single Outer : IfcClosedShell.

Two informal propositions are load-bearing :

  • Every bounding loop of every face MUST be an IfcPolyLoop. NEVER use IfcEdgeLoop or IfcVertexLoop in a faceted Brep.
  • Each IfcCartesianPoint MUST be referenced by at least three poly-loops : at a corner of a closed polyhedron at least three faces meet.

IfcAdvancedBrep : curved faces (IFC4+)

IfcAdvancedBrep is a manifold solid Brep whose faces are all IfcAdvancedFace. It permits curved (non-planar) faces backed by elementary, swept, or B-spline surfaces. It adds no own attributes ; it is defined by the WHERE rule HasAdvancedFaces : every face of the outer shell MUST be an IfcAdvancedFace. IfcAdvancedBrep, IfcAdvancedBrepWithVoids and IfcAdvancedFace were introduced in IFC4. NEVER emit them into an IFC2x3 file.

Breps with voids

IfcFacetedBrepWithVoids (IFC2x3+) and IfcAdvancedBrepWithVoids (IFC4+) add Voids : SET [1:?] OF IfcClosedShell : the inner shells bounding internal cavities. Each void shell is fully enclosed by Outer, disjoint from Outer and from every other void shell. A solid with no internal cavity uses the plain IfcFacetedBrep / IfcAdvancedBrep instead.

Shells : closed versus open

IfcConnectedFaceSet is the supertype of both shell types ; its attribute CfsFaces : SET [1:?] OF IfcFace is the set of faces.

  • IfcClosedShell : a complete, watertight, boundary-free 2-manifold that fully encloses a volume. Every edge is referenced by exactly two faces. This is the ONLY shell type permitted as the Outer and as a Voids member of a Brep.
  • IfcOpenShell : a 2-manifold with boundary (holes punched in it). Its boundary edges are referenced only once. It belongs in surface models, NEVER in an IfcManifoldSolidBrep.

Faces and loops

  • IfcFace : a portion of a surface. Attribute Bounds : SET [1:?] OF IfcFaceBound. WHERE rule HasOuterBound : at most one bound is an IfcFaceOuterBound (inside a faceted Brep, exactly one).
  • IfcFaceBound : attributes Bound : IfcLoop and Orientation : IfcBoolean. Its subtype IfcFaceOuterBound marks the outer (primary) boundary loop ; interior holes stay plain IfcFaceBound.
  • IfcAdvancedFace (IFC4+) : the only face type allowed in IfcAdvancedBrep. Adds FaceSurface : IfcSurface and SameSense : IfcBoolean.
  • IfcPolyLoop : attribute Polygon : LIST [3:?] OF UNIQUE IfcCartesianPoint. The only loop allowed in a faceted Brep. It is implicitly closed : the last segment runs from the last point back to the first. All points MUST be coplanar.
  • IfcEdgeLoop : a loop of oriented edges, used in advanced Brep faces.

The watertight rules

A valid Brep Outer shell is watertight : it bounds a real volume with no gaps.

  • ALWAYS reference every edge by exactly two faces in a closed shell. An edge on one face only is a hole ; an edge on three or more faces is non-manifold.
  • ALWAYS reference every IfcCartesianPoint by at least three poly-loops in a faceted Brep.
  • ALWAYS keep one shell to one loop type : all IfcPolyLoop in a faceted Brep, all IfcEdgeLoop in an advanced Brep. NEVER mix loop types in one shell.
  • ALWAYS wind a poly-loop so its face normal points away from the solid interior.

CSG : Boolean combinations

IfcBooleanResult is one Boolean operation. Attributes : Operator (IfcBooleanOperator), FirstOperand (IfcBooleanOperand), SecondOperand (IfcBooleanOperand), derived Dim. WHERE rule SameDim : both operands share dimensionality.

IfcBooleanOperator has three values : UNION, INTERSECTION, DIFFERENCE.

IfcBooleanOperand is a SELECT over five entities : IfcBooleanResult, IfcCsgPrimitive3D, IfcHalfSpaceSolid, IfcSolidModel, IfcTessellatedFaceSet.

IfcCsgSolid wraps a CSG tree as a solid : attribute TreeRootExpression : IfcCsgSelect. The IfcCsgPrimitive3D family supplies the primitive leaves : IfcBlock, IfcRectangularPyramid, IfcRightCircularCone, IfcRightCircularCylinder, IfcSphere, each parameterised relative to a Position : IfcAxis2Placement3D.

Clipping : IfcBooleanClippingResult and half-spaces

IfcBooleanClippingResult is the constrained subtype of IfcBooleanResult used for openings and cuts. It adds no attributes ; it adds three tightening WHERE rules, verified verbatim (IFC4.3) :

  • OperatorType : Operator = DIFFERENCE. A clipping result is NEVER a union or intersection.
  • FirstOperandType : FirstOperand is an IfcSweptAreaSolid, an IfcSweptDiskSolid, or an IfcBooleanClippingResult (the last for chained, sequential clipping).
  • SecondOperandType : SecondOperand MUST be an IfcHalfSpaceSolid. The clip is always a half-space, NEVER a finite solid.

IfcHalfSpaceSolid is geometrically infinite : the half of all space on one side of an unbounded BaseSurface (in practice an IfcPlane). AgreementFlag (IfcBoolean) selects which side. Subtypes :

  • IfcPolygonalBoundedHalfSpace : bounds the half-space to a finite prism via PolygonalBoundary. Used for localised openings. WHERE rules : BoundaryDim (the boundary is 2D) and BoundaryType (the boundary is an IfcPolyline, IfcCompositeCurve, or IfcIndexedPolyCurve).
  • IfcBoxedHalfSpace : attaches an Enclosure : IfcBoundingBox as a computation aid only. WHERE rule UnboundedSurface : the BaseSurface is NEVER a bounded surface.

RepresentationType mapping

Geometry item RepresentationType
IfcFacetedBrep, IfcFacetedBrepWithVoids 'Brep'
IfcAdvancedBrep, IfcAdvancedBrepWithVoids 'AdvancedBrep' (IFC4+)
IfcBooleanResult, IfcCsgSolid, IfcCsgPrimitive3D 'CSG'
IfcBooleanClippingResult 'Clipping'

The RepresentationIdentifier is normally 'Body'. See ifc-syntax-geometry-representations.

Version differences (compact)

Item IFC2x3 IFC4 IFC4.3
Faceted Brep family, shells, IfcPolyLoop present present present
CSG and clipping family, half-spaces present present present
IfcAdvancedBrep / IfcAdvancedBrepWithVoids / IfcAdvancedFace absent present present
RepresentationType = 'AdvancedBrep' absent present present

Decision Trees

Brep, CSG, clipping, or a swept solid?

How is the solid most naturally described?
|
+-- A parametric extrusion or revolution of a profile
|   --> a swept solid. See ifc-syntax-geometry-swept-solid (not this skill).
|
+-- An extruded element with openings, recesses, or a sloped cut
|   --> IfcBooleanClippingResult : DIFFERENCE of the swept solid and a
|       half-space. RepresentationType = 'Clipping'.
|
+-- A solid assembled from union / intersection / difference of solids
|   --> IfcBooleanResult or IfcCsgSolid. RepresentationType = 'CSG'.
|
+-- An explicit mesh of flat polygons (imported or irregular geometry)
|   --> IfcFacetedBrep. RepresentationType = 'Brep'.
|
+-- A watertight solid with curved (NURBS) faces, IFC4 or later
    --> IfcAdvancedBrep. RepresentationType = 'AdvancedBrep'.

Faceted or advanced Brep?

Are all faces planar polygons?
|
+-- YES --> IfcFacetedBrep. Faces bounded by IfcPolyLoop. Works in IFC2x3.
|
+-- NO, some faces are curved (cylinder, cone, sphere, NURBS)
    --> IfcAdvancedBrep with IfcAdvancedFace. Requires IFC4 or later.
        Targeting IFC2x3? Tessellate the curved faces into planar facets
        and use IfcFacetedBrep instead.

Plain, polygonal-bounded, or boxed half-space?

What does the clip need to remove?
|
+-- A full planar slice through the whole element (sloped top, chamfer)
|   --> IfcHalfSpaceSolid with an IfcPlane BaseSurface.
|
+-- A localised pocket bounded by a polygon (a window or door opening)
|   --> IfcPolygonalBoundedHalfSpace with a 2D PolygonalBoundary.
|
+-- A half-space that also needs a finite working box for fast evaluation
    --> IfcBoxedHalfSpace with an Enclosure bounding box.

Patterns

Pattern : Build a watertight faceted Brep

ALWAYS build a faceted Brep bottom-up : IfcCartesianPoint corners, IfcPolyLoop per face (each corner listed once, never repeating the first point), one IfcFaceOuterBound per loop, one IfcFace per bound, one IfcClosedShell collecting all faces, one IfcFacetedBrep whose Outer is that shell. ALWAYS verify every edge is shared by exactly two faces and every point by at least three loops before treating the solid as valid. NEVER use an IfcOpenShell as the Outer : Outer is typed IfcClosedShell and an open shell does not enclose a volume. See references/examples.md for the full worked unit-cube STEP file.

Pattern : Model an internal cavity

ALWAYS model an internal hollow with IfcFacetedBrepWithVoids (or IfcAdvancedBrepWithVoids in IFC4+) : one IfcClosedShell per cavity in the Voids set, each cavity shell fully enclosed by Outer and disjoint from every other shell. NEVER represent an internal cavity by reversing face normals inside a plain IfcFacetedBrep : the voids mechanism is the only correct way.

Pattern : Build an advanced Brep (IFC4+)

ALWAYS make every face of an IfcAdvancedBrep an IfcAdvancedFace : the HasAdvancedFaces rule rejects any other face type. Each IfcAdvancedFace carries a FaceSurface (an elementary, swept, or B-spline surface) and a SameSense flag, with edge boundaries fully defined as edge curves. NEVER target IFC2x3 with an advanced Brep : tessellate curved faces into planar facets and use IfcFacetedBrep.

Pattern : Clip an extruded element with a half-space

ALWAYS model an opening or sloped cut as an IfcBooleanClippingResult with Operator = DIFFERENCE, FirstOperand the extruded IfcSweptAreaSolid, and SecondOperand an IfcHalfSpaceSolid (or IfcPolygonalBoundedHalfSpace for a localised pocket). ALWAYS set the half-space AgreementFlag so the solid removed is the unwanted side : the wrong flag clips the opposite half and leaves the element inside out. NEVER set Operator to UNION or INTERSECTION on an IfcBooleanClippingResult : the OperatorType rule fixes it to DIFFERENCE. NEVER use a finite solid as the SecondOperand : the SecondOperandType rule requires an IfcHalfSpaceSolid.

Pattern : Chain multiple clips

ALWAYS apply a second clip by nesting : the second IfcBooleanClippingResult takes the first IfcBooleanClippingResult as its FirstOperand. The FirstOperandType rule permits exactly this for sequential clipping.

Pattern : Build a CSG solid from primitives

ALWAYS combine IfcCsgPrimitive3D primitives (IfcBlock, IfcSphere, IfcRightCircularCylinder, IfcRightCircularCone, IfcRectangularPyramid) and other solids with IfcBooleanResult, using UNION, INTERSECTION, or DIFFERENCE. Wrap the tree in an IfcCsgSolid when it must be reused as a solid operand. ALWAYS keep both operands of an IfcBooleanResult at the same dimensionality : the SameDim rule requires it.

Pattern : Match RepresentationType to the geometry item

ALWAYS set the IfcShapeRepresentation.RepresentationType to the value that matches the item : 'Brep' for a faceted Brep, 'AdvancedBrep' for an advanced Brep, 'CSG' for a general Boolean result or CSG solid, 'Clipping' for an IfcBooleanClippingResult. A mismatched label misroutes the importer's geometry kernel.

Reference Links

  • references/methods.md : the complete verified entity definitions, the IfcCsgPrimitive3D primitive table, the watertight / three-loops rule set, all WHERE rules, and the per-version difference matrix.
  • references/examples.md : worked STEP scenarios : a unit-cube faceted Brep, a Brep with an internal void, a clipped extrusion, and a CSG tree.
  • references/anti-patterns.md : the failure modes this skill prevents, each with the rule it breaks and the correct form.

Official sources

Related skills

  • ifc-syntax-geometry-representations : how a Brep / CSG / clipping item is carried inside an IfcShapeRepresentation and RepresentationType.
  • ifc-syntax-geometry-swept-solid : IfcExtrudedAreaSolid and the swept solids that serve as the FirstOperand of a clipping result.
  • ifc-errors-geometry-issues : diagnosing broken or non-watertight geometry.