[Draft] Removed annotation styles objects

Removed Annotation styles current implementation.
As pointed out by yorik, in https://forum.freecadweb.org/viewtopic.php?f=23&t=44051&p=385710#p385179, this feature will be added using document Meta property.
This commit is contained in:
carlopav
2020-04-10 17:39:32 +02:00
committed by Yorik van Havre
parent 8e3dfe7c26
commit 0745f760a0
9 changed files with 4 additions and 1337 deletions

View File

@@ -32,7 +32,7 @@
import FreeCAD as App
import math
from PySide.QtCore import QT_TRANSLATE_NOOP
import DraftGeomUtils
import DraftGeomUtils, DraftVecUtils
import draftutils.gui_utils as gui_utils
import draftutils.utils as utils
from draftobjects.draft_annotation import DraftAnnotation
@@ -113,22 +113,13 @@ def make_dimension(p1,p2,p3=None,p4=None):
normal = normal.negative()
obj.Normal = normal
# format dimension according to ActiveDimensionStyle or user Preferences
_style_applied = False
if hasattr(App.ActiveDocument, "DimensionStyles"):
active_style = App.ActiveDocument.DimensionStyles.ActiveDimensionStyle
if active_style is not None:
obj.DimensionStyle = active_style
_style_applied = True
if App.GuiUp:
if not _style_applied:
gui_utils.format_object(obj)
gui_utils.format_object(obj)
gui_utils.select(obj)
return obj
def make_angular_dimension(center,angles,p3,normal=None):
"""makeAngularDimension(center,angle1,angle2,p3,[normal]): creates an angular Dimension
from the given center, with the given list of angles, passing through p3.
@@ -159,18 +150,9 @@ def make_angular_dimension(center,angles,p3,normal=None):
normal = normal.negative()
obj.Normal = normal
# format dimension according to ActiveDimensionStyle or user Preferences
_style_applied = False
if hasattr(App.ActiveDocument, "DimensionStyles"):
active_style = App.ActiveDocument.DimensionStyles.ActiveDimensionStyle
if active_style is not None:
obj.DimensionStyle = active_style
_style_applied = True
if App.GuiUp:
if not _style_applied:
gui_utils.format_object(obj)
gui_utils.format_object(obj)
gui_utils.select(obj)
return obj
@@ -188,12 +170,6 @@ class DimensionBase(DraftAnnotation):
"Initialize common properties for dimension objects"
DraftAnnotation.__init__(self,obj, tp)
# Annotation
obj.addProperty("App::PropertyLink","DimensionStyle",
"Annotation",
QT_TRANSLATE_NOOP("App::Property",
"Link dimension style"))
# Draft
obj.addProperty("App::PropertyVector",
"Normal",
@@ -222,9 +198,7 @@ class DimensionBase(DraftAnnotation):
def onChanged(self,obj,prop):
if prop == "DimensionStyle":
if hasattr(obj, "DimensionStyle"):
gui_utils.format_object(target = obj, origin = obj.DimensionStyle)
return
def execute(self, obj):
@@ -284,9 +258,6 @@ class LinearDimension(DimensionBase):
# obj.setEditorMode('Normal', 2)
if hasattr(obj, "Support"):
obj.setEditorMode('Support', 2)
if prop == "DimensionStyle":
if hasattr(obj, "DimensionStyle"):
gui_utils.format_object(target = obj, origin = obj.DimensionStyle)
def execute(self, obj):