Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Visual Studio Code tutorial

22 REPLIES 22
SOLVED
Reply
Message 1 of 23
hpekristiansen
8224 Views, 22 Replies

Visual Studio Code tutorial

Fusion 360 API is now using Visual Studio Code instead of a very old version of Spyder - I am happy.

 

The problem now is that I have not used Visual Studio Code before, and I do not know how VSC with Fusion differs from running generic Python in VSC. I can not even do a simple thing like running a script(from within VSC). How do I do that?

 

Do I need to install something special/make special settings like written here:

https://stackoverflow.com/questions/29987840/how-to-execute-python-code-from-within-visual-studio-co...

 

Here something is written about a needed extension, but I do not want to install something, if it is wrong for Fusion:

https://code.visualstudio.com/docs/python/python-tutorial

 

In the "What's new", it says "For more information about this, check out our help documentation. "

https://www.autodesk.com/products/fusion-360/blog/september-23-2019-product-update-whats-new/

 

Where is this help? 

 

22 REPLIES 22
Message 2 of 23

@Discussion_Admin Can this be moved to the API section of the Forum ?

@hpekristiansen hope that's OK with you. 


EESignature

Message 3 of 23

No problem - please move it to where it makes most sense. (I do not know how to make a simple comment in this forum - except by making a complete reply.)

Message 4 of 23


@hpekristiansen wrote:

Where is this help? 


Hello,

 

See there: Python Specific Issues

 

You only have to install VS Code.

 

Message 5 of 23

Ok - thank you.

 

-but I still do not know how to run the code!!?

Message 6 of 23
PinRudolf
in reply to: hpekristiansen

As I understand it: Run from Fusion, not from the IDE.

Start Script and Add-inns, select the add-in and click run. When you've made a change: save the file, stop the add-inn in Fusion and start it again. This seems much slower than the quick F5 debug function that worked with Spyder. Still nice we have VS Code now though!

Message 7 of 23
hpekristiansen
in reply to: PinRudolf

Yes - hurray for VSC

 

I am so much hoping for a faster way to run the code - right now it is

 

-make small change in code

- command+s  (save)

- command+tab (back to Fusion)

- user specified shortcut for Scripts and Add-Ins...

- find the script with the mouse 😞 there is no other way 😞

- and double click on it

Message 8 of 23
dewaine50
in reply to: hpekristiansen

I'd like to add to this that the most important feature Spyder offered was quick feedback, esp a console output for your code, whereas with VS I feel like I'm totally running blind. I don't even know if my code is running/working or not, and previous scripts would fail outright without any print statements to inform me what went wrong (This is percisely why Spyder is better)

I'd like to get some solutions on how to get VS running on Fusion. Maybe some demos.

Message 9 of 23
hpekristiansen
in reply to: dewaine50

If Spyder is better or not is a personal thing. Many(me included) think that VSC is better. Independent of what is "better" - the crucial thing is that VSC is up to date.

 

It sounds like you have not made any effort to figure out how VSC works, or if it offers the things that you miss from Spyder. Here you can see the output in the "DEBUG CONSOLE", when the print in line 21 executes.

 

ScreenShot2019-10-23T215813@1X.png

Message 10 of 23

@hpekristiansen 

Given that you already have experience you could make a real difference here by making a quick tutorial covering the basics.

Often its just that little bit of information that is missing for someone else to connect the dots. Just sayin'....


EESignature

Message 11 of 23

The only thing I know about Fusion 360 and VSC interaction is what is written by the Fusion team. Good VSC tutorials can be found online many places.

 

My knowledge is very very very far from being able to write tutorials for others. Sorry, if I gave that impression.

Message 12 of 23
goyals
in reply to: PinRudolf

As part of October update, We added a fix where you can run the script from VSCode itself.

 

1. If you started the VSCode in edit mode, then clicking on option "Debug->Start Without Debugging" will run the script on Fusion side. This will connect the VSCode with Fusion. Now if you want to make another change in script and re run it then disconnect it first and then again click on option "Debug->Start Without Debugging".

2. You can start the debugging also from VSCode. If you started the VSCode in edit mode and now want to start the debugging then put the breakpoint at the first line of the main script and click on "Debug->Start Debugging". If you started the VSCode in "Debug" mode then it will automatically stop at the first line of the script. No need to add the breakpoint explicitly.



Shyam Goyal
Sr. Software Dev. Manager
Message 13 of 23
createers.cn
in reply to: goyals

Hi all, 

environment: win7 and win10 64bit, 

installed vscode and python plugin, with python interpreter 3.7.3, 

My problem was whenever I click on Edit from script/addin menu I got a cmd box saying installing extensions... and then it will disappear. Never starts vscode. 

 

Please help.

Message 14 of 23
createers.cn
in reply to: createers.cn

Just found the solution to this problem, it's linked to recent python extension update.

 

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/api-debugger-doesn-t-work-after-oct-2019-u...

 

Thanks all.

Message 15 of 23

This is a rather cumbersome solution just to gain the benefits of vs code.

 

The Spyder work flow was much more efficient.

Message 16 of 23

Hi @fleming.kyle.william ,

Currently we are working on solution to support latest extension directly. 

Fusion will start supporting latest extension soon.


Nilesh Mohite
LinkedIn

If my answer helped you, please use  ACCEPT SOLUTION .
Also be generous with Likes!  Thank you and enjoy!

Message 17 of 23

At first the old seemed better.

VS Code is the way to go.

The HSM Post Editor features demand a shift in workflow.

 

Thank you

Message 18 of 23
andre.nel
in reply to: createers.cn

I used UDEMY and bought a Visual Studio Code tutorial. The price was around $12.00, I think I got more than money's worth. The instructor was Todd McLeod.

Message 19 of 23
dewaine50
in reply to: Nilesh.Mohite

Bring back Spyder. At the very least give users a preference option to use it as their default. There is no reason to switch everyone over. I'm just so sick of having things be completely nonfunctional in VS. My debugger functions don't work. It wont import basic modules like adsk. I won't let me move up and down in debugging. I just don't understand it. And there are no videos demonstrating how to use this. It's been 5 months of completely stalling every script I write and It's unbelivably frustrating. I cannot even tell you.

Message 20 of 23
Anonymous
in reply to: Nilesh.Mohite

any update to reply 16 in this thread....

 

Re: Visual Studio Code tutorial

Hi 

Currently we are working on solution to support latest extension directly. 

Fusion will start supporting latest extension soon.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report