All element's spatial containment collections are now synced when assigning a class.

This commit is contained in:
Dion Moult
2022-01-30 15:03:41 +11:00
parent e9670a6906
commit 538024e035
2 changed files with 32 additions and 1 deletions
+31
View File
@@ -39,3 +39,34 @@ def copy_class(ifc, collector, geometry, root, obj=None):
collector.assign(obj)
if root.is_opening_element(element):
root.add_dynamic_opening_voids(element, obj)
def assign_class(
ifc,
collector,
root,
obj=None,
ifc_class=None,
predefined_type=None,
should_add_representation=True,
context=None,
ifc_representation_class=None,
):
if ifc.get_entity(obj):
return
name = root.get_object_name(obj)
element = ifc.run("root.create_entity", ifc_class=ifc_class, predefined_type=predefined_type, name=name)
root.set_object_name(obj, element)
ifc.link(element, obj)
if should_add_representation:
root.run_geometry_add_representation(
obj=obj, context=context, ifc_representation_class=ifc_representation_class, profile_set_usage=None
)
root.set_element_specific_display_settings(obj, element)
collector.sync(obj)
collector.assign(obj)
return element
+1 -1
View File
@@ -43,7 +43,7 @@ Scenario: Assign a class to a cube
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
Then the object "IfcWall/Cube" is an "IfcWall"
And the object "IfcWall/Cube" is in the collection "Collection"
And the object "IfcWall/Cube" is in the collection "IfcProject/My Project"
And the object "IfcWall/Cube" has a "Tessellation" representation of "Model/Body/MODEL_VIEW"
Scenario: Assign a type class to a cube