Skip to content

Commit

Permalink
Set working plane immediately upon clicking the set working plane but…
Browse files Browse the repository at this point in the history
…ton if you have a face selected
  • Loading branch information
Moult authored and yorikvanhavre committed May 20, 2019
1 parent d05feb2 commit 2f14667
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/Mod/Draft/DraftTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,16 +311,16 @@ def GetResources(self):
def Activated(self):
DraftTool.Activated(self)
self.offset = 0
if self.doc:

self.ui.selectPlaneUi()
FreeCAD.Console.PrintMessage(translate("draft", "Pick a face to define the drawing plane")+"\n")
if plane.alignToSelection(self.offset):
FreeCADGui.Selection.clearSelection()
self.display(plane.axis)
self.finish()
else:
self.call = self.view.addEventCallback("SoEvent", self.action)
if not self.doc:
return
self.ui.selectPlaneUi()
FreeCAD.Console.PrintMessage(translate("draft", "Pick a face to define the drawing plane")+"\n")
if plane.alignToSelection(self.offset):
FreeCADGui.Selection.clearSelection()
self.display(plane.axis)
self.finish()
else:
self.call = self.view.addEventCallback("SoEvent", self.action)

def action(self, arg):
if arg["Type"] == "SoKeyboardEvent" and arg["Key"] == "ESCAPE":
Expand Down
3 changes: 2 additions & 1 deletion src/Mod/Draft/WorkingPlane.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ def alignToSelection(self, offset):
if len(sex) == 0:
return False
elif len(sex) == 1:
if not sex[0].Object.isDerivedFrom("Part::Shape"):
if not sex[0].Object.isDerivedFrom("Part::Feature") \
or not sex[0].Object.Shape:
return False
return self.alignToCurve(sex[0].Object.Shape, offset) \
or self.alignToFace(sex[0].Object.Shape, offset) \
Expand Down

0 comments on commit 2f14667

Please sign in to comment.