Add tests for boundary

This commit is contained in:
Dion Moult
2025-05-27 10:38:29 +10:00
parent 32e4a06fe4
commit 72ef055946
4 changed files with 63 additions and 0 deletions
@@ -676,6 +676,14 @@ class AddBoundary(bpy.types.Operator, tool.Ifc.Operator):
+ tool.Ifc.get().by_type("IfcVirtualElement")
)
for building_element in building_elements:
if obj := tool.Ifc.get_object(building_element):
if tool.Ifc.is_moved(obj):
bonsai.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj)
if tool.Ifc.is_moved(space_obj):
bonsai.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=space_obj)
# Don't generate boundaries of building elements that we've already got bounaries for.
for boundary in space.BoundedBy:
if boundary.RelatedBuildingElement in building_elements:
+1
View File
@@ -3,6 +3,7 @@ markers =
aggregate
attribute
boolean
boundary
brick
bsdd
classification
@@ -0,0 +1,30 @@
@boundary
Feature: Boundary
Scenario: Add boundary from space
Given an empty IFC project
And I load the demo construction library
And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType"
And the variable "element_type" is "[e for e in {ifc}.by_type('IfcWallType') if e.Name == 'WAL100'][0].id()"
And I set "scene.BIMModelProperties.relating_type_id" to "{element_type}"
And I press "bim.add_occurrence"
And the cursor is at "1.1,0,0"
And I press "bim.add_occurrence"
And the object "IfcWall/Wall.001" is selected
And I press "bim.hotkey(hotkey='S_R')"
And the cursor is at "0,.9,0"
And I press "bim.add_occurrence"
And the cursor is at "-1,0,0"
And I press "bim.add_occurrence"
And the object "IfcWall/Wall.003" is selected
And I press "bim.hotkey(hotkey='S_R')"
And the object "IfcWall/Wall.003" is moved to "0,0,0"
And the cursor is at "0.5,0.5,0"
And I deselect all objects
And I press "bim.generate_space"
When I select the object "IfcSpace/Space"
And I press "bim.add_boundary"
Then the object "IfcRelSpaceBoundary/None" exists
And the object "IfcRelSpaceBoundary/None.001" exists
And the object "IfcRelSpaceBoundary/None.002" exists
And the object "IfcRelSpaceBoundary/None.003" exists
+24
View File
@@ -731,3 +731,27 @@ Scenario: Create a MEP bend between intersecting segments at the same location
And the object "IfcDuctSegment/Seg2" dimensions are "0.4,0.2,4.5"
And the object "IfcDuctFitting/DuctFitting" is at "0.0, 0.5, 1.0"
And the object "IfcDuctFitting/DuctFitting" dimensions are "0.7, 0.2, 0.7"
Scenario: Generate a space from cursor location
Given an empty IFC project
And I load the demo construction library
And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType"
And the variable "element_type" is "[e for e in {ifc}.by_type('IfcWallType') if e.Name == 'WAL100'][0].id()"
And I set "scene.BIMModelProperties.relating_type_id" to "{element_type}"
And I press "bim.add_occurrence"
And the cursor is at "1.1,0,0"
And I press "bim.add_occurrence"
And the object "IfcWall/Wall.001" is selected
And I press "bim.hotkey(hotkey='S_R')"
And the cursor is at "0,.9,0"
And I press "bim.add_occurrence"
And the cursor is at "-1,0,0"
And I press "bim.add_occurrence"
And the object "IfcWall/Wall.003" is selected
And I press "bim.hotkey(hotkey='S_R')"
And the object "IfcWall/Wall.003" is moved to "0,0,0"
When the cursor is at "0.5,0.5,0"
And I deselect all objects
And I press "bim.generate_space"
Then the object "IfcSpace/Space" exists
And the object "IfcSpace/Space" dimensions are "1,0.8,3"