Arch: Wall and Struct tools now set the working plane before drawing
This commit is contained in:
parent
08f031d6ca
commit
f43fcd1fb5
|
@ -94,6 +94,8 @@ class _CommandStructure:
|
|||
FreeCAD.ActiveDocument.recompute()
|
||||
else:
|
||||
# interactive mode
|
||||
if hasattr(FreeCAD,"DraftWorkingPlane"):
|
||||
FreeCAD.DraftWorkingPlane.setup()
|
||||
import DraftTrackers
|
||||
self.points = []
|
||||
self.tracker = DraftTrackers.boxTracker()
|
||||
|
|
|
@ -157,6 +157,8 @@ class _CommandWall:
|
|||
import DraftTrackers
|
||||
self.points = []
|
||||
self.tracker = DraftTrackers.boxTracker()
|
||||
if hasattr(FreeCAD,"DraftWorkingPlane"):
|
||||
FreeCAD.DraftWorkingPlane.setup()
|
||||
FreeCADGui.Snapper.getPoint(callback=self.getPoint,extradlg=self.taskbox())
|
||||
|
||||
def getPoint(self,point=None,obj=None):
|
||||
|
|
|
@ -232,12 +232,7 @@ class DraftTool:
|
|||
self.ui.sourceCmd = self
|
||||
self.ui.setTitle(name)
|
||||
self.ui.show()
|
||||
try:
|
||||
rot = self.view.getCameraNode().getField("orientation").getValue()
|
||||
upv = Vector(rot.multVec(coin.SbVec3f(0,1,0)).getValue())
|
||||
plane.setup(DraftVecUtils.neg(self.view.getViewDirection()), Vector(0,0,0), upv)
|
||||
except:
|
||||
pass
|
||||
plane.setup()
|
||||
self.node = []
|
||||
self.pos = []
|
||||
self.constrain = None
|
||||
|
|
|
@ -187,10 +187,20 @@ class plane:
|
|||
# len(sex) > 2, look for point and line, three points, etc.
|
||||
return False
|
||||
|
||||
def setup(self, direction, point, upvec=None):
|
||||
def setup(self, direction=None, point=None, upvec=None):
|
||||
'''If working plane is undefined, define it!'''
|
||||
if self.weak:
|
||||
self.alignToPointAndAxis(point, direction, 0, upvec)
|
||||
if direction and point:
|
||||
self.alignToPointAndAxis(point, direction, 0, upvec)
|
||||
else:
|
||||
try:
|
||||
from pivy import coin
|
||||
rot = FreeCADGui.ActiveDocument.ActiveView.getCameraNode().getField("orientation").getValue()
|
||||
upvec = Vector(rot.multVec(coin.SbVec3f(0,1,0)).getValue())
|
||||
vdir = FreeCADGui.ActiveDocument.ActiveView.getViewDirection()
|
||||
self.alignToPointAndAxis(Vector(0,0,0), DraftVecUtils.neg(vdir), upvec)
|
||||
except:
|
||||
print "Draft: Unable to align the working plane to the current view"
|
||||
self.weak = True
|
||||
|
||||
def reset(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user