Set working plane immediately upon clicking the set working plane button if you have a face selected

This commit is contained in:
Dion Moult
2019-05-19 15:26:15 +10:00
committed by Yorik van Havre
parent d05feb2f45
commit 2f14667cea
2 changed files with 12 additions and 11 deletions

View File

@@ -311,16 +311,16 @@ class SelectPlane(DraftTool):
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":

View File

@@ -269,7 +269,8 @@ class plane:
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) \