Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #4386 from marioalexis84/draft-clone
Draft: Fixes #4113: When Clone is used in Draft/Scale, the cloned part placement is always set to origin whatever is the reference point
  • Loading branch information
yorikvanhavre committed Feb 8, 2021
2 parents 91435c9 + 7c8c589 commit 4e3a269
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Mod/Draft/draftguitools/gui_scale.py
Expand Up @@ -224,13 +224,26 @@ def scale_with_clone(self):
else:
_cmd_name = translate("draft", "Scale")

# the correction translation of the clone placement is
# (node[0] - clone.Placement.Base) - (node[0] - clone.Placement.Base)\
# .scale(delta.x,delta.y,delta.z)
# equivalent to:
# (node[0] - clone.Placement.Base)\
# .scale(1-delta.x,1-delta.y,1-delta.z)
str_node0 = DraftVecUtils.toString(self.node[0])
str_delta = DraftVecUtils.toString(self.delta)
str_delta_corr = DraftVecUtils.toString(App.Vector(1,1,1) - self.delta)

_cmd = 'Draft.clone'
_cmd += '('
_cmd += objects + ', '
_cmd += 'forcedraft=True'
_cmd += ')'
_cmd_list = ['clone = ' + _cmd,
'clone.Scale = ' + DraftVecUtils.toString(self.delta),
'clone.Scale = ' + str_delta,
'clone_corr = (' + str_node0 + ' - clone.Placement.Base)'\
+ '.scale(*'+ str_delta_corr + ')',
'clone.Placement.move(clone_corr)',
'FreeCAD.ActiveDocument.recompute()']
self.commit(_cmd_name, _cmd_list)

Expand Down

0 comments on commit 4e3a269

Please sign in to comment.