Skip to content

Commit

Permalink
assembly: reduce auto recompute transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder committed Aug 15, 2018
1 parent c1be4f2 commit c6fa2c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -2310,6 +2310,7 @@ def claimChildren(self):

class Assembly(AsmGroup):
_Timer = QtCore.QTimer()
_TransID = 0
_PartMap = {} # maps part to assembly
_PartArrayMap = {} # maps array part to assembly
_ScheduleTimer = QtCore.QTimer()
Expand Down Expand Up @@ -2420,6 +2421,7 @@ def autoSolve(cls,obj,prop,force=False):
if not cls._Timer.isSingleShot():
cls._Timer.setSingleShot(True)
cls._Timer.timeout.connect(Assembly.onSolverTimer)
cls._TransID = FreeCAD.getActiveTransaction()
logger.debug('auto solve scheduled on change of {}.{}'.format(
objName(obj),prop),frame=1)
cls._Timer.start(300)
Expand All @@ -2434,12 +2436,17 @@ def onSolverTimer(cls):
if not cls.canAutoSolve():
return
from . import solver
FreeCAD.setActiveTransaction('Assembly auto recompute')
trans = cls._TransID and cls._TransID==FreeCAD.getActiveTransaction()
if not trans:
cls._TransID = 0
FreeCAD.setActiveTransaction('Assembly auto recompute')
if not logger.catch('solver exception when auto recompute',
solver.solve, FreeCAD.ActiveDocument.Objects, True):
FreeCAD.closeActiveTransaction(True)
if not trans:
FreeCAD.closeActiveTransaction(True)
else:
FreeCAD.closeActiveTransaction()
if not trans:
FreeCAD.closeActiveTransaction()

@classmethod
def scheduleDelete(cls,doc,names):
Expand Down
2 changes: 1 addition & 1 deletion slvs
Submodule slvs updated 2 files
+37 −21 CMakeLists.txt
+30 −26 src/CMakeLists.txt

0 comments on commit c6fa2c0

Please sign in to comment.