Skip to content

Generate a screen with an AI assistant

Have Claude or ChatGPT generate an HMI Forge screen

A screen generated by ChatGPT from a written request, imported and run on the pendant.

We can teach LLMs how to create HMI Forge documents directly, allowing it to create screens and tags and position buttons, indicators, labels, images, etc. The LLM will generate a legitimate HMI Forge document which you can import via USB. This can give you a big head-start on creating your perfect HMI.

The prompt lives at https://hmiforge.onerobotics.com/docs/llms-full.txt. It holds the rules a model needs, the schema of the format, and two complete example documents. There are two ways to hand it over:

  • By link. Start the conversation with “Read https://hmiforge.onerobotics.com/docs/llms-full.txt, then build me a screen for …” This works with an assistant that can fetch a web page, such as Claude or ChatGPT with browsing on.
  • By paste. Download the file and paste its contents as the system prompt or the first message, then describe the screen in the next one. It is about 25,000 tokens, which fits every current assistant.

The first line of the prompt names the HMI Forge version it describes. Match it to the version in the editor’s top bar: a document written for a newer release may use settings an older editor does not read.

If an assistant tells you it never saw a theme, its fetch stopped before the end of the prompt. Paste https://hmiforge.onerobotics.com/docs/theme-presets.json into the conversation and ask again, or apply the preset from the editor’s Theme panel after import; it is the same palette.

Say what the screen is for and what is on the controller. The more addresses you give, the less the assistant guesses:

Read https://hmiforge.onerobotics.com/docs/llms-full.txt, then create an HMI
document named "Bike Assembly" in portrait orientation. It should use a
screen select register called "r_step" bound to R[1]. The main screen is
screen number 0. Use the FANUC theme. The main screen has our logo
(logo.png) at the top, centered. Below that, a bold label that says "CRX
Bike Assembly." Below that, two buttons: "Cycle Start" and "Confirm Step".
The cycle start button runs the BIKE_ASSY program and is primary color. The
confirm step button sets the "step_confirm" tag bound to F[1] to false. The
confirm button is disabled when F[1] is false. At the bottom of the screen
is an image of a bike "step1.png".
There are 4 other screens: Step 1, Step 2, Step 3 and Step 4. Step 1 is
screen number 1, Step 2 is screen number 2, etc. These screens are
identical to the Main screen, except for a couple of additions. Step 1 has
a label beneath the cycle start/confirm step buttons that says "Install
Seat". It then has an image below that of a seat "seat.png" but above the
bike image at the bottom "step1.png". Step 2 is similar, but the label says
"Install Pedals" and the image will be "pedal.png". The bottom image is
"step2.png". Step 3 is similar, but the label says "Install Front Wheel"
and the image will be "wheel.png" and the bottom image is "step3.png". Step
4 is similar, but the label says "Go Ride!" and there is no 2nd image. The
bottom image will be of a completed bike "step4.png". Make sure that the
bottom image is the same size and position on all 5 screens.

Say portrait or landscape, name the program a Start button runs (or tell it to create a dropdown of TP programs that selects the active_program), give addresses as DO[5], DI[101], R[12], F[2], name a theme from the Theme panel, and name image files you will import. Anything you leave out, the assistant fills with a placeholder and says so in one line after the document. Addresses are the thing to check: a tag that says DO[5] is a guess until you confirm it in the Tags panel.

The reply is the whole document, as a .hmi file to download when the assistant can make files, otherwise inside a code block. Ask for changes the same way you would ask a colleague: “make the counter bigger”, “add a settings screen with a Back button”, “put the alarms on a stack light at DO[20] and DO[21]”.

  1. Put the .hmi file on a FAT32 stick. If the assistant answered with a code block instead of a file, save the reply as a file ending in .hmi. Not .json: the controller does not list files with a four-character extension, so Import never sees one. The first and last lines of such a reply are the code fence, three backticks with json after the first; on 1.13.0 and earlier delete both lines before saving. Later versions read through them.
  2. Insert the stick, open the Documents panel, and press Import, as in USB import & export.
  3. Press Validate. If it lists issues, paste them back to the assistant, ask for a corrected document, and import again.
  4. Open the document in the runtime and press every button once. A Start button runs a real program.

Pictures are imported from the Images panel after the document. A file you named in the request is already wired to its Image control; import it under that name, in lowercase. One you did not name has an empty Image control waiting for a file. See Image.

Validate reads the whole document: every name in an expression, every navigation target, every control’s position on the page, and every tag. The mistakes an assistant makes most are all reported: a tag name where an id belongs, a system value declared as a tag, a button that writes to an input, and two tags on one address. What it cannot know is whether DO[5] is really the clamp. Open the Tags panel and read the addresses against the cell’s I/O list before the screen goes on the floor.

  • USB import & export: the import step in full.
  • Tags: what every address means.
  • Expressions: the conditions the assistant writes for you, if you want to adjust one by hand.