Skip to content

Commit

Permalink
Draft: Fixes in gui_offset
Browse files Browse the repository at this point in the history
  • Loading branch information
marioalexis84 authored and yorikvanhavre committed Nov 9, 2020
1 parent 97828f0 commit ef2d4f2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Mod/Draft/draftguitools/gui_offset.py
Expand Up @@ -181,7 +181,7 @@ def action(self, arg):
self.point)
v2 = DraftGeomUtils.getTangent(self.shape.Edges[dist[1]],
self.point)
a = -DraftVecUtils.angle(v1, v2)
a = -DraftVecUtils.angle(v1, v2, plane.axis)
self.dvec = DraftVecUtils.rotate(d, a, plane.axis)
occmode = self.ui.occOffset.isChecked()
utils.param.SetBool("Offset_OCC", occmode)
Expand All @@ -196,7 +196,7 @@ def action(self, arg):
self.npts = []
for p in self.sel.Points:
currtan = DraftGeomUtils.getTangent(e, p)
a = -DraftVecUtils.angle(currtan, basetan)
a = -DraftVecUtils.angle(currtan, basetan, plane.axis)
self.dvec = DraftVecUtils.rotate(d, a, plane.axis)
self.npts.append(p.add(self.dvec))
self.ghost.update(self.npts)
Expand Down Expand Up @@ -294,13 +294,21 @@ def numericRadius(self, rad):
delta = str(rad)
else:
_err("Draft.Offset error: Unhandled case")
# to offset bspline
elif self.mode == "BSpline":
new_points = []
for old_point, new_point in zip(self.sel.Points, self.npts):
diff_direction = new_point.sub(old_point).normalize()
new_points.append(old_point.add(diff_direction*rad))
delta = DraftVecUtils.toString(new_points)
else:
self.dvec.normalize()
self.dvec.multiply(rad)
delta = DraftVecUtils.toString(self.dvec)
copymode = False
occmode = self.ui.occOffset.isChecked()
utils.param.SetBool("Offset_OCC", occmode)

if self.ui.isCopy.isChecked():
copymode = True
Gui.addModule("Draft")
Expand Down

0 comments on commit ef2d4f2

Please sign in to comment.