bim.extend_walls_to_polyline_point - fix poll errors selecting non-ifc objects

E.g.
```
  File "\bonsai\bim\module\model\wall.py", line 142, in poll
    if not tool.Ifc.get_entity(obj).is_a("IfcWall"):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'is_a'
```
This commit is contained in:
Andrej730
2025-06-20 18:18:40 +05:00
parent 22fdb324ac
commit 67ae9fced0
+5 -6
View File
@@ -136,13 +136,12 @@ class ExtendWallsToPolylinePoint(bpy.types.Operator, PolylineOperator, tool.Ifc.
@classmethod
def poll(cls, context):
is_view_3d = context.space_data.type == "VIEW_3D"
walls = True
if not (space := context.space_data) or space.type != "VIEW_3D":
return False
for obj in context.selected_objects:
if not tool.Ifc.get_entity(obj).is_a("IfcWall"):
walls = False
return bool(context.selected_objects) and is_view_3d and walls
if not (element := tool.Ifc.get_entity(obj)) or not element.is_a("IfcWall"):
return False
return bool(context.selected_objects)
def __init__(self):
super().__init__()