Skip to content

Commit

Permalink
undo removal of function caused by PR494
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Feb 4, 2017
1 parent 899e57f commit 09ef1e9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Mod/Path/PathCommands.py
Expand Up @@ -78,3 +78,27 @@ def Activated(self):

if FreeCAD.GuiUp:
FreeCADGui.addCommand('Path_SelectLoop',_CommandSelectLoop())

def findShape(shape,subname=None,subtype=None):
'''To find a higher oder shape containing the subshape with subname.
E.g. to find the wire containing 'Edge1' in shape,
findShape(shape,'Edge1','Wires')
'''
if not subname:
return shape
ret = shape.getElement(subname)
if not subtype or not ret or ret.isNull():
return ret;
if subname.startswith('Face'):
tp = 'Faces'
elif subname.startswith('Edge'):
tp = 'Edges'
elif subname.startswith('Vertex'):
tp = 'Vertex'
else:
return ret
for obj in getattr(shape,subtype):
for sobj in getattr(obj,tp):
if sobj.isEqual(ret):
return obj
return ret

0 comments on commit 09ef1e9

Please sign in to comment.