gui: fix assembly solve command

Fix selection detection, and undo/redo setup
This commit is contained in:
Zheng, Lei 2018-01-07 19:04:16 +08:00
parent 882faf9d53
commit fb9ad1609d
3 changed files with 6 additions and 4 deletions

View File

@ -1463,9 +1463,9 @@ class Assembly(AsmGroup):
objs.add(sel.Object)
continue
for subname in sel.SubElementNames:
ret = Assembly.find(sel.Object,subname,recursive=True)
ret = Assembly.find(sel.Object,subname,keepEmptyChild=True)
if ret:
objs.add(ret[-1].Assembly)
objs.add(ret.Assembly)
return tuple(objs)
@staticmethod

2
gui.py
View File

@ -138,8 +138,10 @@ class AsmCmdSolve(AsmCmdBase):
@classmethod
def Activated(cls):
from . import solver
FreeCAD.setActiveTransaction('Assembly solve')
logger.report('command "{}" exception'.format(cls.getName()),
solver.solve)
FreeCAD.closeActiveTransaction()
class AsmCmdMove(AsmCmdBase):

View File

@ -155,8 +155,8 @@ def _solve(objs=None,recursive=None,reportFailed=True,
raise RuntimeError('No assembly found in selection')
else:
objs = FreeCAD.ActiveDocument.Objects
if recursive is None:
recursive = True
if recursive is None:
recursive = True
elif not isinstance(objs,(list,tuple)):
objs = [objs]