solucionado error al guardar
This commit is contained in:
@@ -95,6 +95,12 @@ class _Area:
|
|||||||
""" Method run when the document is restored """
|
""" Method run when the document is restored """
|
||||||
self.setProperties(obj)
|
self.setProperties(obj)
|
||||||
|
|
||||||
|
def __getstate__(self):
|
||||||
|
return None # No necesitamos guardar estado adicional
|
||||||
|
|
||||||
|
def __setstate__(self, state):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class _ViewProviderArea:
|
class _ViewProviderArea:
|
||||||
def __init__(self, vobj):
|
def __init__(self, vobj):
|
||||||
@@ -263,7 +269,7 @@ class FrameArea(_Area):
|
|||||||
if not hasattr(o, "Proxy"):
|
if not hasattr(o, "Proxy"):
|
||||||
continue
|
continue
|
||||||
if o.Proxy.Type == "Tracker":
|
if o.Proxy.Type == "Tracker":
|
||||||
lf.append(obj)
|
lf.append(o)
|
||||||
obj.Frames = lf
|
obj.Frames = lf
|
||||||
obj.FramesNumber = len(obj.Frames)
|
obj.FramesNumber = len(obj.Frames)
|
||||||
|
|
||||||
@@ -274,10 +280,17 @@ class FrameArea(_Area):
|
|||||||
|
|
||||||
def execute(self, obj):
|
def execute(self, obj):
|
||||||
''' execute '''
|
''' execute '''
|
||||||
#_Area.execute(self, obj)
|
|
||||||
|
|
||||||
|
if not hasattr(obj, "Frames"):
|
||||||
|
return
|
||||||
obj.FrameNumber = len(obj.Frames)
|
obj.FrameNumber = len(obj.Frames)
|
||||||
|
|
||||||
|
def __getstate__(self):
|
||||||
|
return None
|
||||||
|
|
||||||
|
def __setstate__(self, state):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ViewProviderFrameArea(_ViewProviderArea):
|
class ViewProviderFrameArea(_ViewProviderArea):
|
||||||
def __init__(self, vobj):
|
def __init__(self, vobj):
|
||||||
@@ -344,7 +357,7 @@ class OffsetArea(_Area):
|
|||||||
import Utils.PVPlantUtils as utils
|
import Utils.PVPlantUtils as utils
|
||||||
|
|
||||||
base = obj.Base.Shape
|
base = obj.Base.Shape
|
||||||
land = PVPlantSite.get().Terrain.Mesh
|
land = PVPlantSite.get().Terrain.mesh
|
||||||
vec = FreeCAD.Vector(0, 0, 1)
|
vec = FreeCAD.Vector(0, 0, 1)
|
||||||
wire = utils.getProjected(base, vec)
|
wire = utils.getProjected(base, vec)
|
||||||
wire = wire.makeOffset2D(obj.OffsetDistance.Value, 2, False, False, True)
|
wire = wire.makeOffset2D(obj.OffsetDistance.Value, 2, False, False, True)
|
||||||
@@ -354,6 +367,12 @@ class OffsetArea(_Area):
|
|||||||
pts.extend(section)
|
pts.extend(section)
|
||||||
obj.Shape = Part.makePolygon(pts)
|
obj.Shape = Part.makePolygon(pts)
|
||||||
|
|
||||||
|
def __getstate__(self):
|
||||||
|
return None
|
||||||
|
|
||||||
|
def __setstate__(self, state):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ViewProviderOffsetArea(_ViewProviderArea):
|
class ViewProviderOffsetArea(_ViewProviderArea):
|
||||||
def getIcon(self):
|
def getIcon(self):
|
||||||
@@ -372,15 +391,15 @@ class ViewProviderOffsetArea(_ViewProviderArea):
|
|||||||
|
|
||||||
|
|
||||||
def makeProhibitedArea(base = None):
|
def makeProhibitedArea(base = None):
|
||||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", "Exclusions")
|
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", "ExclusionArea")
|
||||||
ProhibitedArea(obj)
|
ProhibitedArea(obj)
|
||||||
ViewProviderForbiddenArea(obj.ViewObject)
|
ViewProviderForbiddenArea(obj.ViewObject)
|
||||||
if base:
|
if base:
|
||||||
obj.Base = base
|
obj.Base = base
|
||||||
try:
|
try:
|
||||||
group = FreeCAD.ActiveDocument.Exclusion
|
group = FreeCAD.ActiveDocument.getObject("Exclusions")
|
||||||
except:
|
except:
|
||||||
group = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroup", 'Exclusion')
|
group = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroup", 'Exclusions')
|
||||||
group.Label = "Exclusions"
|
group.Label = "Exclusions"
|
||||||
group.addObject(obj)
|
group.addObject(obj)
|
||||||
|
|
||||||
@@ -401,6 +420,12 @@ class ProhibitedArea(OffsetArea):
|
|||||||
"""Method run when the document is restored."""
|
"""Method run when the document is restored."""
|
||||||
self.setProperties(obj)
|
self.setProperties(obj)
|
||||||
|
|
||||||
|
def __getstate__(self):
|
||||||
|
return None
|
||||||
|
|
||||||
|
def __setstate__(self, state):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ViewProviderForbiddenArea(_ViewProviderArea):
|
class ViewProviderForbiddenArea(_ViewProviderArea):
|
||||||
def getIcon(self):
|
def getIcon(self):
|
||||||
@@ -556,6 +581,12 @@ class PVSubplant:
|
|||||||
''' '''
|
''' '''
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def __getstate__(self):
|
||||||
|
return None
|
||||||
|
|
||||||
|
def __setstate__(self, state):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ViewProviderPVSubplant:
|
class ViewProviderPVSubplant:
|
||||||
def __init__(self, vobj):
|
def __init__(self, vobj):
|
||||||
@@ -742,12 +773,11 @@ class CommandPVSubplant:
|
|||||||
area = makePVSubplant()
|
area = makePVSubplant()
|
||||||
sel = FreeCADGui.Selection.getSelection()
|
sel = FreeCADGui.Selection.getSelection()
|
||||||
for obj in sel:
|
for obj in sel:
|
||||||
if obj.Name[:7] == "Tracker":
|
if hasattr(obj, 'Proxy') and obj.Proxy.Type == "Tracker":
|
||||||
frame_list = area.Frames
|
frame_list = area.Frames
|
||||||
frame_list.append(obj)
|
frame_list.append(obj)
|
||||||
area.Frames = frame_list
|
area.Frames = frame_list
|
||||||
|
|
||||||
|
|
||||||
def IsActive(self):
|
def IsActive(self):
|
||||||
if FreeCAD.ActiveDocument:
|
if FreeCAD.ActiveDocument:
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user