Restore ViewObject implementation for all Draft objects
In my tests the code works fine. Using @AIRCAP's instructions, I have created a 'broken' file from draft_test_objects.FCStd.
This commit is contained in:
@@ -31,15 +31,15 @@ import math
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
import FreeCAD as App
|
||||
|
||||
from draftobjects.base import DraftObject
|
||||
from draftutils import gui_utils
|
||||
|
||||
|
||||
class Point(DraftObject):
|
||||
"""The Draft Point object."""
|
||||
|
||||
def __init__(self, obj, x=0, y=0, z=0):
|
||||
super(Point, self).__init__(obj, "Point")
|
||||
super().__init__(obj, "Point")
|
||||
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property", "X Location")
|
||||
obj.addProperty("App::PropertyDistance", "X", "Draft", _tip)
|
||||
@@ -56,6 +56,10 @@ class Point(DraftObject):
|
||||
|
||||
obj.setPropertyStatus('Placement', 'Hidden')
|
||||
|
||||
def onDocumentRestored(self, obj):
|
||||
super().onDocumentRestored(obj)
|
||||
gui_utils.restore_view_object(obj, vp_module="view_point", vp_class="ViewProviderPoint")
|
||||
|
||||
def execute(self, obj):
|
||||
base = obj.Placement.Base
|
||||
xyz_vec = App.Vector(obj.X.Value, obj.Y.Value, obj.Z.Value)
|
||||
|
||||
Reference in New Issue
Block a user