mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-10 06:00:51 +00:00
Objects now sync spatial hierarchy more robustly on export, and clean the collection tree in case the user messed it up.
This commit is contained in:
@@ -214,3 +214,25 @@ class TestAssign(NewFile):
|
||||
subject.assign(axis_obj)
|
||||
assert axis_obj.users_collection[0].name == "UAxes"
|
||||
assert bpy.data.collections.get("IfcGrid/Name").children.get("UAxes")
|
||||
|
||||
|
||||
class TestSync(NewFile):
|
||||
def test_in_decomposition_mode_elements_can_be_in_spatial_containers(self):
|
||||
bpy.ops.bim.create_project()
|
||||
wall_obj = bpy.data.objects.new("Object", None)
|
||||
wall_element = tool.Ifc.get().createIfcWall()
|
||||
tool.Ifc.link(wall_element, wall_obj)
|
||||
bpy.data.collections.get("IfcSite/My Site").objects.link(wall_obj)
|
||||
subject.sync(wall_obj)
|
||||
assert ifcopenshell.util.element.get_container(wall_element).is_a("IfcSite")
|
||||
|
||||
def test_in_decomposition_mode_elements_can_aggregate(self):
|
||||
bpy.ops.bim.create_project()
|
||||
obj = bpy.data.objects.new("IfcBuildingStorey/Name", None)
|
||||
col = bpy.data.collections.new("IfcBuildingStorey/Name")
|
||||
element = tool.Ifc.get().createIfcBuildingStorey(Name="Name")
|
||||
tool.Ifc.link(element, obj)
|
||||
bpy.data.collections.get("IfcBuilding/My Building").children.link(col)
|
||||
col.objects.link(obj)
|
||||
subject.sync(obj)
|
||||
assert ifcopenshell.util.element.get_aggregate(element).is_a("IfcBuilding")
|
||||
|
||||
Reference in New Issue
Block a user