mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +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),
|
||||
},
|
||||
)
|
||||
Data.load(IfcStore.get_file(), element_id)
|
||||
Data.load(self.file, element_id)
|
||||
|
||||
has_modifier = False
|
||||
|
||||
for modifier in obj.modifiers:
|
||||
if modifier.type == "BOOLEAN" and modifier.object and modifier.object == opening:
|
||||
has_modifier = True
|
||||
break
|
||||
|
||||
if not has_modifier:
|
||||
try:
|
||||
modifier = next(m for m in obj.modifiers if m.type == "BOOLEAN" and m.object == opening)
|
||||
except StopIteration:
|
||||
modifier = obj.modifiers.new("IfcOpeningElement", "BOOLEAN")
|
||||
modifier.operation = "DIFFERENCE"
|
||||
modifier.object = opening
|
||||
finally:
|
||||
modifier.operation = "DIFFERENCE"
|
||||
modifier.solver = "EXACT"
|
||||
modifier.use_self = True
|
||||
modifier.operand_type = "OBJECT"
|
||||
|
||||
context.view_layer.objects.active = obj
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user