FC 0.19 error 'NoneType' object has no attribute 'Label'

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
Oli772
Posts: 26
Joined: Wed Apr 27, 2022 2:35 pm

FC 0.19 error 'NoneType' object has no attribute 'Label'

Post by Oli772 »

Hello,
on Ubuntu 22.04 I was able to run the script here below, but on Ubuntu 20.04 with FC 0.19 I get the following error:
line 378, in <module> App.getDocument('Unnamed').getObject('Part__Feature').Label = "notSolid"
<class 'AttributeError'>: 'NoneType' object has no attribute 'Label'
what could be the reason explaining this error and how to solve it ?
thank you for your help

script is:

Code: Select all

import sys
sys.path.append("/usr/lib/freecad/lib")
import FreeCAD, FreeCADGui
import ImportGui
from FreeCAD import Base
import Draft, PartDesign, Part, Import

App.newDocument("Unnamed")
ImportGui.insert(u"/home/user/Documents/project/geometry/object1.stp","Unnamed")
App.getDocument('Unnamed').getObject('Part__Feature').Label = "notSolid"        # **** line 378 ****
__s__=App.ActiveDocument.Part__Feature.Shape
__s__=Part.Solid(__s__)
__o__=App.ActiveDocument.addObject("Part::Feature","Part__Feature_solid")
__o__.Label="object1"
__o__.Shape=__s__
del __s__, __o__
App.getDocument('Unnamed').removeObject('Part__Feature')
App.getDocument('Unnamed').recompute()
App.getDocument("Unnamed").saveAs(u"/home/user/Documents/project/geometry/solidSTEP.FCStd")
App.closeDocument("Unnamed")
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: FC 0.19 error 'NoneType' object has no attribute 'Label'

Post by Roy_043 »

There is no object named "Part__Feature" in the document.
Post Reply