| name | sverchok-impl-ifcsverchok |
| description | Use when generating IFC files from Sverchok geometry using IfcSverchok nodes. Prevents the critical mistake of not understanding SvIfcStore transient file management (data is purged on every full tree update -- use use_bonsai_file to persist). Covers the 31 specialized nodes, two geometry conversion modes, the 6-step IFC generation workflow, and Bonsai integration. Keywords: IfcSverchok, SvIfcStore, IFC from Sverchok, geometry to IFC, Bonsai integration, transient file, use_bonsai_file, IFC generation, node-based BIM, parametric IFC, generate IFC from nodes.
|
| license | MIT |
| compatibility | Designed for Claude Code. Requires Blender 4.0+/5.x with Sverchok v1.4.0+, Bonsai addon, and IfcOpenShell 0.8.x. |
| metadata | {"author":"OpenAEC-Foundation","version":"1.0"} |
sverchok-impl-ifcsverchok
Quick Reference
What Is IfcSverchok
IfcSverchok is an extension that bridges Sverchok parametric geometry with the IFC (Industry Foundation Classes) open BIM standard. It enables creation of native IFC models using visual node-based programming in Blender.
- 31 specialized nodes (24 IFC + 7 Shape Builder) for BIM model creation
- Two geometry modes: Blender mesh objects or raw Sverchok geometry to IFC
- Transient IFC file: single shared
SvIfcStore.file managed across all nodes
- Bonsai integration: toggle to read/write Bonsai's active IFC file
- Status: Alpha (version 0.0.0) — expect stability issues
Dependency Chain
IfcSverchok
├── Bonsai (BlenderBIM) — must be enabled first
├── Sverchok v1.2+ — node tree framework
└── ifcopenshell 0.8.x — IFC file manipulation
All three dependencies must be installed and enabled. IfcSverchok registers its nodes only when all dependencies are available.
Critical Warnings
NEVER use Blender undo inside an IfcSverchok node tree — this causes crashes due to the transient SvIfcStore.file becoming out of sync with Blender's undo state.
NEVER assume multiple IFC files can coexist — SvIfcStore manages exactly ONE transient file shared by ALL nodes in ALL trees. Running "Re-run all nodes" calls purge() which resets the entire file.
NEVER mix use_bonsai_file=True with SvIfcWriteFile export — writing overwrites Bonsai's active file state. Use one mode or the other.
NEVER expect IfcSverchok's process() to follow standard Sverchok conventions — SvIfcCore applies zip_long_repeat TWICE (double-nested), which is different from regular Sverchok nodes that apply it once.
ALWAYS include a geometry-to-representation conversion node (SvIfcBMeshToIfcRepr or SvIfcSverchokToIfcRepr) before SvIfcCreateEntity — entities without representations produce empty IFC files.
ALWAYS let ensure_hirarchy() handle missing spatial structure on export rather than manually creating IfcProject/IfcSite/IfcBuilding — the write node auto-completes the hierarchy.
Decision Tree
Need to create IFC from Sverchok geometry?
├── From Blender mesh objects → SvIfcBMeshToIfcRepr node
├── From Sverchok vertices/faces → SvIfcSverchokToIfcRepr node
├── From IFC ShapeBuilder profiles → SvIfcSbRectangle → SvIfcSbExtrude → SvIfcSbRepresentation
└── From existing IFC file → SvIfcReadFile node
Need to build IFC hierarchy?
├── Quick setup → SvIfcQuickProjectSetup (creates project + site + building + storey)
├── Manual hierarchy → SvIfcAddSpatialElement for each level
└── Minimal → Just use SvIfcCreateEntity + SvIfcWriteFile (ensure_hirarchy fills gaps)
Need to query IFC data?
├── By STEP ID → SvIfcById node
├── By GlobalId → SvIfcByGuid node
├── By IFC class → SvIfcByType node
├── By selector query → SvIfcByQuery node
└── Read attributes → SvIfcReadEntity node
Need Bonsai integration?
├── Write to Bonsai's file → Toggle "Use Bonsai File" button, then run nodes
├── Read Bonsai's file → Toggle "Use Bonsai File", use query nodes
└── Export standalone → Keep use_bonsai_file=False (default), use SvIfcWriteFile
Essential Patterns
Pattern 1: SvIfcStore: Transient File Management
class SvIfcStore:
file: Union[ifcopenshell.file, None] = None
id_map: dict[str, Any] = {}
schema_identifiers = ["IFC4", "IFC2X3"]
use_bonsai_file = False
@staticmethod
def purge() -> None:
"""Reset all state. Called before each full node tree re-run."""
SvIfcStore.file = None
SvIfcStore.id_map = {}
@staticmethod
def get_file() -> ifcopenshell.file:
"""Return the current transient file.
Creates boilerplate IFC4 file if none exists.
Returns Bonsai's file when use_bonsai_file is True."""
if SvIfcStore.use_bonsai_file:
return tool.Ifc.get()
if SvIfcStore.file is None:
SvIfcStore.create_boilerplate()
return SvIfcStore.file
Key behaviors:
purge() runs at the start of every full tree re-evaluation
id_map tracks which node created which IFC entities (keyed by node_id)
get_file() lazily creates a boilerplate IFC4 file on first access
- Only ONE file exists at a time — no multi-file workflows
Pattern 2: SvIfcCore: Double-Nested Input Processing
from sverchok.data_structure import zip_long_repeat
class SvIfcCore:
sv_input_names: list[str]
def process(self) -> None:
sv_inputs_nested = []
for name in self.sv_input_names:
sv_inputs_nested.append(self.inputs[name].sv_get())
for sv_input_nested in zip_long_repeat(*sv_inputs_nested):
for sv_input in zip_long_repeat(*sv_input_nested):
sv_input = list(sv_input)
self.process_ifc(*sv_input)
Why double-nested: Sverchok data is [[obj1_data], [obj2_data]]. The first zip matches across inputs at the object level. The second zip iterates within each object, processing individual items. This allows a single SvIfcCreateEntity node to create multiple entities across multiple objects.
Pattern 3: Sverchok Geometry to IFC Representation
Pattern 4: Blender Mesh to IFC Representation
Pattern 5: 6-Step IFC Generation Workflow
Pattern 6: ShapeBuilder Workflow
Pattern 7: Automatic Hierarchy Completion (ensure_hirarchy)
Common Operations
Complete Node Catalog (31 Nodes)
IFC Nodes (24)
| Node Class | Label | Purpose |
|---|
SvIfcCreateFile | IFC Create File | Creates new empty IFC file with specified schema |
SvIfcReadFile | IFC Read File | Opens existing IFC file from disk |
SvIfcWriteFile | IFC Write File | Exports transient file to disk (calls ensure_hirarchy) |
SvIfcCreateEntity | IFC Create Entity | Creates IFC entities with geometry and placement |
SvIfcCreateShape | IFC Create Blender Shape | Converts IFC entities to Blender mesh objects |
SvIfcReadEntity | IFC Read Entity | Reads entity, exposes all attributes as outputs |
SvIfcPickIfcClass | IFC Class Picker | UI picker for IFC classes by product category |
SvIfcById | IFC By Id | Retrieves entities by STEP file ID |
SvIfcByGuid | IFC By Guid | Retrieves entities by GlobalId |
SvIfcByType | IFC By Type | Queries all entities of a given type |
SvIfcByQuery | IFC By Query | Queries using IfcOpenShell selector syntax |
SvIfcAdd | IFC Add | Adds an entity to the IFC file |
SvIfcAddPset | IFC Add Pset | Creates or edits property sets on elements |
SvIfcAddSpatialElement | IFC Add Spatial Element | Creates spatial elements, assigns contained elements |
SvIfcRemove | IFC Remove | Removes an entity from the IFC file |
SvIfcGenerateGuid | IFC Generate Guid | Generates IFC-compliant GUID |
SvIfcGetProperty | IFC Get Property | Retrieves property value from a property set |
|
IFC Shape Builder Nodes (7)
| Node Class | Label | Purpose |
|---|
SvIfcSbRectangle | IFC Rectangle | Creates IFC rectangle profile via ShapeBuilder |
SvIfcSbExtrude | IFC Extrude | Extrudes IFC profile along axis |
SvIfcSbRepresentation | IFC Representation | Wraps items into IfcShapeRepresentation |
SvIfcSbTest | IFC SB Test | Test/debug node |
SvSbShapeOutput | IFC Shape Output | Converts IFC shape to Sverchok geometry |
SvSbMesh | IFC Mesh | Creates IFC mesh from vertices and polygons |
SvSbPolyline | IFC Polyline | Creates IFC polyline from vertices |
SvIfcStore Static Methods
| Method | Signature | Purpose |
|---|
purge | () -> None | Resets file, id_map. Called before full re-run |
get_file | () -> ifcopenshell.file | Returns transient file (creates if needed) |
create_boilerplate | () -> None | Creates minimal IFC4 file with header data |
SvIfcStore Class Attributes
| Attribute | Type | Purpose |
|---|
file | ifcopenshell.file | None | The single transient IFC file |
id_map | dict[str, Any] | Maps node_id to created IFC entity data |
schema_identifiers | list[str] | Supported schemas: ["IFC4", "IFC2X3"] |
use_bonsai_file | bool | When True, get_file() returns Bonsai's file |
Geometry Mode Comparison
| Aspect | SvIfcBMeshToIfcRepr | SvIfcSverchokToIfcRepr |
|---|
| Input source | Blender mesh objects | Sverchok vertices/edges/faces |
| Loose parts | Auto-separated | N/A (already separate objects) |
| World matrix | Preserved as Locations output | Not applicable |
| Outputs | Representations + Locations | Representations only |
| Use when | Working with existing Blender geometry | Working with procedural Sverchok geometry |
Known Issues and Limitations
| Issue | Impact | Workaround |
|---|
| Blender crashes during undo | Data loss | Save frequently, avoid undo in IFC trees |
| Single transient file | No multi-file workflows | Process one IFC file at a time |
| No type/material library | Cannot manage IfcTypeProduct or IfcMaterial | Use ifcopenshell.api directly via SvIfcApi node |
| Limited geometry types | Only basic shapes via ShapeBuilder | Use SvIfcSverchokToIfcRepr for complex geometry |
| No infrastructure support | IfcBridge, IfcRoad unavailable | Not supported in current version |
| No MVD validation | No compliance checking | Validate externally after export |
| No quantity takeoff | No IfcElementQuantity nodes | Use ifcopenshell.api via SvIfcApi node |
Reference Links
Cross-References
Official Sources