mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 22:11:36 +00:00
Fix #4267 and add tests
Crash was caused by unmark_manual_booleans accessing boolean element after they were deleted from IFC
This commit is contained in:
@@ -21,6 +21,7 @@ import ifcopenshell
|
||||
import blenderbim.core.tool
|
||||
import blenderbim.tool as tool
|
||||
import numpy as np
|
||||
import json
|
||||
from test.bim.bootstrap import NewFile
|
||||
from blenderbim.tool.model import Model as subject
|
||||
from ifcopenshell.util.shape_builder import V
|
||||
@@ -108,6 +109,37 @@ class TestGetManualBooleans(NewFile):
|
||||
assert len(subject.get_manual_booleans(element)) == 2
|
||||
|
||||
|
||||
class TestMarkManualBooleans(NewFile):
|
||||
def test_run(self):
|
||||
ifc = ifcopenshell.file()
|
||||
tool.Ifc.set(ifc)
|
||||
|
||||
element = ifc.createIfcWall()
|
||||
boolean = ifc.createIfcBooleanClippingResult()
|
||||
subject.mark_manual_booleans(element, [boolean])
|
||||
pset = ifcopenshell.util.element.get_pset(element, "BBIM_Boolean")
|
||||
assert pset
|
||||
value = json.loads(pset["Data"])
|
||||
assert set(value) == {boolean.id()}
|
||||
|
||||
|
||||
class TestUnmarkManualBooleans(NewFile):
|
||||
def test_run(self):
|
||||
ifc = ifcopenshell.file()
|
||||
tool.Ifc.set(ifc)
|
||||
|
||||
element = ifc.createIfcWall()
|
||||
boolean = ifc.createIfcBooleanClippingResult()
|
||||
boolean2 = ifc.createIfcBooleanClippingResult()
|
||||
subject.mark_manual_booleans(element, [boolean, boolean2])
|
||||
subject.unmark_manual_booleans(element, [boolean.id()])
|
||||
|
||||
pset = ifcopenshell.util.element.get_pset(element, "BBIM_Boolean")
|
||||
assert pset
|
||||
value = json.loads(pset["Data"])
|
||||
assert set(value) == {boolean2.id()}
|
||||
|
||||
|
||||
class TestStairCalculatedParams(NewFile):
|
||||
def compare_data(self, pset_data, expected_calculated_data):
|
||||
calculated_data = subject.get_active_stair_calculated_params(pset_data)
|
||||
|
||||
Reference in New Issue
Block a user