Cross-sections

Cross-sections

A clip plane hides everything on one side of a plane so you can see into a model. A cross-section goes further: it computes the actual lines and faces where a plane cuts through the geometry, giving you a real 2D drawing — a floor plan or a building section — rather than just a sliced 3D view.

Twinfinity has two ways to produce one, depending on what you're after.

Slab sections (a horizontal plan cut)

A slab section cuts one floor horizontally, a short distance above the floor level (the usual ~1.2 m plan-section height), and returns the section lines split into cut, visible and hidden categories — exactly what a CAD floor plan distinguishes. Use this when you want a plan view of a single level.

Try it in the playground: Slab section

Plane sections (any plane)

A plane section cuts along an arbitrary plane — vertical for a building section/elevation, or any orientation you like — and can fill the exposed cut faces in each product's own colour, so the result reads like the model.

Try it in the playground: Plane section

The core is two calls: computePlaneSectionsForProducts does the geometry, and PlaneSectionVisual turns it into meshes in the scene.

import { Plane, Vector3 } from '@babylonjs/core'; import { computePlaneSectionsForProducts } from '@twinfinity/product-geometry'; import { PlaneSectionVisual } from '@twinfinity/scene-visuals'; // A vertical plane through the model, expressed for the geometry maths. const point = new Vector3(45, 0, 0); const normal = new Vector3(-1, 0, 0).normalize(); const d = -Vector3.Dot(normal, point); const geometryPlane = { normal: [normal.x, normal.y, normal.z], d }; // Cut every product that has geometry (skip the space volumes). const products = []; api.ifc.foreach((p) => { if (p.hasGeometry && !p.class.is('space')) products.push(p); }); const section = await computePlaneSectionsForProducts(products, geometryPlane); // Draw it: filled cut faces with black outlines on top. new PlaneSectionVisual(api.viewer.scene, section, { plane: new Plane(normal.x, normal.y, normal.z, d), fill: { enabled: true }, line: { enabled: true, width: 2 } });

Which one?

  • Reach for a slab section when you want a plan of one floor with proper cut/visible/hidden line work.

  • Reach for a plane section when you need an arbitrary cut (a vertical building section) or filled faces coloured like the model.

Once you have a section you can also export it as a print-ready drawing — see the playground's Export plan to SVG example.