Last Updated on September 13, 2023 by Christopher G Mendla
Harness the power of ChatGPT to simplify your OpenSCAD 3D printing projects.
Requirements
- A ChatGPT account (even a free one will do)
- OpenSCAD software
- A 3D printer and slicing software
Understanding the Basics
OpenSCAD is a unique platform where you input code to create 3D models. But what if ChatGPT could help you generate that code? This approach not only offers parameterized designs for easy tweaking but also provides a novel way to design and learn.
OpenSCAD is free to download and use.
The Issue at Hand
Imagine wanting a drain grid for your toothbrush. A 6×2 inch, 1/8-inch high grid that ensures water drips away. Simple in TinkerCad but can ChatGPT optimize this?
The Strategy
- Leveraging ChatGPT: Start a session in ChatGPT, either version 3.x or 4.x. You need to at least set up a free account with ChatGPT to use it. A paid account is only 20 dollars per month.
- Millimeters, Not Inches: Remember, the code generated will be in millimeters. Plan accordingly! If possible, it is better to specify your design in millimeters as this eliminates some confusing conversion code.
- Pose the Problem: Craft a precise query for ChatGPT. For instance: Write a .scad script for a drain grid measuring 80mm by 200mm by 3mm with 6 evenly spaced holes, 10mm from the block’s edge, each 3mm wide and 180mm long. The query used for this post can be found here.
- Analyze the Output: For our example, ChatGPT delivered a structured code. The parameterized approach facilitates modifications – say increasing the hole count. You can easily paste the ChatGPT generated code into OpenSCAD to see if you are on the right track. If not, you can edit your original ChatGPT query.
Using OpenSCAD
- Input the Code: Paste the ChatGPT-generated code into OpenSCAD.
- Visualize: Preview the design. Need more holes? Change the ‘hole_count’ parameter.
- Generate .stl File: Click the stl icon in OpenSCAD to create a 3D model.
- Note the circled icons in OpenSCAD. You can generate the model and you can export to an .stl files.
Slicing and Printing
- Import to your Slicer: Input the .stl file into your slicing software. I use the Creality slicing software for my printer.
- Tweak if Necessary: Adjust parameters if the model isn’t perfect. Generate a new .stl file if needed.
- Prepare for Printing: Load the revised .stl file in the slicer, transfer the gcode file to your printer, and initiate the print.
Outcome
While TinkerCad might be quicker for simpler designs, using ChatGPT with OpenSCAD can be beneficial for intricate projects. It’s an excellent method to understand .scad scripts and enjoy the flexibility of parameterized design.
Caveats/Tips
- Clear descriptions are crucial. This might be more challenging than the drag-and-drop nature of platforms like TinkerCad.
- Get things as close as possible with ChatGPT and make minor corrections with OpenSCAD.