How I used ChatGPT to scan 170k lines of code in seconds and save me hours of detective work

Must Read
bicycledays
bicycledayshttp://trendster.net
Please note: Most, if not all, of the articles published at this website were completed by Chat GPT (chat.openai.com) and/or copied and possibly remixed from other websites or Feedzy or WPeMatico or RSS Aggregrator or WP RSS Aggregrator. No copyright infringement is intended. If there are any copyright issues, please contact: bicycledays@yahoo.com.

That is an article about utilizing synthetic intelligence (AI) as a device and the right way to apply it to your distinctive, specialised wants. It offers some fascinating classes for everybody.

You may be taught you should utilize a device like ChatGPT to unravel complicated issues rapidly, as long as you’ve the proper prompts and a touch of skepticism. 

First, a short 3d printing rabbit gap

Our context for this lesson is 3D printing. A particular take a look at in 3D printing referred to as a 3DBenchy checks printer efficiency. It helps 3D printer customers take a look at velocity and varied print-quality measures. The Benchy takes most printers an hour or two to print out.

I not too long ago examined a brand new printer that is purported to be quicker than many others. On this printer, the Benchy took 42 minutes, whereas on different 3D printers within the Fab Lab, it took 60 to 70 minutes. However this is the factor: the take a look at model offered by the corporate that makes the printer took 16 minutes. That is a heck of a distinction.

3D printers are managed with G-code, a program custom-generated by a device referred to as a slicer that controls how the printer strikes its print head and print platform, heats up, and feeds and retracts molten filament.

The pre-sliced G-code offered by the manufacturing unit for the printer I used to be testing resulted in a 16-minute print. The G-code I generated utilizing the corporate’s slicer resulted in a 42-minute print. I wished to know why.

Sadly, nobody on the corporate’s assist staff may reply my query. Regardless of quite a few tries, I could not get a solution about what slicer settings to vary to get the G-code I produced utilizing their slicer to carry out in addition to the G-code generated utilizing their slicer.

After many net searches and studying posts from pissed off Reddit posts, it was clear that different prospects had the identical downside. This is a machine able to greater than double the efficiency, but none of us may reproduce that efficiency efficiently.

Can AI assist?

That is the place ChatGPT comes into the image. G-code consists of hundreds of strains that appear like this:

G1 X122.473 Y140.422 E4.23368
G1 X122.222 Y140.6 E4.24443
G0 F14400 X122.703 Y140.773
G1 F3600 X122.117 Y141.251 E4.27083
G1 X121.767 Y141.66 E4.28963
G1 X121.415 Y142.139 E4.31039
G1 X121.105 Y142.641 E4.33099

Collectively, each Benchy G-code information had 170,000+ strains of code. I did not intend to spend a Saturday afternoon sifting by way of that stuff manually. However I assumed, maybe, AI may assist.

I had the G-code I generated utilizing the slicer. I may additionally export and save the G-code offered by the manufacturing unit. Utilizing ChatGPT Plus, I fed each information into the AI.

I began by confirming ChatGPT may learn the information. After I uploaded every file, I requested:

Are you able to learn this?

ChatGPT confirmed, stating, “I can learn the contents of the file. It seems to be a G-code file, sometimes used to manage 3D printers.” That was a great begin.

To make sure we had been clear on which file was which, I gave ChatGPT some labels for the information:

Let’s name the primary file uploaded “common print” and the second file uploaded “quick print”. Okay?

The AI agreed, so then I instructed it:

Describe how the information differ.

Apart from naming one of many information “quick print”, I gave ChatGPT no indication of what I used to be searching for. Even so, the bot recognized that one print had increased print speeds, though the temperature settings had been the identical.

I then requested the AI:

Why is “quick print” a lot quicker?

It was at this level that ChatGPT began to bother me. As an alternative of giving me particulars from the code I offered, it speculated. The AI used phrases containing “probably”, “could”, and “would possibly” to explain why the print was quicker.

However I had given it G-code information that described precisely what the printer was doing, so I wished an actual reply about what the printer was doing. As is usually the case with ChatGPT, the dialog was so much like speaking to an excellent grad pupil who’s considerably cussed and uncooperative.

Why the proper immediate makes all of the distinction

I lastly landed on this immediate, which teased out workable solutions:

The G-code offered in each information is the one factor that’s totally different for these prints. Utilizing solely the G-code offered as comparisons, what slicer settings could be totally different? Do not speculate on what different settings could be. Base your evaluation solely on the code offered.

ChatGPT recognized three key elements:

  • The common print G-code reveals feed charges sometimes between 2400 mm/min and 3400 mm/min. The quick print G-code reveals a lot increased feed charges, with some instructions reaching as much as 14400 mm/min. This fee is a major improve in velocity, immediately contributing to the diminished print time.
  • In comparison with a layer top of 0.2 mm for the common print, the quick print set layer top to 0.25 mm, lowering the variety of layers wanted to finish the print.
  • The quick print G-code contains far more aggressive acceleration settings, permitting the printer to achieve increased speeds faster and preserve them, contributing to quicker printing.

That end result was fascinating. Nevertheless, I wished to know whether or not the corporate hand-optimized the G-code or generated it immediately within the slicer. So, I requested ChatGPT:

Are you able to inform if quick print has been hand-coded or was generated by a slicer? Maybe search for inconsistent instructions or non-standard feedback.

The AI responded with three fascinating concerns:

  • The variations in G-code instructions like modifications in feed charges, switching between totally different motion instructions, and alterations in different parameters are typical of slicer-generated code. These modifications are designed to optimize the print course of and are according to the conduct of a slicer.
  • If the G-code had been hand-coded, we’d count on to see extra irregular and unpredictable patterns, however these transitions observe a logical sequence, attribute of a slicer’s optimization course of.
  • Due to this fact, the presence of those instructions doesn’t point out hand-coding; reasonably, it helps the conclusion that this G-code was generated by a slicer.

What these outcomes inform me is that it’s most likely attainable for customers to switch their slicer settings to get related efficiency.

What have we realized?

We have realized that ChatGPT understands G-code. That is unsurprising as a result of, in my earliest exams, we realized that ChatGPT has a reasonably good command of even probably the most obscure programming languages.

We additionally realized that ChatGPT can sift by way of and examine 170,000+ strains of machine directions and attain actionable conclusions in seconds.

Lastly, we realized we will use AIs like ChatGPT to discover complicated issues from a number of angles. Not solely did ChatGPT clarify the huge velocity distinction between the 2 information, but it surely was additionally in a position to validate whether or not or not the factory-provided file had been hand-tweaked.

In conclusion, do not settle for what the AI tells you as absolute reality. Do not make important choices primarily based on its solutions. And do not forget that you typically have to barter with the AI earlier than it is keen to present you useful solutions.

This take a look at is one more case the place I have been in a position to flip to the AI and discover a solution for a really me-specific query with out coding in minutes.

In case you have a query that requires a whole lot of textual content or numerical evaluation, think about operating it by ChatGPT or one of many different AIs. You would possibly get a helpful reply in minutes.

Writing this text about the issue took me a number of hours. The precise evaluation course of, from begin to end, took me lower than 10 minutes. That is some critical productiveness, proper there.


You possibly can observe my day-to-day mission updates on social media. You’ll want to subscribe to my weekly replace e-newsletter, and observe me on Twitter/X at @DavidGewirtz, on Fb at Fb.com/DavidGewirtz, on Instagram at Instagram.com/DavidGewirtz, and on YouTube at YouTube.com/DavidGewirtzTV.

Latest Articles

More Articles Like This