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:
what could be the reason explaining this error and how to solve it ?line 378, in <module> App.getDocument('Unnamed').getObject('Part__Feature').Label = "notSolid"
<class 'AttributeError'>: 'NoneType' object has no attribute 'Label'
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")