syuntoku14 / fusion2urdf

A Fusion 360 Script to export URDF
MIT License
481 stars 163 forks source link

No longer runs on 2.0.20256 x86_64? #83

Open kadakadak opened 2 months ago

kadakadak commented 2 months ago

Doesn't sound like this is maintained anymore, but on the off chance someone is watching, I believe I've followed the instructions for creating a simple model to export, but when I run the script, nothing happens. No dialogs. No warnings. Not sure how to debug further. If my google translated Japanese is correct, the other person seems to be having a similar problem.

(sorry for the duplicate issue, I some how fat-fingered my return key and created an empty issue)

kadakadak commented 2 months ago

Text Commands window shows:

SCRIPT ERROR

Traceback (most recent call last): File "/Users/local/Library/Application Support/Autodesk/Autodesk Fusion 360/API/Scripts/URDF_Exporter/URDF_Exporter.py", line 7, in from .utils import utils File "/Users/local/Library/Application Support/Autodesk/Autodesk Fusion 360/API/Scripts/URDF_Exporter/utils/utils.py", line 12, in from distutils.dir_util import copy_tree ModuleNotFoundError: No module named 'distutils'

kadakadak commented 2 months ago

Perhaps the distutils copy_tree import needs to be swapped for the one in shutil?

kadakadak commented 2 months ago

index 10f6b1a..925b833 100644
--- a/URDF_Exporter/utils/utils.py
+++ b/URDF_Exporter/utils/utils.py
@@ -9,7 +9,7 @@ import adsk, adsk.core, adsk.fusion
 import os.path, re
 from xml.etree import ElementTree
 from xml.dom import minidom
-from distutils.dir_util import copy_tree
+from shutil import copytree
 import fileinput
 import sys

@@ -149,7 +149,7 @@ def copy_package(save_dir, package_dir):
     except: pass 
     try: os.mkdir(save_dir + '/urdf')
     except: pass 
-    copy_tree(package_dir, save_dir)
+    copytree(package_dir, save_dir, dirs_exist_ok=True)

 def update_cmakelists(save_dir, package_name):
     file_name = save_dir + '/CMakeLists.txt'```
Gautham-Ramkumar03 commented 2 months ago

Doesn't sound like this is maintained anymore, but on the off chance someone is watching, I believe I've followed the instructions for creating a simple model to export, but when I run the script, nothing happens. No dialogs. No warnings. Not sure how to debug further. If my google translated Japanese is correct, the other person seems to be having a similar problem.

(sorry for the duplicate issue, I some how fat-fingered my return key and created an empty issue)

it seems the URDF_Exporter_ros2 fork is also not working, nothing happens it seems like the local libraries like disutils is deprecated is there any solution?

tvharikrishna commented 1 month ago

Solution & Fix: Worked for me

To fix the issue with the URDF_Exporter script, you'll need to update the code to replace the deprecated distutils.dir_util.copy_tree with shutil.copytree, which is supported in the version of Python that Fusion 360 uses.

Steps:

  1. Locate utils.py:

    • Go to the directory where fusion2urdf is installed, typically located in your Fusion 360 API Scripts folder.
    • Open the file utils.py.
  2. Update the Import Statement: Find this line:

    from distutils.dir_util import copy_tree

    Replace it with:

    from shutil import copytree
  3. Modify the Function Calls: Wherever copy_tree is called, replace it with copytree. You also need to adjust the syntax to match shutil.copytree, which requires the dirs_exist_ok=True argument to avoid errors when directories already exist. Find this line:

    copy_tree(package_dir, save_dir)

    Replace it with:

    copytree(package_dir, save_dir, dirs_exist_ok=True)
  4. Test the Changes: Save the changes in utils.py. Run the script again in Fusion 360 and test to see if the dialog box for saving the URDF file now appears.

AbdelmMatoug commented 1 month ago

Dear, I've followed these steps but I'm now getting "SCRIPT ERROR" in the text command, and nothing pops up.

Kind regards.

TheHassanShahzad commented 1 month ago

Hi this still isnt working for me. nothing shows up, no dialog box

luc1fer06 commented 1 month ago

I Did the above changes for ros 1 and it worked but it's not working for ros 2

Failed: Traceback (most recent call last): File "C:/Users/admin/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/Scripts/URDF_Exporter_Ros2/URDF_Exporter_Ros2.py", line 86, in run utils.create_package(package_name, save_dir, package_dir) ^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'mainC%3A%2FUsers%2Fadmin%2FAppData%2FRoaming%2FAutodesk%2FAutodesk%20Fusion%20360%2FAPI%2FScripts%2FURDF_Exporter_Ros2%2FURDF_Exporter_Ros2_py.utils.utils' has no attribute 'create_package'

i am facing the above error can someone help

Oyefusi-Samuel commented 1 week ago

I Did the above changes for ros 1 and it worked but it's not working for ros 2

Failed: Traceback (most recent call last): File "C:/Users/admin/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/Scripts/URDF_Exporter_Ros2/URDF_Exporter_Ros2.py", line 86, in run utils.create_package(package_name, save_dir, package_dir) ^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'mainC%3A%2FUsers%2Fadmin%2FAppData%2FRoaming%2FAutodesk%2FAutodesk%20Fusion%20360%2FAPI%2FScripts%2FURDF_Exporter_Ros2%2FURDF_Exporter_Ros2_py.utils.utils' has no attribute 'create_package'

i am facing the above error can someone help

to fix this error you just have to simply check your design to crosscheck design delete errors