mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 13:52:23 +00:00
(partially) Fix #1737 : Active object swaps to opening
Void operator would swap active object if opening IFC type is not set Also changed the modifier creation/update logic to accomodate for user potentially breaking things
This commit is contained in:
@@ -55,21 +55,20 @@ class AddOpening(bpy.types.Operator):
|
|||||||
"element": self.file.by_id(element_id),
|
"element": self.file.by_id(element_id),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
Data.load(IfcStore.get_file(), element_id)
|
Data.load(self.file, element_id)
|
||||||
|
|
||||||
has_modifier = False
|
try:
|
||||||
|
modifier = next(m for m in obj.modifiers if m.type == "BOOLEAN" and m.object == opening)
|
||||||
for modifier in obj.modifiers:
|
except StopIteration:
|
||||||
if modifier.type == "BOOLEAN" and modifier.object and modifier.object == opening:
|
|
||||||
has_modifier = True
|
|
||||||
break
|
|
||||||
|
|
||||||
if not has_modifier:
|
|
||||||
modifier = obj.modifiers.new("IfcOpeningElement", "BOOLEAN")
|
modifier = obj.modifiers.new("IfcOpeningElement", "BOOLEAN")
|
||||||
modifier.operation = "DIFFERENCE"
|
|
||||||
modifier.object = opening
|
modifier.object = opening
|
||||||
|
finally:
|
||||||
|
modifier.operation = "DIFFERENCE"
|
||||||
modifier.solver = "EXACT"
|
modifier.solver = "EXACT"
|
||||||
modifier.use_self = True
|
modifier.use_self = True
|
||||||
|
modifier.operand_type = "OBJECT"
|
||||||
|
|
||||||
|
context.view_layer.objects.active = obj
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user