This Fusion 360 Python Add-In allows the OpenAI Assistant API to interact with the Fusion design workspace.
- This add-in is in the beta stage, and under active development, it needs many improvements.
- Currently, this Add-In is intended for users with Python / Fusion 360 API experience.
- Use at your own risk, always save backups of your Fusion 360 files.
- Be especially careful using this Add-In on designs with referenced/linked/imported components, changes to a component in one design can affect the original component.
- I recommend you learn at least the basics of the Fusion 360 Python API, specifically the way objects are structured in a design.
- Due to the non-deterministic nature of LLMs, the same prompt will likely produce different results.
- If you would like to report an issue/ bug, please include all details that produced the error. Please DO NOT say something like: "I asked it to make a functioning rocket ship and it didn't work"
- Runtime Python errors/output are visible in the Text Commands window, View -> Show Text Commands on Mac. You should ways have this open
- JavaScript errors/ output are visible by right clicking Add-In Window, click Dev Tools In Product, then STSI GPT Addin. This will display a Chrome Browser Tools window, here you can explore the HTML, CSS, and JavaScript.
- Fusion 360 runs Python Add-Ins (e.g. "Fusion-GPT-Addin") in the built in Fusion 360 Python environment. It is relatively difficult and not recommended to modify (install third party packages) the built in Fusion 360 Python environment.
- To overcome this limitation, we run a separate Python program with its own environment, on a separate process. This program is called connection.py located in the directory "oai_container".
- The two Python programs communicate with each other via the Python "multiprocessing" package.
- When running the Add-In, please open the Fusion 360 Text Commands window. This provides details on errors and other runtime messages.
- "Fusion-GPT-Addin" is the actual Fusion 360 Add-In, must be loaded into Fusion 360 via the utilities tab
- "oai_container" contains the code relating to the Assistants API. connection.py is run in a separate process than Fusion. The Fusion 360 Add-In connects during run time
- "Browser" directory contains files for the HTML window displayed in Fusion
- Create an OpenAI Assistant at https://platform.openai.com/assistants/ Currently, you must have paid credits on the OpenAI Developer API.
- Rename the "config.sample" to "config.env", add your OpenAI API key and AssistantID, which you will find in the OpenAI Assistant Dashboard.
- I used Python 3.11 for this project. While it's not required, I highly recommend setting up a virtual environment. Create a virtual Python environment for this project. If you are unfamiliar with downloading Python / setting up a virtual environment, Google/ChatGPT "How to install Python and create a virtual environment"
- Install required libraries from the requirements.txt file.
- In Fusion 360 navigate to the utilities tab.
- In the Add-Ins section, click on the green + icon and load the directory Fusion-GPT-Addin.
- Click run, to run the Add-In.
- Now in the utilities tab you should see a new icon called Fusion-GPT-Addin.
- Click on the icon to open the prompt window.
- Please open the Fusion 360 Text Commands window. If the Add-In is not working properly, you should check the output here first.
- If you are using a virtual environment, activate it now.
- Navigate to "<project_root>/oai_container/" and run connection.py (python connection.py)
- In the console you should see "WAITING FOR FUSION 360 TO CONNECT".
- Click on the Add-Icon in the utilities tab, the prompt window should appear.
- Click on the "Settings" checkbox to expand all settings.
- We need to set up the Assistant's System Instructions, Model, and Tools (functions).
- You can set the system instructions by modifying/ adding txt files in oai_container/system_instructions.
├── Fusion-GPT-Addin
│ ├── GptAddin.manifest
│ ├── GptAddin.py
│ ├── commands
│ │ └── Browser
│ │ ├── entry.py
│ │ └── resources
│ │ ├── 16x16.png
│ │ ├── 32x32.png
│ │ ├── 64x64.png
│ │ └── html
│ │ ├── index.html
│ │ └── static
│ │ ├── palette.js
│ │ ├── sql_test.js
│ │ └── style.css
│ ├── config.py
│ └── f_interface
│ ├── fusion_interface.py
│ ├── gpt_client.py
│ └── modules
│ ├── cad_modeling.py
│ ├── document_data.py
│ ├── shared.py
│ ├── transient_objects.py
│ └── utilities.py
├── README.md
├── config.env
├── config.sample
├── oai_container
│ ├── connection.py
│ └── system_instructions
│ ├── system_instructions.txt
│ └── system_instructions_o3_mini.txt
├── requirements.txt
└── sample_prompts.txt