mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
api: assign_group now expects product to be a list
* minor change to assign_group * api: assign_group now expects product: list
This commit is contained in:
@@ -167,7 +167,7 @@ class AssignGroup(bpy.types.Operator):
|
||||
"group.assign_group",
|
||||
self.file,
|
||||
**{
|
||||
"product": self.file.by_id(product.BIMObjectProperties.ifc_definition_id),
|
||||
"product": [self.file.by_id(product.BIMObjectProperties.ifc_definition_id)],
|
||||
"group": self.file.by_id(self.group),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -662,7 +662,7 @@ class AddStructuralLoadGroup(bpy.types.Operator):
|
||||
def _execute(self, context):
|
||||
self.file = IfcStore.get_file()
|
||||
load_group = ifcopenshell.api.run("structural.add_structural_load_group", self.file)
|
||||
ifcopenshell.api.run("group.assign_group", self.file, product=load_group, group=self.file.by_id(self.load_case))
|
||||
ifcopenshell.api.run("group.assign_group", self.file, product=[load_group], group=self.file.by_id(self.load_case))
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ class TestAssign(NewFile):
|
||||
tool.Ifc.link(element, element_obj)
|
||||
group = ifcopenshell.api.run("group.add_group", tool.Ifc.get())
|
||||
group.ObjectType = "DRAWING"
|
||||
ifcopenshell.api.run("group.assign_group", tool.Ifc.get(), product=element, group=group)
|
||||
ifcopenshell.api.run("group.assign_group", tool.Ifc.get(), product=[element], group=group)
|
||||
subject.assign(element_obj)
|
||||
assert element_obj.users_collection[0].name == "IfcGroup/Unnamed"
|
||||
assert bpy.data.collections.get("Views").children.get("IfcGroup/Unnamed")
|
||||
@@ -235,7 +235,7 @@ class TestAssign(NewFile):
|
||||
tool.Ifc.link(element, element_obj)
|
||||
group = ifcopenshell.api.run("group.add_group", tool.Ifc.get())
|
||||
group.ObjectType = "DRAWING"
|
||||
ifcopenshell.api.run("group.assign_group", tool.Ifc.get(), product=element, group=group)
|
||||
ifcopenshell.api.run("group.assign_group", tool.Ifc.get(), product=[element], group=group)
|
||||
subject.assign(element_obj)
|
||||
assert element_obj.users_collection[0].name == "IfcGroup/Unnamed"
|
||||
assert bpy.data.collections.get("Views").children.get("IfcGroup/Unnamed")
|
||||
|
||||
@@ -260,7 +260,7 @@ class TestGetDrawingGroup(NewFile):
|
||||
tool.Ifc.set(ifc)
|
||||
element = ifc.createIfcAnnotation()
|
||||
group = ifcopenshell.api.run("group.add_group", ifc)
|
||||
ifcopenshell.api.run("group.assign_group", ifc, product=element, group=group)
|
||||
ifcopenshell.api.run("group.assign_group", ifc, product=[element], group=group)
|
||||
assert subject.get_drawing_group(element) == group
|
||||
|
||||
|
||||
@@ -280,7 +280,7 @@ class TestGetGroupElements(NewFile):
|
||||
tool.Ifc.set(ifc)
|
||||
element = ifc.createIfcAnnotation()
|
||||
group = ifcopenshell.api.run("group.add_group", ifc)
|
||||
ifcopenshell.api.run("group.assign_group", ifc, product=element, group=group)
|
||||
ifcopenshell.api.run("group.assign_group", ifc, product=[element], group=group)
|
||||
assert subject.get_group_elements(group) == (element,)
|
||||
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ class Usecase:
|
||||
)
|
||||
rel = self.settings["group"].IsGroupedBy[0]
|
||||
related_objects = set(rel.RelatedObjects) or set()
|
||||
related_objects.add(self.settings["product"])
|
||||
for obj in self.settings["product"]:
|
||||
related_objects.add(obj)
|
||||
rel.RelatedObjects = list(related_objects)
|
||||
ifcopenshell.api.run("owner.update_owner_history", self.file, **{"element": rel})
|
||||
|
||||
@@ -1111,7 +1111,7 @@ class TestIdsAuthoring(unittest.TestCase):
|
||||
group = ifcopenshell.api.run("group.add_group", ifc)
|
||||
facet = ids.partOf.create(entity="IfcGroup")
|
||||
run("", facet=facet, inst=element, expected=False)
|
||||
ifcopenshell.api.run("group.assign_group", ifc, product=element, group=group)
|
||||
ifcopenshell.api.run("group.assign_group", ifc, product=[element], group=group)
|
||||
run("", facet=facet, inst=element, expected=True)
|
||||
|
||||
# An IfcGroup can be passed by subtypes
|
||||
@@ -1119,7 +1119,7 @@ class TestIdsAuthoring(unittest.TestCase):
|
||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcElementAssembly")
|
||||
group = ifc.createIfcInventory()
|
||||
facet = ids.partOf.create(entity="IfcGroup")
|
||||
ifcopenshell.api.run("group.assign_group", ifc, product=element, group=group)
|
||||
ifcopenshell.api.run("group.assign_group", ifc, product=[element], group=group)
|
||||
run("", facet=facet, inst=element, expected=True)
|
||||
|
||||
# An IfcSystem only checks that a system is assigned without any other logic
|
||||
|
||||
@@ -1157,7 +1157,7 @@ class TestPartOf:
|
||||
group = ifcopenshell.api.run("group.add_group", ifc)
|
||||
facet = PartOf(entity="IfcGroup")
|
||||
run("", facet=facet, inst=element, expected=False)
|
||||
ifcopenshell.api.run("group.assign_group", ifc, product=element, group=group)
|
||||
ifcopenshell.api.run("group.assign_group", ifc, product=[element], group=group)
|
||||
run("", facet=facet, inst=element, expected=True)
|
||||
|
||||
# An IfcGroup can be passed by subtypes
|
||||
@@ -1165,7 +1165,7 @@ class TestPartOf:
|
||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcElementAssembly")
|
||||
group = ifc.createIfcInventory()
|
||||
facet = PartOf(entity="IfcGroup")
|
||||
ifcopenshell.api.run("group.assign_group", ifc, product=element, group=group)
|
||||
ifcopenshell.api.run("group.assign_group", ifc, product=[element], group=group)
|
||||
run("", facet=facet, inst=element, expected=True)
|
||||
|
||||
# An IfcSystem only checks that a system is assigned without any other logic
|
||||
|
||||
Reference in New Issue
Block a user