From 8c18fcaec4d1f47667ec6634d477815fa4f8f17b Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Tue, 10 Jan 2012 20:24:31 -0200 Subject: [PATCH] fixed bug in draft dimensions editmode --- src/Mod/Draft/Draft.py | 8 ++++---- src/Mod/Draft/DraftTools.py | 14 +++++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 22457a4e2..98480a8d9 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -1429,7 +1429,7 @@ class _ViewProviderDimension: obj.addProperty("App::PropertyLength","LineWidth","Base","Line width") obj.addProperty("App::PropertyColor","LineColor","Base","Line color") obj.addProperty("App::PropertyLength","ExtLines","Base","Ext lines") - obj.addProperty("App::PropertyVector","Position","Base","The position of the text. Leave (0,0,0) for automatic position") + obj.addProperty("App::PropertyVector","TextPosition","Base","The position of the text. Leave (0,0,0) for automatic position") obj.addProperty("App::PropertyString","Override","Base","Text override. Use 'dim' to insert the dimension length") obj.Proxy = self obj.FontSize=getParam("textheight") @@ -1476,10 +1476,10 @@ class _ViewProviderDimension: if hasattr(obj.ViewObject,"DisplayMode"): if obj.ViewObject.DisplayMode == "3D": offset = fcvec.neg(offset) - if obj.ViewObject.Position == Vector(0,0,0): + if obj.ViewObject.TextPosition == Vector(0,0,0): tbase = midpoint.add(offset) else: - tbase = obj.ViewObject.Position + tbase = obj.ViewObject.TextPosition rot = FreeCAD.Placement(fcvec.getPlaneRotation(u,v,norm)).Rotation.Q return p1,p2,p3,p4,tbase,norm,rot @@ -1719,7 +1719,7 @@ class _ViewProviderAngularDimension: obj.addProperty("App::PropertyString","FontName","Base","Font name") obj.addProperty("App::PropertyLength","LineWidth","Base","Line width") obj.addProperty("App::PropertyColor","LineColor","Base","Line color") - obj.addProperty("App::PropertyVector","Position","Base","The position of the text. Leave (0,0,0) for automatic position") + obj.addProperty("App::PropertyVector","TextPosition","Base","The position of the text. Leave (0,0,0) for automatic position") obj.addProperty("App::PropertyString","Override","Base","Text override. Use 'dim' to insert the dimension length") obj.Proxy = self obj.FontSize=getParam("textheight") diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index 16e9c77bd..fce0992e7 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -3080,8 +3080,9 @@ class Edit(Modifier): if self.obj: self.obj = self.obj[0] # store selectable state of the object - self.selectstate = self.obj.ViewObject.Selectable - self.obj.ViewObject.Selectable = False + if hasattr(self.obj.ViewObject,"Selectable"): + self.selectstate = self.obj.ViewObject.Selectable + self.obj.ViewObject.Selectable = False if not Draft.getType(self.obj) in ["Wire","BSpline"]: self.ui.setEditButtons(False) else: @@ -3148,7 +3149,8 @@ class Edit(Modifier): t.finalize() if self.constraintrack: self.constraintrack.finalize() - self.obj.ViewObject.Selectable = self.selectstate + if hasattr(self.obj.ViewObject,"Selectable"): + self.obj.ViewObject.Selectable = self.selectstate Modifier.finish(self) plane.restore() self.running = False @@ -3188,13 +3190,15 @@ class Edit(Modifier): self.ui.isRelative.show() self.editing = int(snapped['Component'][8:]) self.trackers[self.editing].off() - self.obj.ViewObject.Selectable = False + if hasattr(self.obj.ViewObject,"Selectable"): + self.obj.ViewObject.Selectable = False if "Points" in self.obj.PropertiesList: self.node.append(self.obj.Points[self.editing]) else: print "finishing edit" self.trackers[self.editing].on() - self.obj.ViewObject.Selectable = True + if hasattr(self.obj.ViewObject,"Selectable"): + self.obj.ViewObject.Selectable = True self.numericInput(self.trackers[self.editing].get()) def update(self,v):