News
News
Integrate The 3D Printing Into Daily Life!

How Can ChatGPT Be Used for 3D Printing

2023-02-09 10:10

ChatGPT by OpenAI is an AI language model, which allows session input to be directly converted into function code output. There are many applications, from writing poems, creating recipes, and even critically analyzing famous texts and works of art. However, the language model also understands several programming languages and syntax. This makes it possible to generate 3D printable models, executable code scripts, etc. using only text prompts. Although ChatGPT is not fully ready to create a functional model of a complex engine, it can create simple shapes and programs that can be used to create 3D models.

What is ChatGPT?

ChatGPT stands for Chat Generic Pre-Trained Transformer.

We trained a model called ChatGPT, which interacts in a conversational way. The dialogue format enables ChatGPT to answer follow-up questions, admit mistakes, question incorrect premises and reject inappropriate requests. ChatGPT is the sibling model of InstructGPT, which is trained to follow instructions in prompts and provide detailed responses. Source: OpenAI

As generative AI art tools like Dall-E (also made by OpenAI) become more and more popular, it is only a matter of time before this technology enters the 3D world.

Best Practices

ChatGPT uses an input form called "prompt", which is user input for AI. Since the quality of output depends on input, companies such as OpenAI have developed best practice guides to help improve the probability of success. Generally, adding additional context or information to the initial prompt will get a better answer, especially when ChatGPT is required to create a 3D model.

A failed attempt at generating a 3D model
Screenshot: OpenAI

If you are directly asked to create a 3D model, ChatGPT will usually respond to the above prompts and occasionally give instructions on how to use these programs to create a model. Although these steps are usually not very helpful, they do show that ChatGPT should not be based on surface value when providing response, because it can actually create 3D models. Simple original shapes such as cylinders, cubes, and pyramids are usually easy to generate, but requiring organic or complex models often leads to the above negation.

A successful generation of a triangle and the resulting mesh in Blender
Screenshot: OpenAI

Screenshot: Blender

Using ChatGPT to Directly Generate STL Files

3D geometry can be represented in the triangulated. STL file format, which is a common standard for almost all manufacturers and file repositories. If it is generated as ASCII. STL, it is also a human-readable file format, which makes it slightly easier to debug and interpret the output of ChatGPT.

The geometry of a cube in ChatGPT
Screenshot: OpenAI

An unsuccessful result
Screenshot: Blender

The resulting mesh
Screenshot: Blender

To successfully generate. STL files, it usually takes several attempts, and each attempt will gradually add more information to the grid. In the triangle example above, I asked ChatGPT to use the same format to generate cubes.

Then, it generates six faces and six triangles from the fully triangulated cube. When generating a large file, ChatGPT will stop suddenly after a certain point, but adding "Continue" as a prompt will allow it to continue from the stopped position. Using the free 3D modeling program Blender, I added missing geometry and fixed flipped faces (shown in red above).

Using ChatGPT to create a Javascript script
Screenshot: OpenAI

Cube
Screenshot: Three.js

Using ChatGPT to Generate Scripts for 3D Modeling

Another key feature of ChatGPT is the ability to create scripts to parametrically create 3D models. Using Javascript and three-js library, I can quickly generate a script to create a cube in the 3D environment by using the prompt: "Please use the generated cube and create a script using the Javascript displayed in the GUI". The script also generates a GUI that allows rotation control of the X, Y, and Z axes.

Adding an Export .STLfunction allows users to download a 3D printable file
Screenshot: Three.js

Sphere Result in Blender

By gradually increasing the complexity of the request, the script can gradually create more complex output. For example, here, the cube is replaced by a sphere, and a slider is added to control the number of segments on the sphere, so that it presents a gradually lower polygon/extraction appearance.

By adding the ". STL Export" function, you can export the final geometry to the ASCII. STL file format for 3D printing. The complete code can be found on GitHub. If you want to try it yourself, you can also use real-time build.

A 3D printed cube generated by ChatGPT
©3DWithUs Print & Photo: Andrew Sink
Featured cube model 3D printed in tri-color PLA on Elegoo Neptune 3 Pro.

Printing Models Made with ChatGPT

Programs like Blender can be used to clean and prepare these grid files for 3D printing, as shown in the video I produced. Missing triangles, flipping normals and other mesh-related problems are common, so if you want to 3D print any model generated using ChatGPT, you may need to do some manual cleaning. Models such as 3D print cubes are generated using arbitrary units. Each side is measured with a unit length. When imported into a slicer such as PrusaSlicer, it corresponds to a millimeter.

Image: OpenAI

How to Access

ChatGPT is currently available to the public and can be accessed directly through the OpenAI website. OpenAI account is required to use ChatGPT system. You can create this account with email address. Creating an account allows users to access their complete prompt history, which is a very helpful way to reflect which prompt policies are effective and which are not. Although access may be limited and the service may be interrupted for a period of time, it is still an exciting tool with great potential.

 

Reprinted from: https://3dwithus.com/how-can-chatgpt-be-used-for-3d-printing