View Issue Details

IDProjectCategoryView StatusLast Update
0004421FreeCADBugpublic2020-08-20 08:20
Reportermarioamb Assigned To 
Status newResolutionopen 
Product Version0.19 
Summary0004421: Part.CompoundTools.Explode.explodeCompound access a property of a sometimes null object with an error
DescriptionPython code, file "src/Mod/Part/CompoundTools/".
The "explodeCompound" function can be called in a context without assigning the "ViewObject" property, for example from a command line script.

The error:
[code=traceback (most recent call last):
  file "/opt/freecad/mod/part/compoundtools/", line 23, in explodecompound
    cf.viewobject.dontunhideondelete = true
attributeerror: 'nonetype' object has no attribute 'dontunhideondelete'][/code]
I attach the simple patch to the code to correct it.
TagsNo tags attached.
FreeCAD InformationOS: Debian GNU/Linux bullseye/sid (MATE/mate)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21619 (Git)
Build type: Release
Branch: master
Hash: 58e459cde1a60365510f308d94405ce58c9b008d
Python version: 3.8.5
Qt version: 5.14.2
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)



2020-08-20 08:20


Explode.patch (500 bytes)   
--- ./src/Mod/Part/CompoundTools/	2020-08-20 09:56:20.501325332 +0200
+++ ./src/Mod/Part/CompoundTools/	2020-08-20 09:56:55.732717600 +0200
@@ -20,6 +20,7 @@
         cf.Base = compound_obj
         cf.FilterType = 'specific items'
         cf.items = str(i)
-        cf.ViewObject.DontUnhideOnDelete = True
+        if cf.ViewObject is not None:
+            cf.ViewObject.DontUnhideOnDelete = True
     return (group, features_created)
Explode.patch (500 bytes)   

Issue History

Date Modified Username Field Change
2020-08-20 08:20 marioamb New Issue
2020-08-20 08:20 marioamb File Added: Explode.patch