mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
See #2520. You can now duplicate drawings.
This commit is contained in:
@@ -37,6 +37,7 @@ class Usecase:
|
||||
* Voids are duplicated too
|
||||
* The copy will have the same material as the original. Parametric
|
||||
material set usages will be copied.
|
||||
* The copy will be part of the same groups as the original.
|
||||
|
||||
Be warned that:
|
||||
|
||||
|
||||
@@ -502,8 +502,7 @@ def get_decomposition(element):
|
||||
|
||||
|
||||
def get_grouped_by(element):
|
||||
"""
|
||||
Retrieves all subelements of an element based on the group.
|
||||
"""Retrieves all subelements of an element based on the group.
|
||||
|
||||
:param element: The IFC element
|
||||
:return: All subelements of the group
|
||||
@@ -513,7 +512,7 @@ def get_grouped_by(element):
|
||||
.. code:: python
|
||||
|
||||
element = file.by_type("IfcGroup")[0]
|
||||
subelements = ifcopenshell.util.element.get_group(element)
|
||||
subelements = ifcopenshell.util.element.get_grouped_by(element)
|
||||
"""
|
||||
queue = [element]
|
||||
results = []
|
||||
|
||||
@@ -198,3 +198,11 @@ class TestCopyClass(test.bootstrap.IFC4):
|
||||
assert element2.ConnectedFrom
|
||||
assert not new.ConnectedTo
|
||||
assert not new.ConnectedFrom
|
||||
|
||||
def test_maintaining_group_relationships(self):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
group = ifcopenshell.api.run("group.add_group", self.file)
|
||||
ifcopenshell.api.run("group.assign_group", self.file, group=group, products=[element])
|
||||
new = ifcopenshell.api.run("root.copy_class", self.file, product=element)
|
||||
assert len(self.file.by_type("IfcRelAssignsToGroup")) == 1
|
||||
assert new.HasAssignments[0].RelatingGroup == group
|
||||
|
||||
Reference in New Issue
Block a user