mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 12:43:43 +00:00
All element's spatial containment collections are now synced when assigning a class.
This commit is contained in:
@@ -39,3 +39,34 @@ def copy_class(ifc, collector, geometry, root, obj=None):
|
|||||||
collector.assign(obj)
|
collector.assign(obj)
|
||||||
if root.is_opening_element(element):
|
if root.is_opening_element(element):
|
||||||
root.add_dynamic_opening_voids(element, obj)
|
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
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ Scenario: Assign a class to a cube
|
|||||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||||
And I press "bim.assign_class"
|
And I press "bim.assign_class"
|
||||||
Then the object "IfcWall/Cube" is an "IfcWall"
|
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"
|
And the object "IfcWall/Cube" has a "Tessellation" representation of "Model/Body/MODEL_VIEW"
|
||||||
|
|
||||||
Scenario: Assign a type class to a cube
|
Scenario: Assign a type class to a cube
|
||||||
|
|||||||
Reference in New Issue
Block a user