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: 

Javascript Debugging - What Am I Missing?

4 REPLIES 4
Reply
Message 1 of 5
jagboy2013
256 Views, 4 Replies

Javascript Debugging - What Am I Missing?

I'm trying to write some simple javascript code to import/export design parameters from/to .csv files.  But I must be completely missing some things in how the javascript debugger is supposed to work.  

 

Here's what I find:

 

I create a new script, and I can use the Edit and Debug buttons on the script dialog to modify it, and debug it.  

 

Invariably, at some point, the code that comes up in the Debugger is NOT the code that I see in the editor.  Somehow the debugger comes up with an old version of the code, and continues to attempt to run that, instead of the code as it actually exists in the file system and in the editor.

 

And, at some point, the debugger gets to where it either does not load ANY file, or loads a file, but does NOT enable debugging.  

 

And. it also appears editing the text in the debugger window is a complete waste of time, as it NEVER runs that code.

 

And, whenever I close the debugger window, on my next attempt at debugging, all I get is an error dialog that the debugger is disconnected.

 

And, if you (stupidly) create an infinite loop in the script, there appears to be no way to kill that thread, short of using TaskManager to kill Fusion.

 

And, how do you re-start debugging, without having to close the debugger window, and start over from scratch?

 

As I said, I must be missing some very basic things, as this whole interface appears to be incredibly lame and lacking in functionality....

 

Regards,

Ray L.

4 REPLIES 4
Message 2 of 5
jagboy2013
in reply to: jagboy2013

And, it appears that when the debugger goes wonky, there is a circle of little blue dots to the right of the script name in the Scripts dialog.  I'm sure that indicates something, but I have no clue what....

 

Regards,

Ray L.

Message 3 of 5
jagboy2013
in reply to: jagboy2013

Soooo.....  Nobody is using the javascript debugger?

 

Regards,

Ray L.

Message 4 of 5
ekinsb
in reply to: jagboy2013

Most of what you're experiencing is what's to be expected when programming with JavaScript.  With JavaScript there isn't a single tool that provides both editing and debugging of your code.  You'll edit using some editor, which Brackets is the default editor.  After you've finished making any changes to your code using the editor you need to make sure that you've saved those changes before trying to run or debug your program.  This is because you're now using a different tool which reads your program from your drive and does the debugging. If you edit your code in the debugger, you're just modifying an in-memory copy and not the program on your drive. To make an edit you need to go back to go back to your code editor, make changes to the code, save them, and then restart the debugging process.

 

This isn't unusual when writing JavaScript because when writing JavaScript for the browser you typically use some editor (VS Code, Brackets, Atom, etc.) to write the code and then load and debug the code inside the browser.  To make any changes you go back and edit the source and then reload it to debug.  It's the same workflow with JavaScript and Fusion.  Depending on what languages and IDE's you're used to using in the past, it can seem pretty clumsy.  I don't like it and it's one of the reasons I don't prefer working with JavaScript.

 

The little circle of spinning dots in the Scripts and Add-Ins dialog is indicating that the script or add-in is currently running.  You can select it and then click the "Stop" button in the dialog.

 

 


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 5 of 5
jagboy2013
in reply to: ekinsb

Brian,

 

Thanks.  I did (eventually...) notice the Stop button.  Don't know why it took me so long.

 

Debugging is painful, since any errors, and the debugger simply doesn't run.  I pretty inefficient way to work.  But, I got my scripts done (exporting and importing design user parameters to/from a .csv file), so all is well.

 

Regards,

Ray L.

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report