mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 01:30:01 +00:00
WIP assigning a class also assigns the spatial container if possible. See #1222.
This commit is contained in:
@@ -15,7 +15,7 @@ class Usecase:
|
||||
contained_in_structure = self.settings["product"].ContainedInStructure
|
||||
contains_elements = self.settings["relating_structure"].ContainsElements
|
||||
|
||||
if contained_in_structure == contains_elements:
|
||||
if contains_elements and contained_in_structure == contains_elements:
|
||||
return
|
||||
|
||||
if contained_in_structure:
|
||||
|
||||
@@ -10,9 +10,8 @@ class Data:
|
||||
if not file:
|
||||
return
|
||||
product = file.by_id(product_id)
|
||||
element = product.ContainedInStructure[0].RelatingStructure if product.ContainedInStructure else None
|
||||
cls.products[product_id] = {
|
||||
"type": element.is_a() if element else None,
|
||||
"Name": element.Name if element else None,
|
||||
"id": int(element.id()) if element else None
|
||||
}
|
||||
if product.ContainedInStructure:
|
||||
structure = product.ContainedInStructure[0].RelatingStructure
|
||||
cls.products[product_id] = {"type": structure.is_a(), "Name": structure.Name, "id": int(structure.id())}
|
||||
else:
|
||||
cls.products[product_id] = {"type": None, "Name": None, "id": None}
|
||||
|
||||
@@ -18,6 +18,7 @@ class AssignContainer(bpy.types.Operator):
|
||||
relating_structure = self.file.by_id(
|
||||
bpy.data.objects.get(collection.name).BIMObjectProperties.ifc_definition_id
|
||||
)
|
||||
break
|
||||
if not relating_structure:
|
||||
return {"FINISHED"}
|
||||
usecase = assign_container.Usecase(
|
||||
|
||||
Reference in New Issue
Block a user