How to manually building co-work links between Fusion and VS Code ?

How to manually building co-work links between Fusion and VS Code ?

serviceXS69Y
Participant Participant
1,407 Views
7 Replies
Message 1 of 8

How to manually building co-work links between Fusion and VS Code ?

serviceXS69Y
Participant
Participant

Visual Studio Code not being launched for editing fusion scripts ?

Dear All,
It is very odd and quite frustrating that I just learning fusion API and scripts programming via Visual Studio Code with no problem for few weeks and found very interesting and useful. However, it no longer being able to open Visual Studio Code for the editing, it run over the window /system32/cmd.exe for about 0.1 second only.
hence, I have tried to uninstall Visual Studio Code and Fusion 360, delete the C:/Users/user name/.vscode/ folder then download Fusion 360 and reinstall. then by clicking the Edit button for a script, the Fusion 360 directed for downloading the VS Code and completed the installation. the Fusion 360 is closed and restarted , and it directed the successful installation of VS Code extensions. However, when clicking the Edit button for a script, it just run over the window /system32/cmd.exe for about 0.1 second without opening a VS Code window for editing or debug the script. Repeating these cycle has experienced same results, which confused me if I need to try all these setting and tests on another PC ?
So, I wonder if there solutions for these barriers / exceptions ? Also, if any Configuration SOP or file so that I can put it in manually for building correct link and co-works between Fusion and VS Code ?
best regards !

0 Likes
Accepted solutions (2)
1,408 Views
7 Replies
Replies (7)
Message 2 of 8

j4n.vokurka
Advocate
Advocate
Accepted solution

Hello,

this is known bug caused by new release of the v2024.4.0 of the VSCode python extension. I expect it to be resolved in a hotfix but for temporary solution of this problem please read this thread.

Message 3 of 8

serviceXS69Y
Participant
Participant

Dear j4n.vokurka,
Thanks a lot.
But I can not find ( by search of File Explorer, Windows 10 Pro ) AppData/Roaming/Autodesk/Autodesk Fusion 360/API/ folder in my PC,
it only has AppData/Roaming/Autodesk/Autodesk Fusion 360/MyScripts folder and is empty ?
best regards !

 

0 Likes
Message 4 of 8

JeromeBriot
Mentor
Mentor

@serviceXS69YI added the path to the file for Windows in the discussion.

Message 5 of 8

serviceXS69Y
Participant
Participant

Dear JeromeBriot and all,

Yah! Since being paused for C# programming many years, I just reminded to set my File Explorer to show hidden and system files, so that can edit the "pre-run.py" located at
\AppData\Roaming\Autodesk\Autodesk Fusion 360\API\Python\vscode,
and it is great that this issue (bug) has been resolved and can edit scripts for Fusion API as usual.
Again thanks your very much for all your suggestion and directions.
Best regards !

0 Likes
Message 6 of 8

serviceXS69Y
Participant
Participant

Dear All,
Again the fusion API and scripts EDIT command can not open the Visual Studio Code today (my PC restarted  by unnormal power failure  ) , and I found that the content of  "pre-run.py" seems has been changed ? since it do not include lines of code within the thread as mentioned by  j4n.vokurka ? that is :

+++ pre-run.py	2024-04-04
@@ -38,7 +38,7 @@
         msPythonPath = os.path.expandvars(msPythons[0][0].path)
         index = msPythonPath.rfind('.')
         version  = int(msPythonPath[index+1:])
-        msPythonPath = os.path.join(msPythonPath, 'pythonFiles', 'lib','python')
+        msPythonPath = os.path.join(msPythonPath, 'python_files', 'lib','python')
         msPythonPath = os.path.normpath(msPythonPath)
         if os.path.exists(msPythonPath) and os.path.isdir(msPythonPath):
             return msPythonPath

So. I wonder if any ways to solve this problem ? 
Or if it is useful if any body could provide earlier pre-run.py version for the modifications according to the thread mentioned by  j4n.vokurka ?
Best regards !

0 Likes
Message 7 of 8

BrianEkins
Mentor
Mentor
Accepted solution

Check this post for a solution to this lastest issue.

https://forums.autodesk.com/t5/fusion-api-and-scripts/can-t-edit-or-debug-my-python-scripts/m-p/1275...

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 8 of 8

serviceXS69Y
Participant
Participant

Dear Brian,
Thank you very much for your  support.
It is great and I can use the Edit function normally.
best regards !

0 Likes