BOOK THIS SPACE FOR AD
ARTICLE ADThis is an article about using artificial intelligence (AI) as a tool and how to apply it to your unique, specialized needs. It provides some interesting lessons for everyone. I've also updated it with feedback from readers.
Also: The most popular programming languages in 2024 (and what that even means)
You'll learn you can use a tool like ChatGPT to solve complex problems quickly, so long as you have the right prompts and a hint of skepticism.
First, a brief 3D printing rabbit hole
Our context for this lesson is 3D printing. A special test in 3D printing called a 3DBenchy checks printer performance. It helps 3D printer users test speed and various print-quality measures. The Benchy takes most printers an hour or two to print out.
I recently tested a new printer that's supposed to be faster than many others. On this printer, the Benchy took 42 minutes, while on other 3D printers in the Fab Lab, it took 60 to 70 minutes. But here's the thing: the test version provided by the company that makes the printer took 16 minutes. That's a heck of a difference.
Also: The rise and fall in programming languages' popularity since 2016 - and what it tells us
3D printers are controlled with G-code, a program custom-generated by a tool called a slicer that controls how the printer moves its print head and print platform, heats up, and feeds and retracts molten filament.
The pre-sliced G-code provided by the factory for the printer I was testing resulted in a 16-minute print. The G-code I generated using the company's slicer resulted in a 42-minute print. I wanted to know why.
Unfortunately, no one on the company's support team could answer my question. Despite numerous tries, I couldn't get an answer about what slicer settings to change to get the G-code I produced using their slicer to perform as well as the G-code generated using their slicer.
Also: 6 ways to write better ChatGPT prompts - and get the results you want faster
After many web searches and reading posts from frustrated Reddit posts, it was clear that other customers had the same problem. Here's a machine capable of more than double the performance, yet none of us could reproduce that performance successfully.
Can AI help?
This is where ChatGPT comes into the picture. G-code consists of thousands of lines that look like this:
Together, both Benchy G-code files had 170,000+ lines of code. I didn't intend to spend a Saturday afternoon sifting through that stuff manually. But I thought, perhaps, AI could help.
Also: How to use ChatGPT to digitize your handwritten notes for free
I had the G-code I generated using the slicer. I could also export and save the G-code provided by the factory. Using ChatGPT Plus, I fed both files into the AI.
I started by confirming ChatGPT could read the files. After I uploaded each file, I asked:
Can you read this?
ChatGPT confirmed, stating, "I can read the contents of the file. It appears to be a G-code file, typically used to control 3D printers." That was a good start.
To ensure we were clear on which file was which, I gave ChatGPT some labels for the files:
Let's call the first file uploaded "regular print" and the second file uploaded "fast print". Okay?
The AI agreed, so then I told it:
Describe how the files differ.
Other than naming one of the files "fast print", I gave ChatGPT no indication of what I was looking for. Even so, the bot identified that one print had higher print speeds, although the temperature settings were the same.
I then asked the AI:
Why is "fast print" so much faster?
It was at this point that ChatGPT started to annoy me. Instead of giving me details from the code I provided, it speculated. The AI used phrases containing "likely", "may", and "might" to describe why the print was faster.
Also: If these chatbots could talk: The most popular ways people are using AI tools
But I had given it G-code files that described exactly what the printer was doing, so I wanted an exact answer about what the printer was doing. As is often the case with ChatGPT, the conversation was a lot like talking to a brilliant grad student who is somewhat stubborn and uncooperative.
Why the right prompt makes all the difference
I finally landed on this prompt, which teased out workable answers:
The G-code provided in both files is the only thing that is different for these prints. Using solely the G-code provided as comparisons, what slicer settings would be different? Don't speculate on what other settings might be. Base your analysis only on the code provided.
ChatGPT identified three key factors:
The regular print G-code shows feed rates typically between 2400 mm/min and 3400 mm/min. The fast print G-code shows much higher feed rates, with some commands reaching up to 14400 mm/min. This rate is a significant increase in speed, directly contributing to the reduced print time.Compared to a layer height of 0.2 mm for the regular print, the fast print set layer height to 0.25 mm, reducing the number of layers needed to complete the print.The fast print G-code includes much more aggressive acceleration settings, allowing the printer to reach higher speeds quicker and maintain them, contributing to faster printing.That result was interesting. However, I wanted to know whether the company hand-optimized the G-code or generated it directly in the slicer. So, I asked ChatGPT:
Can you tell if fast print has been hand-coded or was generated by a slicer? Perhaps look for inconsistent commands or non-standard comments.
The AI responded with three interesting considerations:
The variations in G-code commands like changes in feed rates, switching between different movement commands, and alterations in other parameters are typical of slicer-generated code. These changes are designed to optimize the print process and are consistent with the behavior of a slicer.If the G-code were hand-coded, we would expect to see more irregular and unpredictable patterns, but these transitions follow a logical sequence, characteristic of a slicer's optimization process.Therefore, the presence of these commands does not indicate hand-coding; rather, it supports the conclusion that this G-code was generated by a slicer.What these results tell me is that it is probably possible for users to modify their slicer settings to get similar performance.
Some thoughts from the comments
We've had some very active comments for this article. For the most part, I've gone in and answered questions as they came up. I encourage you to visit the comments to participate and read what other readers have to say on this topic.
Here's a quick list of some thoughts that the comments inspired:
You don't have to use AI to solve these problems. But it can be instructive to see how AI handles solving many categories of different problems, so I encourage you to use chatbots, even if just to see what they can do. Then, you'll have a tool for future use.I'm generally using ChatGPT Plus for these tests. The free version can do some of the work, but because it throttles usage after too much interaction, if I'm to get an article done on deadline, I need to have full access to the chatbot.When trying to wheedle an answer from a chatbot, I usually think of it as a talented student or employee. Sometimes, I'll even use "please" and "thank you" to keep the conversational tone going. But as anyone you talk with might get distracted or stubbornly refuse to see your point, keep trying, change up your questions, ask questions in different ways, and clarify, even when you think what you're clarifying should be obvious.Using AIs can be laziness, sure. But they can also save time. Almost anything you can do with power tools in a workshop, you can also do with hand tools. Sometimes you want to focus on the art. Sometimes, you just want to get done so you have time for three hours of sleep that night. Don't ever hesitate to use a tool if it can give you a leg up. But do keep in mind that if your work output specifically precludes the use of those tools (like we NEVER use AI to write our articles here on ZDNET), then don't use the tool.Definitely take care what you upload to the AI. Not everything is company or otherwise confidential. But some is. Most of what I upload is my own data, or, as in this case, something that's already published in the open.I don't always get the chance to respond to comments, but I try. Sometimes, people post days, weeks, or even months after the articles go up and I've moved onto other articles. But I always welcome reader comments. Because most ZDNET readers are pros, the comments are often rich with useful (if occasionally painful to read) information. I've learned a lot from ZDNET comments, and I'm sure you will, too.
What have we learned?
We've learned that ChatGPT understands G-code. That's unsurprising because, in my earliest tests, we learned that ChatGPT has a fairly good command of even the most obscure programming languages.
We also learned that ChatGPT can sift through and compare 170,000+ lines of machine instructions and reach actionable conclusions in seconds.
Also: How I test an AI chatbot's coding ability - and you can, too
Finally, we learned we can use AIs like ChatGPT to explore complex problems from several angles. Not only did ChatGPT explain the vast speed difference between the two files, but it was also able to validate whether or not the factory-provided file had been hand-tweaked.
In conclusion, don't accept what the AI tells you as absolute truth. Don't make critical decisions based on its answers. And remember that you sometimes have to negotiate with the AI before it's willing to give you helpful answers.
This test is yet another case where I've been able to turn to the AI and find an answer for a very me-specific question without coding in minutes.
If you have a question that requires a lot of text or numerical analysis, consider running it by ChatGPT or one of the other AIs. You might get a useful answer in minutes.
Also: Midjourney's AI-image generator website is now officially open to everyone - for free
Writing this article about the problem took me a few hours. The actual analysis process, from start to finish, took me less than 10 minutes. That's some serious productivity, right there.
You can follow my day-to-day project updates on social media. Be sure to subscribe to my weekly update newsletter, and follow me on Twitter/X at @DavidGewirtz, on Facebook at Facebook.com/DavidGewirtz, on Instagram at Instagram.com/DavidGewirtz, and on YouTube at YouTube.com/DavidGewirtzTV.