mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
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:
@@ -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__()
|
||||
|
||||
Reference in New Issue
Block a user