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 obj = self.assembly.Object
pla = obj.ViewObject.DraggingPlacement pla = obj.ViewObject.DraggingPlacement
update = True
rollback = [] rollback = []
if self.fixedTransform: if self.fixedTransform:
fixed = self.fixedTransform fixed = self.fixedTransform
movement = self.draggerPlacement.inverse().multiply(pla) movement = self.draggerPlacement.inverse().multiply(pla)
if not fixed.Shape: if 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:
# fixed position, so reset translation # fixed position, so reset translation
movement.Base = FreeCAD.Vector() movement.Base = FreeCAD.Vector()
if not utils.isVertex(fixed.Shape): if not utils.isVertex(fixed.Shape):
@ -1565,7 +1557,6 @@ class AsmMovingPart(object):
movement.Rotation = FreeCAD.Rotation(yaw,0,0) movement.Rotation = FreeCAD.Rotation(yaw,0,0)
pla = self.draggerPlacement.multiply(movement) pla = self.draggerPlacement.multiply(movement)
if update:
# obtain and update the part placement # obtain and update the part placement
pla = pla.multiply(self.offsetInv) pla = pla.multiply(self.offsetInv)
setPlacement(self.part,pla) setPlacement(self.part,pla)

View File

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