assembly: change fixed part move behavior

This commit is contained in:
Zheng, Lei 2017-12-25 13:00:05 +08:00
parent 9dfc07a7a0
commit d2f88b969d
2 changed files with 5 additions and 16 deletions

View File

@ -1542,19 +1542,11 @@ class AsmMovingPart(object):
obj = self.assembly.Object
pla = obj.ViewObject.DraggingPlacement
update = True
rollback = []
if self.fixedTransform:
fixed = self.fixedTransform
movement = self.draggerPlacement.inverse().multiply(pla)
if not fixed.Shape:
# The moving part has completely fixed placement, so we move the
# parent assembly instead
rollback.append((obj.Name,obj,obj.Placement.copy()))
pla = obj.Placement.multiply(movement)
setPlacement(obj,pla)
update = False
else:
if fixed.Shape:
# fixed position, so reset translation
movement.Base = FreeCAD.Vector()
if not utils.isVertex(fixed.Shape):
@ -1565,11 +1557,10 @@ class AsmMovingPart(object):
movement.Rotation = FreeCAD.Rotation(yaw,0,0)
pla = self.draggerPlacement.multiply(movement)
if update:
# obtain and update the part placement
pla = pla.multiply(self.offsetInv)
setPlacement(self.part,pla)
rollback.append((self.partName,self.part,self.oldPlacement.copy()))
# obtain and update the part placement
pla = pla.multiply(self.offsetInv)
setPlacement(self.part,pla)
rollback.append((self.partName,self.part,self.oldPlacement.copy()))
if not gui.AsmCmdManager.AutoRecompute or \
QtGui.QApplication.keyboardModifiers()==QtCore.Qt.ControlModifier:

View File

@ -53,8 +53,6 @@ class Solver(object):
# TODO: this is ugly, need a better way to expose dragging interface
addDragPoint = getattr(self.system,'addWhereDragged')
if addDragPoint:
if dragPart in self._fixedParts:
raise RuntimeError('cannot drag fixed part')
info = self._partMap.get(dragPart,None)
if info:
# add dragging point