Draft: fixing bugs in opening older files
This commit is contained in:
parent
a988ead620
commit
6113d15058
|
@ -3125,10 +3125,11 @@ class _ViewProviderDimension(_ViewProviderDraft):
|
|||
if proj:
|
||||
self.p2 = self.p1.add(proj.negative())
|
||||
self.p3 = self.p4.add(proj.negative())
|
||||
dmax = obj.ViewObject.ExtLines.Value
|
||||
if dmax and (proj.Length > dmax):
|
||||
self.p1 = self.p2.add(DraftVecUtils.scaleTo(proj,dmax))
|
||||
self.p4 = self.p3.add(DraftVecUtils.scaleTo(proj,dmax))
|
||||
if hasattr(obj.ViewObject,"ExtLines"):
|
||||
dmax = obj.ViewObject.ExtLines.Value
|
||||
if dmax and (proj.Length > dmax):
|
||||
self.p1 = self.p2.add(DraftVecUtils.scaleTo(proj,dmax))
|
||||
self.p4 = self.p3.add(DraftVecUtils.scaleTo(proj,dmax))
|
||||
else:
|
||||
self.p2 = self.p1
|
||||
self.p3 = self.p4
|
||||
|
@ -3187,12 +3188,13 @@ class _ViewProviderDimension(_ViewProviderDraft):
|
|||
else:
|
||||
fstring = "%." + str(getParam("dimPrecision",2)) + "f"
|
||||
self.string = (fstring % l)
|
||||
if obj.ViewObject.Override:
|
||||
try:
|
||||
# only available in Coin3D >= 4.0
|
||||
self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string)
|
||||
except:
|
||||
self.string = unicode(obj.ViewObject.Override).encode("latin1").replace("$dim",self.string)
|
||||
if hasattr(obj.ViewObject,"Override"):
|
||||
if obj.ViewObject.Override:
|
||||
try:
|
||||
# only available in Coin3D >= 4.0
|
||||
self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string)
|
||||
except:
|
||||
self.string = unicode(obj.ViewObject.Override).encode("latin1").replace("$dim",self.string)
|
||||
self.text.string = self.text3d.string = self.string
|
||||
|
||||
# set the distance property
|
||||
|
@ -3225,22 +3227,22 @@ class _ViewProviderDimension(_ViewProviderDraft):
|
|||
def onChanged(self, vobj, prop):
|
||||
"called when a view property has changed"
|
||||
|
||||
if prop == "FontSize":
|
||||
if (prop == "FontSize") and hasattr(vobj,"FontSize"):
|
||||
if hasattr(self,"font"):
|
||||
self.font.size = vobj.FontSize.Value
|
||||
if hasattr(self,"font3d"):
|
||||
self.font3d.size = vobj.FontSize.Value*100
|
||||
elif prop == "FontName":
|
||||
elif (prop == "FontName") and hasattr(vobj,"FontName"):
|
||||
if hasattr(self,"font") and hasattr(self,"font3d"):
|
||||
self.font.name = self.font3d.name = str(vobj.FontName)
|
||||
elif prop == "LineColor":
|
||||
elif (prop == "LineColor") and hasattr(vobj,"LineColor"):
|
||||
if hasattr(self,"color"):
|
||||
c = vobj.LineColor
|
||||
self.color.rgb.setValue(c[0],c[1],c[2])
|
||||
elif prop == "LineWidth":
|
||||
elif (prop == "LineWidth") and hasattr(vobj,"LineWidth"):
|
||||
if hasattr(self,"drawstyle"):
|
||||
self.drawstyle.lineWidth = vobj.LineWidth
|
||||
elif prop in ["ArrowSize","ArrowType"]:
|
||||
elif (prop in ["ArrowSize","ArrowType"]) and hasattr(vobj,"ArrowSize"):
|
||||
if hasattr(self,"node") and hasattr(self,"p2"):
|
||||
from pivy import coin
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user