Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function takes exactly 2 arguments (1 given) #117

Open
m12lrpv opened this issue Dec 18, 2022 · 1 comment
Open

function takes exactly 2 arguments (1 given) #117

m12lrpv opened this issue Dec 18, 2022 · 1 comment

Comments

@m12lrpv
Copy link

m12lrpv commented Dec 18, 2022

Admittedly i'm trying to run it on v19
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22522 (Git)
Build type: Release
Branch: master
Hash: d8e476ef428017900dfe0f9359ba448503c216f9
Python version: 3.8.5
Qt version: 5.12.6
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/Australia (en_AU)

20:23:19  Running the Python command 'CreateInvoluteGear' failed:
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\commands.py", line 43, in Activated
    Gui.doCommandGui("freecad.gears.commands.{}.create()".format(
  File "<string>", line 1, in <module>
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\commands.py", line 61, in create
    cls.GEAR_FUNCTION(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 127, in __init__
    super(InvoluteGear, self).__init__(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 88, in __init__
    self.make_attachable(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 95, in make_attachable
    obj.addExtension('Part::AttachExtensionPython')

function takes exactly 2 arguments (1 given)
Running the Python command 'CreateInternalInvoluteGear' failed:
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\commands.py", line 43, in Activated
    Gui.doCommandGui("freecad.gears.commands.{}.create()".format(
  File "<string>", line 1, in <module>
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\commands.py", line 61, in create
    cls.GEAR_FUNCTION(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 312, in __init__
    super(InternalInvoluteGear, self).__init__(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 88, in __init__
    self.make_attachable(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 95, in make_attachable
    obj.addExtension('Part::AttachExtensionPython')

function takes exactly 2 arguments (1 given)Running the Python command 'CreateInvoluteRack' failed:
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\commands.py", line 43, in Activated
    Gui.doCommandGui("freecad.gears.commands.{}.create()".format(
  File "<string>", line 1, in <module>
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\commands.py", line 61, in create
    cls.GEAR_FUNCTION(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 487, in __init__
    super(InvoluteGearRack, self).__init__(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 88, in __init__
    self.make_attachable(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 95, in make_attachable
    obj.addExtension('Part::AttachExtensionPython')

function takes exactly 2 arguments (1 given)Running the Python command 'CreateCycloidGear' failed:
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\commands.py", line 43, in Activated
    Gui.doCommandGui("freecad.gears.commands.{}.create()".format(
  File "<string>", line 1, in <module>
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\commands.py", line 61, in create
    cls.GEAR_FUNCTION(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 947, in __init__
    super(CycloidGear, self).__init__(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 88, in __init__
    self.make_attachable(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 95, in make_attachable
    obj.addExtension('Part::AttachExtensionPython')

function takes exactly 2 arguments (1 given)Running the Python command 'CreateCycloidRack' failed:
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\commands.py", line 43, in Activated
    Gui.doCommandGui("freecad.gears.commands.{}.create()".format(
  File "<string>", line 1, in <module>
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\commands.py", line 61, in create
    cls.GEAR_FUNCTION(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 672, in __init__
    super(CycloidGearRack, self).__init__(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 88, in __init__
    self.make_attachable(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 95, in make_attachable
    obj.addExtension('Part::AttachExtensionPython')

function takes exactly 2 arguments (1 given)Running the Python command 'CreateCrownGear' failed:
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\commands.py", line 43, in Activated
    Gui.doCommandGui("freecad.gears.commands.{}.create()".format(
  File "<string>", line 1, in <module>
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\commands.py", line 61, in create
    cls.GEAR_FUNCTION(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 834, in __init__
    super(CrownGear, self).__init__(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 88, in __init__
    self.make_attachable(obj)
  File "C:\Users\Administrator\AppData\Roaming\FreeCAD\Mod\freecad.gears-master\freecad\gears\features.py", line 95, in make_attachable
    obj.addExtension('Part::AttachExtensionPython')

function takes exactly 2 arguments (1 given)
@m12lrpv
Copy link
Author

m12lrpv commented Dec 18, 2022

Solution.

Find features.py in your personal mods folder (if you were able to install it. I had to pull the repo)
C:\Users\{YourUserName}\AppData\Roaming\FreeCAD\Mod\freecad.gears\freecad\gears\features.py
change if int(App.Version()[1]) >= 19: to be if int(App.Version()[1]) >= 20:

    def make_attachable(self, obj):
        # Needed to make this object "attachable",
        # aka able to attach parameterically to other objects
        # cf. https://wiki.freecadweb.org/Scripted_objects_with_attachment
        print(App.Version())
        if int(App.Version()[1]) >= 20:
            obj.addExtension('Part::AttachExtensionPython')
        else:
            obj.addExtension('Part::AttachExtensionPython', obj)
        # unveil the "Placement" property, which seems hidden by default in PartDesign
        obj.setEditorMode('Placement', 0) #non-readonly non-hidden

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant