[FEM] Selection: fix error for 2D shapes

- 2D shapes have no "Shape" attribute. This attribute was accessed before checked it it exists
This commit is contained in:
Uwe
2022-08-12 06:19:48 +02:00
parent 5a179983a2
commit 877e77c09d
+5 -5
View File
@@ -484,12 +484,12 @@ class GeometryElementsSelection(QtGui.QWidget):
self.sel_server = FemSelectionObserver(self.selectionParser, print_message)
def selectionParser(self, selection):
FreeCAD.Console.PrintMessage("Selection: {} {} {}\n".format(
selection[0].Shape.ShapeType,
selection[0].Name,
selection[1]
))
if hasattr(selection[0], "Shape") and selection[1]:
FreeCAD.Console.PrintMessage("Selection: {} {} {}\n".format(
selection[0].Shape.ShapeType,
selection[0].Name,
selection[1]
))
sobj = selection[0]
elt = sobj.Shape.getElement(selection[1])
ele_ShapeType = elt.ShapeType