ChatGPT is a phenomenon online. It has been a hit since its launch a few month ago. ChatGPT can also prepare files for printing 3D. ChatGPT lets you create STL (ready-to-print) files, 3D code that can be used with scripting based 3D modeling programs such as OpensCAD and Gcode without the need for a 3D Slicer.
Below, we’ll explore each of these strategies in detail. ChatGPT can only do as well as the prompts that you give it. It may take several different wordings before you get what you are looking for.
How to generate G-code using ChatGPT
We will generate the G-code ChatGPT allows you to preview your design before sending it on a 3D Printer. If you’ve never tried the chatbot before, you can get it by registering with and logging into Openai. Logging in should give you the option to input your prompts.
You can create any design by asking the software to produce the printable file. In my situation, I’m looking to create a simple cube 3D model. When I ask the chatbot for a 3D printable model, I will get a general answer, as shown in the screenshot below.
For a 3D printable file, you must tell the software to create ASCII STL. ASCII STL format contains human-readable information about the triangular faces that form the surface of an object. Each vertex of the model is linked to another vertex, forming the triangles that define its shape.
The following section will explain the ASCII STL design format.
Files always begin with Solid <name>, Name is the name you have given your design. Next, you will see the details of the triangle’s vertices, and the code ends with the name endsolid <name>.
Create a 3D Model in ChatGPT by following the steps listed below.
1. The prompt is: Write it down “Generate a 3D Model of a cube using ASCII STL format,” then click enter. Here is an example of the generated code.
Google Drive allows you to download the whole file.
2. Copy the code Copy and paste Save it in any text editor such as Notepad.STL. You can modify the code if you know how it works.
3. Cura Imports the file You can use any 3D slicing program to generate G-code that we will send to our 3D printer. It’s also helpful in previewing it and checking how it will be 3D printed. The design I generated the first time with ChatGPT was tiny. I had to enlarge it in Cura.
4. Send the file to your 3-D printer. After slicing you can preview the result by moving sliders to the bottom or right of the interface. You can specify other settings, such as speed, temperature, layer height and others, depending on the 3D printer.
Then, you can send your file to the machine for 3D-printing. It took about 6 hours for the design to be 3D printed. I was very impressed by the final result, as there were no defects.
The surfaces are smoother and have perfect edges and surfaces.
ChatGPT can be used to create STL files. However, it can also generate G-code files that you can directly send to your printer without the need for a 3D slicer.
How to fix G-code files in ChatGPT
As an example, I have downloaded a Minecraft Creeper 3D Model I then opened it in Notepad and modified the sections highlighted below, adding letters instead of numeric values from line 5. Then I opened it in Notepad, and changed the highlighted sections by adding letters to line 5 instead of numeric values.
Then I saved the file and tried to open it in Cura. I got the below error.
ChatGPT will detect the errors quickly and easily. I then copied the file and pasted it in ChatGPT. The bot was asked to find the errors. This is what I got in response.
You can see that it detected the fact that I had added letters to lines 5, 7 and 10.
You can also tell it to fix it. In this example, I used the prompt, “Please fix the errors you identified.” As you see, it replaced the letters with random numbers.
ChatGPT can generate 3D models as well as fix G-codes and STL files. These can then be imported into 3D modeling software such OpensCAD. Watch as we demonstrate.
How to create scripts from 3D Models using ChatGPT
You can ask for a 3D-model that you can manipulate. Here, we’ll tell it to generate a script of a 3D model of a cup that we can use in OpensCAD. I used the prompt “OpensCAD: Create a script of a 3D cup model to be opened.”
Below is my output.
The code is generated. Download OpensCADI created a file and pasted in the code. After rendering and saving the model, the result was the one shown below.
It almost resembled a cup though it’s a little off. Play around with the instructions and code until you find the perfect design for a cup. By selecting the STL option, you can save the STL version of the file. STL The top-left toolbar section has an option.
After sending it to the 3D slicer, you can slice it. The time to print a model after slicing is estimated at 57 minutes.
After 3D-printing, I was successful in getting the design shown below.
You can see that it is smooth and generally good. It’s the same as the other cube. You can experiment with different prompts to create a unique design.