Python Runtime Questions

Python Runtime Questions

markusbarnes
Advocate Advocate
1,061 Views
3 Replies
Message 1 of 4

Python Runtime Questions

markusbarnes
Advocate
Advocate

I have a couple of questions about how the Python runtime environment works with Fusion 360.

 

First, is there a way to execute a python script without manually executing it from Fusion 360? I have VS PyTools and I would like to start my script from the VS. Right now, I have to attach the debugger to the Fusion 360 process and then launch my Script from the Add-In menu so that it can stop at my breakpoints. This is a bit cumbersome. Is there a way to tell fusion 360 to execute a script externally?

 

Second, is there a configuration setting for Fusion 360's Python interpreter? I don't see a PythonPath environment variable. Theoretically, the interpreter's version shouldn't matter provided it is compatible with the Fusion API import files. I am assuming Fusion 360's API architecture has a clear wall between a Python add in and the host as it does with its C++ DLLs counterparts. It may be, however, that Fusion 360 uses Python internally and requires the same interpreter to be used.

0 Likes
1,062 Views
3 Replies
Replies (3)
Message 2 of 4

marshaltu
Autodesk
Autodesk

Hello,

 

Unfortunately there is no way to let Fusion 360 execute a script externally. That is probably the point we can improve in the near future. 

 

Regarding to the setting of Python interpreter, we deliver specific Python version(e.g. 3.5.3) with Fusion 360 together. All parts(including Fusion Python API) in Fusion 360 will use the version of Python. We will do compatibility testing every time when we upgrade Python version.  Meanwhile some 3rd-party developers will also create their applications (with pyc files only) based on the version. So we don't provide the setting to let users change Python interpreter. 

 

Thanks,

Marshal



Marshal Tu
Fusion Developer
>
0 Likes
Message 3 of 4

markusbarnes
Advocate
Advocate

Is there a file or facility for retrieving Fusion 360's Python path?  Curenty, I have to change PyTool's python path  for every new update. 

0 Likes
Message 4 of 4

KrisKaplan
Autodesk
Autodesk

This isn't available external to Fusion (it is built dynamically, and loaded modules extend it).  In Fusion in the 'Text Commands' palette when running in the 'Py' mode, you can run 'sys.path' to get the current system path.

 

Kris



Kris Kaplan
0 Likes