bonsai-syntax-geometry
Installation
SKILL.md
Bonsai Geometry Syntax
Version: Bonsai v0.8.x | IfcOpenShell v0.8+ | Blender 4.2.0+ | Python 3.11 Module path:
bonsai.bim.module.geometry— NEVERblenderbim.*Dependencies: bonsai-core-architecture, ifcos-syntax-api
Critical Warnings
- ALWAYS create a Body context before adding geometry. Call
ifcopenshell.util.representation.get_context(model, "Model", "Body", "MODEL_VIEW")and create the context if it returnsNone. - ALWAYS use
ifcopenshell.api.run("geometry.assign_representation", ...)to connect a representation to an element. NEVER setproduct.Representationdirectly. - ALWAYS call
bpy.ops.bim.edit_object_placement()(orifcopenshell.api.run("geometry.edit_object_placement", ...)) after moving a Blender object. Changingobj.locationorobj.matrix_worlddoes NOT updateIfcLocalPlacement. - ALWAYS call
geometry.unassign_representationbeforegeometry.remove_representation. Removing an assigned representation leaves dangling references. - NEVER create
IfcExtrudedAreaSolidviamodel.create_entity(). Usegeometry.add_wall_representation(),geometry.add_profile_representation(), orShapeBuilder.extrude()— they handle units, context assignment, andRepresentationTypeautomatically. - NEVER pass a single element to
verticesinadd_mesh_representation(). The parameter expects[[item1_verts], [item2_verts]]— a list of lists, parallel tofaces. - ALWAYS use
feature.add_feature()for openings in Bonsai v0.8.0+. The oldervoid.add_opening()still works in standalone IfcOpenShell but is superseded in Bonsai. - NEVER assume
RepresentationTypeis set automatically bymodel.create_entity("IfcShapeRepresentation", ...). Use API functions orShapeBuilder.get_representation()which auto-detect the correct type.