mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
Minor fix
This commit is contained in:
@@ -41,7 +41,7 @@ class LoadGroups(bpy.types.Operator):
|
||||
context.scene.ExpandedGroups.json_string = "{}"
|
||||
|
||||
for ifc_definition_id, group in Data.groups.items():
|
||||
if not group["HasAssignments"]:
|
||||
if not group["HasAssignments"]:
|
||||
new = self.props.groups.add()
|
||||
new.ifc_definition_id = ifc_definition_id
|
||||
new.name = group["Name"]
|
||||
@@ -50,7 +50,7 @@ class LoadGroups(bpy.types.Operator):
|
||||
|
||||
if group["IsGroupedBy"]:
|
||||
# assumes 1:1 cardinality, will need to be updated to reflect IFC4 changes
|
||||
# where the cardinality is 0:? - vulevukusej
|
||||
# where the cardinality is 0:? - vulevukusej
|
||||
sub_groups = [g for g in group["IsGroupedBy"][0].RelatedObjects if g.is_a("IfcGroup")]
|
||||
new.has_children = True if len(sub_groups) != 0 else False
|
||||
|
||||
@@ -146,7 +146,7 @@ class AddGroupToGroup(bpy.types.Operator):
|
||||
self.file = IfcStore.get_file()
|
||||
result = ifcopenshell.api.run("group.add_group", self.file)
|
||||
ifcopenshell.api.run(
|
||||
"group.assign_group", IfcStore.get_file(), **{"product": [result], "group": self.file.by_id(self.group)}
|
||||
"group.assign_group", IfcStore.get_file(), products=[result], group=self.file.by_id(self.group)
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.load_groups(is_refresh=True)
|
||||
@@ -255,10 +255,8 @@ class AssignGroup(bpy.types.Operator):
|
||||
ifcopenshell.api.run(
|
||||
"group.assign_group",
|
||||
self.file,
|
||||
**{
|
||||
"product": [self.file.by_id(product.BIMObjectProperties.ifc_definition_id)],
|
||||
"group": self.file.by_id(self.group),
|
||||
}
|
||||
products=[self.file.by_id(product.BIMObjectProperties.ifc_definition_id)],
|
||||
group=self.file.by_id(self.group),
|
||||
)
|
||||
Data.load(self.file)
|
||||
return {"FINISHED"}
|
||||
@@ -332,7 +330,6 @@ class UpdateGroup(bpy.types.Operator):
|
||||
**{
|
||||
"group": group,
|
||||
"products": new_products,
|
||||
|
||||
}
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
|
||||
@@ -23,8 +23,10 @@ classes = (
|
||||
operator.AssignContainer,
|
||||
operator.ChangeSpatialLevel,
|
||||
operator.CopyToContainer,
|
||||
operator.DereferenceStructure,
|
||||
operator.DisableEditingContainer,
|
||||
operator.EnableEditingContainer,
|
||||
operator.ReferenceStructure,
|
||||
operator.RemoveContainer,
|
||||
operator.SelectContainer,
|
||||
operator.SelectSimilarContainer,
|
||||
|
||||
@@ -663,7 +663,7 @@ class AddStructuralLoadGroup(bpy.types.Operator):
|
||||
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)
|
||||
"group.assign_group", self.file, products=[load_group], group=self.file.by_id(self.load_case)
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
@@ -756,7 +756,7 @@ class AddStructuralActivity(bpy.types.Operator):
|
||||
structural_member=element,
|
||||
)
|
||||
ifcopenshell.api.run(
|
||||
"group.assign_group", self.file, product=[activity], group=self.file.by_id(self.load_group)
|
||||
"group.assign_group", self.file, products=[activity], group=self.file.by_id(self.load_group)
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.enable_editing_structural_load_group_activities(load_group=self.load_group)
|
||||
|
||||
@@ -148,7 +148,7 @@ def add_drawing(ifc, collector, drawing, target_view=None, location_hint=None):
|
||||
)
|
||||
group = ifc.run("group.add_group")
|
||||
ifc.run("group.edit_group", group=group, attributes={"Name": drawing_name, "ObjectType": "DRAWING"})
|
||||
ifc.run("group.assign_group", group=group, product=[element])
|
||||
ifc.run("group.assign_group", group=group, products=[element])
|
||||
collector.assign(camera)
|
||||
pset = ifc.run("pset.add_pset", product=element, name="EPset_Drawing")
|
||||
ifc.run(
|
||||
@@ -203,7 +203,7 @@ def add_annotation(ifc, collector, drawing_tool, drawing=None, object_type=None)
|
||||
context=context,
|
||||
ifc_representation_class=drawing_tool.get_ifc_representation_class(object_type),
|
||||
)
|
||||
ifc.run("group.assign_group", group=drawing_tool.get_drawing_group(drawing), product=[element])
|
||||
ifc.run("group.assign_group", group=drawing_tool.get_drawing_group(drawing), products=[element])
|
||||
collector.assign(obj)
|
||||
drawing_tool.enable_editing(obj)
|
||||
|
||||
@@ -251,7 +251,7 @@ def sync_references(ifc, collector, drawing_tool, drawing=None):
|
||||
annotation = drawing_tool.generate_reference_annotation(drawing, reference_element, context)
|
||||
if annotation:
|
||||
ifc.run("drawing.assign_product", relating_product=reference_element, related_object=annotation)
|
||||
ifc.run("group.assign_group", group=group, product=[annotation])
|
||||
ifc.run("group.assign_group", group=group, products=[annotation])
|
||||
collector.assign(ifc.get_object(annotation))
|
||||
|
||||
if reference_obj and ifc.is_moved(reference_obj):
|
||||
|
||||
@@ -223,7 +223,7 @@ class TestAddDrawing:
|
||||
ifc.run(
|
||||
"group.edit_group", group="group", attributes={"Name": "name", "ObjectType": "DRAWING"}
|
||||
).should_be_called()
|
||||
ifc.run("group.assign_group", group="group", product=["element"]).should_be_called()
|
||||
ifc.run("group.assign_group", group="group", products=["element"]).should_be_called()
|
||||
collector.assign("obj").should_be_called()
|
||||
ifc.run("pset.add_pset", product="element", name="EPset_Drawing").should_be_called().will_return("pset")
|
||||
ifc.run(
|
||||
@@ -293,7 +293,7 @@ class TestAddAnnotation:
|
||||
ifc_representation_class="ifc_representation_class",
|
||||
).should_be_called().will_return("element")
|
||||
drawing.get_drawing_group("drawing").should_be_called().will_return("group")
|
||||
ifc.run("group.assign_group", group="group", product=["element"]).should_be_called()
|
||||
ifc.run("group.assign_group", group="group", products=["element"]).should_be_called()
|
||||
collector.assign("obj").should_be_called()
|
||||
drawing.enable_editing("obj").should_be_called()
|
||||
subject.add_annotation(ifc, collector, drawing, drawing="drawing", object_type="object_type")
|
||||
|
||||
@@ -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(), products=[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(), products=[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, products=[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, products=[element], group=group)
|
||||
assert subject.get_group_elements(group) == (element,)
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class Usecase:
|
||||
def __init__(self, file, **settings):
|
||||
self.file = file
|
||||
self.settings = {
|
||||
"product": None,
|
||||
"products": None,
|
||||
"group": None,
|
||||
}
|
||||
for key, value in settings.items():
|
||||
@@ -37,13 +37,13 @@ class Usecase:
|
||||
**{
|
||||
"GlobalId": ifcopenshell.guid.new(),
|
||||
"OwnerHistory": ifcopenshell.api.run("owner.create_owner_history", self.file),
|
||||
"RelatedObjects": self.settings["product"],
|
||||
"RelatedObjects": self.settings["products"],
|
||||
"RelatingGroup": self.settings["group"],
|
||||
}
|
||||
)
|
||||
rel = self.settings["group"].IsGroupedBy[0]
|
||||
related_objects = set(rel.RelatedObjects) or set()
|
||||
for obj in self.settings["product"]:
|
||||
for obj in self.settings["products"]:
|
||||
related_objects.add(obj)
|
||||
rel.RelatedObjects = list(related_objects)
|
||||
ifcopenshell.api.run("owner.update_owner_history", self.file, **{"element": rel})
|
||||
|
||||
@@ -324,6 +324,7 @@ def get_referenced_structures(element):
|
||||
"""
|
||||
if hasattr(element, "ReferencedInStructures"):
|
||||
return [r.RelatingStructure for r in element.ReferencedInStructures]
|
||||
return []
|
||||
|
||||
|
||||
def get_decomposition(element):
|
||||
|
||||
Reference in New Issue
Block a user