Using ChatGPT and Fusion 360 API to Create a Script | How To Make A Script for Fusion with GPT3.5



Using ChatGPT and Fusion 360 API to Create a Script | How To Make A Script for Fusion with GPT3.5

Using ChatGPT and Fusion 360 API to Create a Script | How To Make A Script for Fusion with GPT3.5

In this video we are going to walk through making a script using ChatGPT from openai.com. We are going to walk through the process and create a similar program to one made in our earlier API series taking in CSV data and updating user parameters in Fusion 360.

This process isn’t perfect, it is very possible your results will vary. The intention is to look at how ChatGPT responds to prompts and find some common mistakes it makes to help us be successful in using it as a tool.

You can start with your own dataset but keep in mind we will be using Parameters for Length and Width controlled by the CSV and Fusion 360 API. You can use the dataset in the video here: https://a360.co/3oe160f

The following are the main prompts used in the video but note that in my experimentation using the same prompts was likely to give different results, so your results may vary:

ChatGPT, can you create a script for Fusion 360 API using python that will allow the user to open a CSV file and then display the results in a ui.messageBox?

We have this error displayed: {Error occurred: Traceback (most recent call last): File “C:/Users/Matt Perez/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/Scripts/000 ChatGPT/000 ChatGPT.py”, line 11, in run csv_file_path = ui.openFileDialog(‘Select CSV File’, ‘CSV Files (*.csv);;All Files (*.*)’) AttributeError: ‘UserInterface’ object has no attribute ‘openFileDialog’} I think ui.createFileDialog() is what is needed

Great, I made a few adjustments and here is the working program. Can you reference this going forward?

Can you add to this program? I need to do the following: Get the parent folder of the current active design. This is stored in the activeProduct.parentDocument.dataFile.parentFolder Get the active designs file name. This is stored in the activeDocument.dataFile.name. Display that info for the user.

Great, can you add to the program? The next thing needed is: 1. Update the user parameters in the design using the CSV column 1 as Length and CSV column 2 as Width. Ignore the header row in the CSV. 2. SaveAs the design for each row of data in the CSV as the file name plus the length and width values. Example “Cabinet 24 x 32”

00:00 Introduction
03:54 First ChatGPT Prompt
05:44 Copy the Reply Into a Program
06:31 Run the First Program and Troubleshoot
08:07 Copy and Run the Updated Code
08:43 Feeding the Edited Program Back to ChatGPT
09:16 Quick Review of Prompts So Far
10:44 Prompting ChatGPT to Add More Functionality
12:30 Running the Updated Code
13:20 Asking ChatGPT to Update User Parameters and Save
14:13 Running the Updated Code
14:32 Working Through an Error in the Save
20:17 Talking about Next Steps
21:44 Conclusion

Comments are closed.