Now available: Fusion 360 plugin for Intellij IDEA/PyCharm

Now available: Fusion 360 plugin for Intellij IDEA/PyCharm

JesusFreke
Advocate Advocate
22,357 Views
83 Replies
Message 1 of 84

Now available: Fusion 360 plugin for Intellij IDEA/PyCharm

JesusFreke
Advocate
Advocate

I've put together a little plugin for IDEA to add support for developing Fusion 360 python scripts. It allows you to launch and debug fusion scripts in IDEA, similarly to the bundled Spyder IDE.

 

You can find the plugin at https://github.com/JesusFreke/fusionIdea. It should be available in IDEA's built-in plugin repository soon, it's just pending approval.

 

You'll also need to install a small add-in in fusion 360, to help facilitate launching scripts from within IDEA. You can find more info in the README

22,358 Views
83 Replies
Replies (83)
Message 41 of 84

copypastestd
Advocate
Advocate

I hava updated PyCharm to last version "PyCharm 2019.1 (Professional Edition) Build #PY-191.6183.50, built on March 19, 2019"

And right now I could start plugin:

 

 

Facet.PNG

 

Error log:

java.lang.AbstractMethodError
	at com.intellij.execution.ExecutionTarget.canRun(ExecutionTarget.java:49)
	at com.intellij.execution.ExecutionTargetManagerImpl.lambda$doCanRun$0(ExecutionTargetManagerImpl.java:221)
	at com.intellij.execution.ExecutionTargetManagerImpl.doWithEachNonCompoundWithSpecifiedTarget(ExecutionTargetManagerImpl.java:279)
	at com.intellij.execution.ExecutionTargetManagerImpl.doCanRun(ExecutionTargetManagerImpl.java:209)
	at com.intellij.execution.ExecutionTargetManagerImpl.lambda$getTargetsFor$3(ExecutionTargetManagerImpl.java:258)
	at com.intellij.util.containers.ContainerUtil.findAll(ContainerUtil.java:1028)
	at com.intellij.util.containers.ContainerUtil.filter(ContainerUtil.java:1007)
	at com.intellij.execution.ExecutionTargetManagerImpl.getTargetsFor(ExecutionTargetManagerImpl.java:258)
	at com.intellij.execution.ExecutionTargetManagerImpl.updateActiveTarget(ExecutionTargetManagerImpl.java:145)
	at com.intellij.execution.ExecutionTargetManagerImpl.updateActiveTarget(ExecutionTargetManagerImpl.java:140)
	at com.intellij.execution.ExecutionTargetManagerImpl.access$100(ExecutionTargetManagerImpl.java:28)
	at com.intellij.execution.ExecutionTargetManagerImpl$2.runConfigurationSelected(ExecutionTargetManagerImpl.java:72)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at com.intellij.util.messages.impl.MessageBusConnectionImpl.deliverMessage(MessageBusConnectionImpl.java:114)
	at com.intellij.util.messages.impl.MessageBusImpl.doPumpMessages(MessageBusImpl.java:393)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:354)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:343)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:327)
	at com.intellij.util.messages.impl.MessageBusImpl.sendMessage(MessageBusImpl.java:320)
	at com.intellij.util.messages.impl.MessageBusImpl.access$100(MessageBusImpl.java:29)
	at com.intellij.util.messages.impl.MessageBusImpl$1.invoke(MessageBusImpl.java:192)
	at com.sun.proxy.$Proxy62.runConfigurationSelected(Unknown Source)
	at com.intellij.execution.impl.RunManagerImpl.setSelectedConfiguration(RunManagerImpl.kt:449)
	at com.intellij.execution.actions.RunConfigurationsComboBoxAction$SelectConfigAction.actionPerformed(RunConfigurationsComboBoxAction.java:322)
	at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:260)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:277)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAwareWithCallbacks(ActionUtil.java:251)
	at com.intellij.ui.popup.ActionPopupStep.performAction(ActionPopupStep.java:200)
	at com.intellij.ui.popup.ActionPopupStep.performAction(ActionPopupStep.java:190)
	at com.intellij.ui.popup.ActionPopupStep.lambda$onChosen$2(ActionPopupStep.java:184)
	at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:195)
	at com.intellij.ui.popup.AbstractPopup.lambda$dispose$14(AbstractPopup.java:1425)
	at com.intellij.util.ui.UIUtil.invokeLaterIfNeeded(UIUtil.java:3075)
	at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.java:159)
	at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.java:111)
	at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:179)
	at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.doWhenFocusSettlesDown(IdeFocusManagerImpl.java:58)
	at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:1421)
	at com.intellij.ui.popup.WizardPopup.dispose(WizardPopup.java:160)
	at com.intellij.ui.popup.list.ListPopupImpl.dispose(ListPopupImpl.java:306)
	at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.dispose(PopupFactoryImpl.java:279)
	at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:48)
	at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:44)
	at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(ObjectNode.java:136)
	at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(ObjectNode.java:105)
	at com.intellij.openapi.util.objectTree.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:214)
	at com.intellij.openapi.util.objectTree.ObjectNode.execute(ObjectNode.java:105)
	at com.intellij.openapi.util.objectTree.ObjectTree.executeAll(ObjectTree.java:162)
	at com.intellij.openapi.util.Disposer.dispose(Disposer.java:129)
	at com.intellij.openapi.util.Disposer.dispose(Disposer.java:125)
	at com.intellij.ui.popup.WizardPopup.disposeAllParents(WizardPopup.java:263)
	at com.intellij.ui.popup.list.ListPopupImpl.handleNextStep(ListPopupImpl.java:442)
	at com.intellij.ui.popup.list.ListPopupImpl._handleSelect(ListPopupImpl.java:395)
	at com.intellij.ui.popup.list.ListPopupImpl.handleSelect(ListPopupImpl.java:341)
	at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.handleSelect(PopupFactoryImpl.java:299)
	at com.intellij.ui.popup.list.ListPopupImpl$MyMouseListener.mouseReleased(ListPopupImpl.java:501)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
	at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
	at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
	at com.intellij.ui.popup.list.ListPopupImpl$MyList.processMouseEvent(ListPopupImpl.java:555)
	at java.desktop/java.awt.Component.processEvent(Unknown Source)
	at java.desktop/java.awt.Container.processEvent(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:742)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:687)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:386)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

 

0 Likes
Message 42 of 84

JesusFreke
Advocate
Advocate

Thanks for the report. It looks like some of IDEA's interfaces changed. I'll get a fixed build up this weekend.

Message 43 of 84

JesusFreke
Advocate
Advocate

A new version of the plugin that supports 2019.1 is available at https://github.com/JesusFreke/fusionIdea/releases/tag/v0.5.6

 

I've submitted the new version to IntelliJ's plugin repository, but it will probably be a day or two before it is approved and available.

 

Note: The new version of the plugin will not work on earlier versions of IDEA. I don't plan on trying to maintain different forks of the plugin for multiple versions when there are incompatible changes in classes in IDEA.

0 Likes
Message 44 of 84

prainsberry
Autodesk
Autodesk

HEY MAN THIS IS FANTASTIC!!!!  Just discovered this thread and will be testing it soon.  I have been using pycharm for a while for Fusion 360 add-ins but have always used a kind of silly workflow to make it work.  Can't wait to try this.  

 

I teach little API classes for Fusion 360 here and there and have been working on some documentation to accompany the classes.  Do you have any issues with me using this plug-in  and pointing people towards your pages?  All stuff will just be hosted as public google docs and on github pages.  

 

 



Patrick Rainsberry
Developer Advocate, Fusion 360
0 Likes
Message 45 of 84

JesusFreke
Advocate
Advocate

Absolutely :). I released the plugin to be used, after all. Enjoy! 🙂

0 Likes
Message 46 of 84

prainsberry
Autodesk
Autodesk
AWESOME!!!!! Can’t wait to try it out.

Will you DM me your contact info? Love to connect.


Patrick Rainsberry
Developer Advocate, Fusion 360
0 Likes
Message 47 of 84

JesusFreke
Advocate
Advocate

My contact info isn't particularly hard to find 🙂 See, e.g. the contact info associated with the plugin:  https://plugins.jetbrains.com/plugin/11343-fusion-360-scripting

0 Likes
Message 48 of 84

prainsberry
Autodesk
Autodesk
Does this support Mac? I see it is looking for the Fusion360.exe?

Won’t let me select the “Autodesk Fusion 360.app”



Patrick Rainsberry
Developer Advocate, Fusion 360
0 Likes
Message 49 of 84

JesusFreke
Advocate
Advocate

Nope :). I think I mentioned in a few different places that this is Windows only.

 

I've had a couple of conversations with people who were interested in trying to add support for Mac, but I don't know the status of their efforts.

0 Likes
Message 50 of 84

prainsberry
Autodesk
Autodesk
Ahhh ok bummer I missed that reading through threads.


Patrick Rainsberry
Developer Advocate, Fusion 360
0 Likes
Message 51 of 84

JesusFreke
Advocate
Advocate

I thought I had mentioned it in the first post in this thread, but it doesn't look like I did. These forums don't seem to let me edit posts after some time period (why???), so I can't edit it to add that info.

 

But it's mentioned in the plugin description at least, and on the github page. If you can somehow give me access to edit my own posts, I'd be happy to add that detail to the first post, since you're not the first person who didn't realize it was windows only 🙂

 

The windows-specific path issue would be easy to fix, of course, but the harder problem is getting the attaching and debugging to work. I don't have access to a Mac, nor do I particularly want to buy/own/use a Mac, so I'm not able to investigate+troubleshoot this. But I'm happy to provide pointers/help for anyone who wants to add support.

0 Likes
Message 52 of 84

prainsberry
Autodesk
Autodesk

I spent some time messing around with your plugin today to try and understand what would be involved to get it working on Mac.  Any pointers you could give me would be very helpful.  Would love to connect sometime if you are interested.  patrick_dot_rainsberry_at_autodesk_dot_com



Patrick Rainsberry
Developer Advocate, Fusion 360
0 Likes
Message 53 of 84

Anonymous
Not applicable

I'd made some progress porting this to Mac earlier in the year but had to temporarily shelve it due to my degree, the file path workaround is fairly simple to implement - I was still having issues getting the debugger to connect though.

 

Here's my fork of the repo for Mac support if you want to have a look or help out.

https://github.com/ChewieCB/fusionIdea

Message 54 of 84

imajar
Advisor
Advisor

Good Morning!

 

In reading through this thread, I am intrigued.  What is the benefit to using pycharm (or other IDE's) over the built in spyder?

(I have mostly learned python in the anaconda package which uses spyder . . . no experience with other IDE's).

 

Thanks!


Aaron Jarrett, PE
Inventor 2019 | i7-6700K 64GB NVidia M4000
LinkedIn

Life is Good.
0 Likes
Message 55 of 84

JesusFreke
Advocate
Advocate

tbh, I found the bundled spyder IDE... pretty lackluster. Much less feature rich than a modern IDE. I didn't use it for long, and it was long enough ago (mid-last year? something like that) that I honestly don't remember exactly what it could and couldn't do, in comparison to pycharm. But I remember I was immediately put off of the IDE, and even after trying to use it for a little bit.. well, let's just say that's how this plugin was born 🙂

0 Likes
Message 56 of 84

imajar
Advisor
Advisor

Alrighty:  I've installed IDEA and your add-in.  I can certainly see some nice features here!

 

But:  Im having an issue, I have a little script that runs fine in spyder.  But if I copy paste it into IDEA and try to run it, I get the following error in fusion:  

Capture.PNG

 

Can you think of any configuration issues that I might have missed?

 

Thanks!


Aaron Jarrett, PE
Inventor 2019 | i7-6700K 64GB NVidia M4000
LinkedIn

Life is Good.
0 Likes
Message 57 of 84

JesusFreke
Advocate
Advocate

It looks like your script doesn't have a run method?

 

The plugin expects a standard fusion 360 script, with a run() entrypoint.

0 Likes
Message 58 of 84

imajar
Advisor
Advisor

Right!  Here is a screenshot where I try to run the default hello script file that fusion/spyder creates by default when you create a new script:  Same thing, it works when I run it from spyder but not from IDEA. . .

Capture.PNG


Aaron Jarrett, PE
Inventor 2019 | i7-6700K 64GB NVidia M4000
LinkedIn

Life is Good.
0 Likes
Message 59 of 84

JesusFreke
Advocate
Advocate

Based on the name of the run configuration, and the module name in the dialog, it looks like you're running the Test file in the other tab, not the open Testfile file.

 

When you click the run button in IDEA, it runs the current configuration. In the toolbar, you'll see a dropdown to select the run configuration to run.

 

You can also right click in the Testfile file and there should be a "run <script> in fusion" (I forget the exact wording), which will create a new run configuration for that script if needed, and then run it.

0 Likes
Message 60 of 84

adonno
Enthusiast
Enthusiast

This is awesome stuff but I'm having a small problem. When I try to run a script it launches in Fusion but then as soon as it gets to the line ...

adsk.autoTerminate(False)

... in my run method I get this exception ...

---------------------------
Fusion 360
---------------------------
Failed:
Traceback (most recent call last):
File "C:\Users\Tony\OneDrive\Development\Fusion 360\Box Joint Line\Box Joint Line.py", line 66, in run
adsk.autoTerminate(False)
File "C:/Users/Tony/AppData/Local/Autodesk/webdeploy/production/be21f4f8eb7d12473f34c0be53077450f2ae0c9e/Api/Python/packages\adsk\core.py", line 375, in
sys.modules['adsk'].autoTerminate = lambda value = None: get_adsk_autoTerminate() if value == None else set_adsk_autoTerminate(value)
RuntimeError: Unknown exception

---------------------------
OK
---------------------------

... which I catch and display. After that the script runs in Fusion but the connection in PyCharm is lost so any further debugging isn't possible.

 

Fusion 360 v2.0.6045 - updated today

Fusion 360 Scripting v0.5.5

PyCharm 2018.3 (Community Edition)

 

I feel I am so close but I cannot figure out what is wrong here. Any ideas?

 

Thanks

Tony

0 Likes