IfcGrid - add placement by default to avoid invalid IFC

This commit is contained in:
Andrej730
2025-04-30 19:21:22 +05:00
parent 3bedbfb82c
commit 814c16d3ee
@@ -20,6 +20,7 @@ import bpy
import ifcopenshell.api import ifcopenshell.api
import ifcopenshell.api.grid import ifcopenshell.api.grid
import bonsai.tool as tool import bonsai.tool as tool
import bonsai.core.geometry
import bonsai.core.root import bonsai.core.root
from bpy.types import Operator from bpy.types import Operator
from bpy.props import FloatProperty, IntProperty from bpy.props import FloatProperty, IntProperty
@@ -38,6 +39,10 @@ def add_object(self: "BIM_OT_add_object", context: bpy.types.Context) -> None:
grid = tool.Ifc.get_entity(obj) grid = tool.Ifc.get_entity(obj)
assert grid assert grid
# Requirement in IFC4+.
if tool.Ifc.get_schema() != "IFC2X3":
bonsai.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj)
for i in range(0, self.total_u): for i in range(0, self.total_u):
verts = [ verts = [
Vector((-2, i * self.u_spacing, 0)), Vector((-2, i * self.u_spacing, 0)),