Fix syntax error otherwise nothing loads

Also PortData is loaded in the authoring tool and there might not be any
active object (e.g. fresh session).
This commit is contained in:
Dion Moult
2025-03-13 11:06:56 +11:00
parent 4cff2f1fc1
commit 52fbe09dd4
2 changed files with 7 additions and 8 deletions
@@ -1154,10 +1154,11 @@ class DrawPolylineProfile(bpy.types.Operator, PolylineOperator, tool.Ifc.Operato
if element1.is_a("IfcFlowSegment") or element1.is_a("IfcFlowFitting"):
# lazy import to avoid circular import errors
from bonsai.bim.module.model.mep import MEPGenerator
MEPGenerator().setup_ports(profile1["obj"])
else:
for profile1, profile2 in zip(profiles[:-1], profiles[1:]):
DumbProfileJoiner().join_V(profile2["obj"], profile1["obj"])
else:
for profile1, profile2 in zip(profiles[:-1], profiles[1:]):
DumbProfileJoiner().join_V(profile2["obj"], profile1["obj"])
def modal(self, context, event):
return IfcStore.execute_ifc_operator(self, context, event, method="MODAL")
+3 -5
View File
@@ -130,11 +130,9 @@ class PortData:
@classmethod
def load(cls):
obj = bpy.context.active_object
assert obj
element = tool.Ifc.get_entity(obj)
assert element
cls.element = element
cls.element = None
if obj := bpy.context.active_object:
cls.element = tool.Ifc.get_entity(obj)
is_port = cls.is_port()
cls.data = {
"total_ports": cls.total_ports(),