Draft: possibility to set the working plane to an App::Part placement
This commit is contained in:
committed by
Yorik van Havre
parent
f97d18ca09
commit
fd79e3e3a9
@@ -694,7 +694,7 @@ class Plane:
|
||||
if self.weak or force:
|
||||
if direction and point:
|
||||
self.alignToPointAndAxis(point, direction, 0, upvec)
|
||||
else:
|
||||
elif FreeCAD.GuiUp:
|
||||
try:
|
||||
import FreeCADGui
|
||||
from pivy import coin
|
||||
|
||||
@@ -186,7 +186,14 @@ class Draft_SelectPlane:
|
||||
sel = FreeCADGui.Selection.getSelectionEx()
|
||||
if len(sel) == 1:
|
||||
sel = sel[0]
|
||||
if Draft.getType(sel.Object) == "Axis":
|
||||
if hasattr(sel.Object, 'TypeId') and sel.Object.TypeId == 'App::Part':
|
||||
FreeCAD.DraftWorkingPlane.setFromPlacement(sel.Object.getGlobalPlacement(), rebase=True)
|
||||
FreeCAD.DraftWorkingPlane.weak = False
|
||||
self.display(FreeCAD.DraftWorkingPlane.axis)
|
||||
self.wpButton.setText(sel.Object.Label)
|
||||
self.wpButton.setToolTip(translate("draft", "Current working plane")+": " + self.wpButton.text())
|
||||
return True
|
||||
elif Draft.getType(sel.Object) == "Axis":
|
||||
FreeCAD.DraftWorkingPlane.alignToEdges(sel.Object.Shape.Edges)
|
||||
self.display(FreeCAD.DraftWorkingPlane.axis)
|
||||
return True
|
||||
@@ -274,6 +281,7 @@ class Draft_SelectPlane:
|
||||
self.display(FreeCAD.DraftWorkingPlane.axis)
|
||||
return True
|
||||
elif sel:
|
||||
# try to setup the working plane for 3 vertexes
|
||||
subs = []
|
||||
import Part
|
||||
for s in sel:
|
||||
|
||||
Reference in New Issue
Block a user