Draft: Allow to set the Working Plane from 3 selected vertices
This commit is contained in:
@@ -356,6 +356,17 @@ class SelectPlane(DraftTool):
|
||||
self.display(plane.axis)
|
||||
self.finish()
|
||||
return
|
||||
elif len(sel.SubElementNames) == 3:
|
||||
if ("Vertex" in sel.SubElementNames[0]) \
|
||||
and ("Vertex" in sel.SubElementNames[1]) \
|
||||
and ("Vertex" in sel.SubElementNames[2]):
|
||||
plane.alignTo3Points(sel.SubObjects[0].Point,
|
||||
sel.SubObjects[1].Point,
|
||||
sel.SubObjects[2].Point,
|
||||
self.offset)
|
||||
self.display(plane.axis)
|
||||
self.finish()
|
||||
return
|
||||
self.ui.selectPlaneUi()
|
||||
msg(translate("draft", "Pick a face to define the drawing plane\n"))
|
||||
if plane.alignToSelection(self.offset):
|
||||
|
||||
@@ -256,6 +256,12 @@ class plane:
|
||||
else:
|
||||
return False
|
||||
|
||||
def alignTo3Points(self,p1,p2,p3,offset=0):
|
||||
import Part
|
||||
w = Part.makePolygon([p1,p2,p3,p1])
|
||||
f = Part.Face(w)
|
||||
return self.alignToFace(f,offset)
|
||||
|
||||
def alignToSelection(self, offset):
|
||||
'''If selection uniquely defines a plane, align working plane to it. Return success (bool)'''
|
||||
import FreeCADGui
|
||||
|
||||
Reference in New Issue
Block a user