Programming a Computer Numerical Control Machine with GPT-4

The latest version of GPT-4, now being made available to ChatGPT Plus and Enterprise subscribers (I just got access two days ago), includes the ability to submit images along with prompts and generate images from descriptions using DALL·E 3. YouTuber CamInstructor tried submitting dimensioned 2D drawings to ChatGPT and requesting it to write a G-code program to make the part on a computer numerical control (CNC) machine tool.

G-code is not a description of the geometry of a part, but rather instructions to the machine tool such as tool selection, spindle speed, positioning, drill depth, material feed, and coolant flow. G-code programs are usually generated by computer aided design and manufacturing software, but can be hand-tweaked by a machinist or CNC programmer for better results and/or faster fabrication.

It is simply stunning to see GPT-4 read mechanical drawings and infer how to make the part. It still, however, has difficulty with elementary arithmetic.


This is very nice. The impressive thing is that it can read a simple dimensioned drawing and make sense out of it. Although it doesn’t really comprehend circles yet.

The first problem, drilling four holes, matches this homework problem on Chegg.. Compare that with the video, and it becomes clear where the first answer came from.

The input drawing does not indicate the thickness of the material. The G-code generated assumes it needs to go to -0.5 in Z, which is a value that ChatGPT 4 made up. The Chegg homework assignment has a material thickness of 0.5 inch, so that’s probably where it got the number.

So what we have here is something smart enough to plagiarize homework, but not to understand the problem.


This is basically what I said yesterday in an 𝕏 exchange with Philip Rosedale (founder of Second Life).


Just a few hours later, I asked GPT-4:

What are the ten most important court decisions from 1960 through the present regarding loss of U.S. nationality?

and it replied:

The topic of loss of U.S. nationality (or expatriation) is a complex one, and numerous court decisions have tackled various aspects of the issue over the years. From 1960 to the present, the following is a list of important U.S. court decisions that have addressed the topic. Keep in mind that while some of these cases may not exclusively focus on loss of nationality, they have significant implications for the subject:

  1. Afroyim v. Rusk (1967): The Supreme Court held that the 14th Amendment prevents Congress from revoking citizenship without the citizen’s assent. In this case, Beys Afroyim, who had voted in an Israeli election, had his citizenship revoked. The Court ruled it unconstitutional, thereby overturning an earlier decision (Perez v. Brownell, 1958).
  2. Kawakita v. U.S. (1952): While this case was decided slightly before 1960, it’s crucial for understanding the context. The Supreme Court upheld the conviction of a dual U.S.-Japanese citizen who committed treason against the U.S. during WWII. The Court found that a dual citizen owes allegiance to both countries and can be punished for treason against the U.S.
  3. Vance v. Terrazas (1980): The Supreme Court held that to lose U.S. citizenship, a person must intend to relinquish it, and not merely perform a potentially expatriating act like swearing an oath to another country.
  4. Rogers v. Bellei (1971): The Court upheld a law that required certain U.S. citizens born abroad to reside in the U.S. for a specific period to retain their citizenship. It distinguished between 14th Amendment citizenship (by birth or naturalization in the U.S.) and statutory citizenship (by birth abroad to American parents).
  5. Miller v. Albright (1998): This case challenged the provisions of U.S. law that set different residency requirements for U.S. citizen fathers and mothers to transmit citizenship to their children born abroad. The Court did not settle the issue entirely, with justices being divided on the matter.
  6. Nguyen v. INS (2001): Following the themes in Miller, the Court upheld the different requirements for unwed U.S. citizen fathers to transmit citizenship to their children born abroad, compared to the requirements for U.S. citizen mothers.
  7. Kennedy v. Mendoza-Martinez (1963): Although this case was more about avoiding military draft than expatriation, the Court’s decision implicitly affirmed the Afroyim ruling. The Court found that statutes that automatically divested dodgers of their citizenship were punitive and violated the Fifth and Sixth Amendments.
  8. Reid v. Covert (1957): This case dealt with the rights of U.S. citizens abroad, especially those facing trial by U.S. military tribunals. The Court held that U.S. citizens retain their constitutional rights when abroad.
  9. Trop v. Dulles (1958): The Court found that denationalization as punishment for desertion from the military was unconstitutional and amounted to cruel and unusual punishment.
  10. Schneider v. Rusk (1964): The Court ruled against a law that revoked the citizenship of naturalized U.S. citizens for residing in their country of origin for more than three years. It was seen as a discriminatory practice.

While these cases provide a comprehensive view of the major developments in the realm of loss of U.S. nationality, there have been other significant cases and evolving discussions on the topic, especially in the context of the war on terror and the status of U.S. citizens involved in terror activities against the country. It’s always a good idea to consult legal experts or current legal literature for an exhaustive understanding.

This saved me about a hour finding a book which I happen to have but haven’t looked at since around 1995 and digging through it for the relevant information, and wouldn’t have covered cases since its publication in the early 1990s.