TypeError: circularHoleFeatures() missing 1 required positional argument: 'obj'

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
yoshi_koshi
Posts: 1
Joined: Fri Jan 22, 2021 9:30 pm

TypeError: circularHoleFeatures() missing 1 required positional argument: 'obj'

Post by yoshi_koshi »

Hi,

As always thank you for your help!

I am trying to get this simple class method to run but getting an error for missing arguments. I am sure I am giving an argument of partSel.Object but...

partSel = FreeCADGui.Selection.getSelectionEx()[0]
hole = PathScripts.PathCircularHoleBase.ObjectOp.circularHoleFeatures(partSel.Object)

Traceback (most recent call last):
File "<input>", line 1, in <module>
TypeError: circularHoleFeatures() missing 1 required positional argument: 'obj'


This is the help file doc
def circularHoleFeatures(self, obj):
'''circularHoleFeatures(obj) ... drilling works on anything, turn on all Base geometries and Locations.'''
return PathOp.FeatureBaseGeometry | PathOp.FeatureLocations


Any help is much appreciated thanks.
suzanne.soy
Posts: 54
Joined: Sat Dec 19, 2020 11:55 pm

Re: TypeError: circularHoleFeatures() missing 1 required positional argument: 'obj'

Post by suzanne.soy »

I don't have PathScripts in my FreeCAD Python console. Which version and which workbench are you using? Did you use any import statements?

My best guess is that you're calling the definition of the method, which is actually a function of two parameters, self and obj, when you should instead be calling it on an instance, e.g. something like

Code: Select all

App.ActiveDocument.MyPathObject(partSel.Object)
:?: Please mark your posts as [solved] :!:
:idea: If the answer you got is a good fit for the wiki, you can edit it!
FreeCAD modelling & coding workbenches+macros: twitch GitHub
Post Reply