View Issue Details

IDProjectCategoryView StatusLast Update
0004453FreeCADBugpublic2020-11-21 16:25
Reporterwalpa Assigned Towmayer  
PrioritynormalSeverityblockReproducibilityalways
Status closedResolutionfixed 
PlatformpcOSLinux OS VersionMint 19.3
Product Version0.19 
Target Version0.19Fixed in Version0.19 
Summary0004453: Error triggered when trying to clear the property by the property editor and Link dialog
DescriptionWhen trying to clear the property links in PropertyLinkListGlobal, through the property editor, the exception is thrown:

<Exception> type must be 'DocumentObject' or 'DocumentObject' list, not NoneType

And the link persists.
Steps To ReproduceThe attached script shows the situation:
- copy the script to the ./FreeCAD/Macro folder
- open the FC
- run the script
- create the link in the "Operates On" property
- try removing this link
- exception is raised
Additional InformationRelated Forum topic:
TagsNo tags attached.
FreeCAD InformationOS: Linux Mint 19.3 (X-Cinnamon/cinnamon)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22611 (Git) AppImage
Build type: Release
Branch: master
Hash: 7eeec7a5990cc786723225ca8de16ca3186545b3
Python version: 3.8.5
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: Portuguese/Brazil (pt_BR)

Activities

walpa

2020-10-08 12:13

reporter  

test_PropertyLinkListGlobal.py (2,669 bytes)   
import FreeCAD as App
import FreeCADGui as Gui
import Part

def create(obj_name):
    """
    Object creation method
    """
    obj = App.ActiveDocument.addObject('Part::FeaturePython', obj_name)
    box(obj)
    ViewProviderBox(obj.ViewObject)
    App.ActiveDocument.recompute()
    return obj

class box():

    def __init__(self, obj):
        """
        Default constructor
        """
        self.Type = 'box'
        obj.Proxy = self
        obj.addProperty("App::PropertyLinkListGlobal", "OperatesOn", "Relations", "")

    def execute(self, obj):
        """
        Called on document recompute
        """
        obj.Shape = Part.makeBox(1, 1, 1)


class ViewProviderBox:

    def __init__(self, obj):
        """
        Set this object to the proxy object of the actual view provider
        """
        obj.Proxy = self

    def attach(self, obj):
        """
        Setup the scene sub-graph of the view provider, this method is mandatory
        """
        return

    def updateData(self, fp, prop):
        """
        If a property of the handled feature has changed we have the chance to handle this here
        """
        return

    def getDisplayModes(self,obj):
        """
        Return a list of display modes.
        """
        return []

    def getDefaultDisplayMode(self):
        """
        Return the name of the default display mode. It must be defined in getDisplayModes.
        """
        return "Shaded"

    def setDisplayMode(self,mode):
        """
        Map the display mode defined in attach with those defined in getDisplayModes.
        Since they have the same names nothing needs to be done.
        This method is optional.
        """
        return mode

    def onChanged(self, vp, prop):
        """
        Print the name of the property that has changed
        """
        App.Console.PrintMessage("Change property: " + str(prop) + "\n")

    def getIcon(self):
        """
        Return the icon in XMP format which will appear in the tree view. This method is optional and if not defined a default icon is shown.
        """
        return 


    def __getstate__(self):
        """
        Called during document saving.
        """
        return None

    def __setstate__(self,state):
        """
        Called during document restore.
        """
        return None


App.newDocument("Unnamed")
App.ActiveDocument.addObject("Part::Box","Box")
App.ActiveDocument.ActiveObject.Label = "Cube"
App.ActiveDocument.getObject('Box').Placement = App.Placement(App.Vector(20,0,0),App.Rotation(App.Vector(0,0,1),0))
App.ActiveDocument.recompute()
Gui.ActiveDocument.ActiveView.fitAll()
create('test')
test_PropertyLinkListGlobal.py (2,669 bytes)   

walpa

2020-10-08 12:16

reporter   ~0014793

Excuse me:
Related Forum topic:
https://forum.freecadweb.org/viewtopic.php?f=3&t=50931

Kunda1

2020-10-08 13:32

administrator   ~0014794

Confirmed on the forum

chennes

2020-11-10 03:33

reporter   ~0014970

I believe I have fixed this with PR 4036: https://github.com/FreeCAD/FreeCAD/pull/4036

wmayer

2020-11-18 17:24

administrator   ~0015005

https://github.com/FreeCAD/FreeCAD/commit/031619db277894ce959bdaf64d7e92d826cc47f6

Kunda1

2020-11-21 16:25

administrator   ~0015014

FreeCAD master 031619db

Related Changesets

FreeCAD: master 031619db

2020-11-16 21:20:24

chennes


Committer: wmayer Details Diff
Modify PropertyLinkList to accept None from Python. Affected Issues
0004453
mod - src/App/PropertyLinks.cpp Diff File

Issue History

Date Modified Username Field Change
2020-10-08 12:13 walpa New Issue
2020-10-08 12:13 walpa File Added: test_PropertyLinkListGlobal.py
2020-10-08 12:16 walpa Note Added: 0014793
2020-10-08 13:31 Kunda1 Tag Attached: #pending-forum
2020-10-08 13:32 Kunda1 Status new => confirmed
2020-10-08 13:32 Kunda1 Note Added: 0014794
2020-10-08 13:32 Kunda1 Target Version => 0.19
2020-11-10 03:33 chennes Note Added: 0014970
2020-11-18 17:24 wmayer Assigned To => wmayer
2020-11-18 17:24 wmayer Status confirmed => closed
2020-11-18 17:24 wmayer Resolution open => fixed
2020-11-18 17:24 wmayer Fixed in Version => 0.19
2020-11-18 17:24 wmayer Note Added: 0015005
2020-11-21 16:25 Kunda1 Note Added: 0015014
2020-11-21 16:25 Kunda1 Changeset attached => FreeCAD master 031619db
2020-11-21 16:25 Kunda1 Tag Detached: #pending-forum