Draft + Arch: fixes when working without the GUI
This commit is contained in:
parent
580c541005
commit
b74c96dcc4
|
@ -352,8 +352,6 @@ class Component:
|
|||
|
||||
def getProfiles(self,obj,noplacement=False):
|
||||
"Returns the base profile(s) of this component, if applicable"
|
||||
if not obj.Shape: return []
|
||||
if obj.Shape.isNull(): return []
|
||||
wires = []
|
||||
n,l,w,h = self.getDefaultValues(obj)
|
||||
if obj.Base:
|
||||
|
|
|
@ -300,7 +300,8 @@ def makeStructure(baseobj=None,length=None,width=None,height=None,name=translate
|
|||
obj.ViewObject.ShapeColor = ArchCommands.getDefaultColor("Structure")
|
||||
if baseobj:
|
||||
obj.Base = baseobj
|
||||
obj.Base.ViewObject.hide()
|
||||
if FreeCAD.GuiUp:
|
||||
obj.Base.ViewObject.hide()
|
||||
if width:
|
||||
obj.Width = width
|
||||
else:
|
||||
|
|
|
@ -682,7 +682,7 @@ def makeDimension(p1,p2,p3=None,p4=None):
|
|||
if hasattr(FreeCAD,"DraftWorkingPlane"):
|
||||
normal = FreeCAD.DraftWorkingPlane.axis
|
||||
else:
|
||||
normal = App.Vector(0,0,1)
|
||||
normal = FreeCAD.Vector(0,0,1)
|
||||
if gui:
|
||||
# invert the normal if we are viewing it from the back
|
||||
vnorm = get3DView().getViewDirection()
|
||||
|
@ -890,14 +890,17 @@ def makeText(stringslist,point=Vector(0,0,0),screen=False):
|
|||
obj=FreeCAD.ActiveDocument.addObject("App::Annotation","Text")
|
||||
obj.LabelText=textbuffer
|
||||
obj.Position=point
|
||||
if not screen: obj.ViewObject.DisplayMode="World"
|
||||
h = getParam("textheight",0.20)
|
||||
if screen: h = h*10
|
||||
obj.ViewObject.FontSize = h
|
||||
obj.ViewObject.FontName = getParam("textfont","")
|
||||
obj.ViewObject.LineSpacing = 0.6
|
||||
formatObject(obj)
|
||||
select(obj)
|
||||
if FreeCAD.GuiUp:
|
||||
if not screen:
|
||||
obj.ViewObject.DisplayMode="World"
|
||||
h = getParam("textheight",0.20)
|
||||
if screen:
|
||||
h = h*10
|
||||
obj.ViewObject.FontSize = h
|
||||
obj.ViewObject.FontName = getParam("textfont","")
|
||||
obj.ViewObject.LineSpacing = 0.6
|
||||
formatObject(obj)
|
||||
select(obj)
|
||||
return obj
|
||||
|
||||
def makeCopy(obj,force=None,reparent=False):
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#***************************************************************************
|
||||
|
||||
|
||||
import FreeCAD, FreeCADGui, math, DraftVecUtils
|
||||
import FreeCAD, math, DraftVecUtils
|
||||
from FreeCAD import Vector
|
||||
|
||||
__title__="FreeCAD Working Plane utility"
|
||||
|
@ -232,6 +232,7 @@ class plane:
|
|||
|
||||
def alignToSelection(self, offset):
|
||||
'''If selection uniquely defines a plane, align working plane to it. Return success (bool)'''
|
||||
import FreeCADGui
|
||||
sex = FreeCADGui.Selection.getSelectionEx(FreeCAD.ActiveDocument.Name)
|
||||
if len(sex) == 0:
|
||||
return False
|
||||
|
@ -252,13 +253,14 @@ class plane:
|
|||
self.alignToPointAndAxis(point, direction, 0, upvec)
|
||||
else:
|
||||
try:
|
||||
import FreeCADGui
|
||||
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), vdir.negative(), 0, upvec)
|
||||
except:
|
||||
print "Draft: Unable to align the working plane to the current view"
|
||||
pass
|
||||
self.weak = True
|
||||
|
||||
def reset(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user