From 284b14c2f0f7b3758826cce85b264ab3553d7410 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Wed, 26 May 2021 08:59:45 +0800 Subject: [PATCH] Part: add more info to preselection tool tip --- src/Mod/Part/BasicShapes/Shapes.py | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/Mod/Part/BasicShapes/Shapes.py b/src/Mod/Part/BasicShapes/Shapes.py index b87f3a78dc44..829bafb846f1 100644 --- a/src/Mod/Part/BasicShapes/Shapes.py +++ b/src/Mod/Part/BasicShapes/Shapes.py @@ -95,19 +95,35 @@ def showPreselectInfo(): sel = FreeCADGui.Selection.getPreselection() if not sel.Object or len(sel.SubElementNames) != 1: return - shape = Part.getShape(sel.Object, sel.SubElementNames[0], needSubElement=True) + shape, _, obj = Part.getShape(sel.Object, sel.SubElementNames[0], retType=1) if shape.isNull(): return - point = sel.PickedPoints[0] txt = FreeCADGui.Selection.getPreselectionText() if txt: txt += '\n\n' - txt += 'Shape type: %s' % shape.ShapeType + point = sel.PickedPoints[0] + txt += 'Picked point: %s' % _vec_tostr(point) + try: + path, mappedName, elementName = Part.splitSubname(sel.SubElementNames[0]) + txt += '\nObject: %s' % obj.Label + if obj.Document != sel.Object.Document or obj.Name != obj.Label: + txt += ' (%s)' % obj.FullName + txt += '\nPath: %s.%s' % (sel.Object.Name, path) + if elementName: + txt += '\nElement name: %s' % elementName + if not mappedName: + mappedName = shape.getElementMappedName(elementName) + if mappedName: + txt += '\nMapped name: %s' % mappedName + shape = Part.getShape(obj, elementName, needSubElement=True) + except Exception: + shape = Part.getShape(sel.Object, sel.SubElementNames[0], needSubElement=True) - txt += '\n%s' % shape.Placement + if shape.isNull(): + return + txt += '\n%s' % shape.Placement if shape.ShapeType == 'Vertex': - txt += '\nPosition: %s' % _vec_tostr(shape.Point) FreeCADGui.Selection.setPreselectionText(txt) return @@ -169,7 +185,8 @@ def showPreselectInfo(): 'Center', 'Axis', 'Continuity', - ('Planar', 'isPlanar'))) + ('Planar', 'isPlanar'), + ('Linear', 'isLinear'))) FreeCADGui.Selection.setPreselectionText(txt) def _getGeoAttributes(txt, geo, attrs):