mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +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
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
is_view_3d = context.space_data.type == "VIEW_3D"
|
if not (space := context.space_data) or space.type != "VIEW_3D":
|
||||||
walls = True
|
return False
|
||||||
for obj in context.selected_objects:
|
for obj in context.selected_objects:
|
||||||
if not tool.Ifc.get_entity(obj).is_a("IfcWall"):
|
if not (element := tool.Ifc.get_entity(obj)) or not element.is_a("IfcWall"):
|
||||||
walls = False
|
return False
|
||||||
|
return bool(context.selected_objects)
|
||||||
return bool(context.selected_objects) and is_view_3d and walls
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|||||||
Reference in New Issue
Block a user