Your questions are interesting but what is it you really want?
Upon reading the title
Is it possible to teach ChatGPT to write/draw knitting machine code
it seems you want to teach ChatGPT to undersatnd knitting machine code but I asked it if it knew knitting machine code and it gave a resaonable answer.
then you asked
How to teach ChatGPT to draw GUI code for knitting machine programming?
ChatGPT can not draw it can generate text that is representative of knitting machine programming and that would have to be passed to another program to generate a visual. That is similar to those of us working on math expressions.
and also asked
Or should I be looking for a Graphical AI drawing program?
From what I have seen with two prompts I gave ChatGPT that knitting machine code can be used in the prompt and it will generate a representation of knitting machine code that then needs to be handed off to an external applicaiton for creating a visual image or running to create a knitted item.
Here are two prompts I did before responding above.
Prompt
Do you know about Knitout" (.k) File Format?
ChatGPT Completion
Yes, I am familiar with the Knitout file format.
Knitout is a machine-readable file format used for specifying knitting machine instructions. It is designed to be both human-readable and machine-readable, making it easy for both humans and machines to read and interpret the instructions.
The Knitout format is essentially a list of commands that describe how the knitting machine should move the yarn carrier and needles to create a desired fabric. These commands include instructions for selecting and manipulating needles, changing yarn carriers, and controlling the tension of the yarn.
The Knitout file format was developed as part of the Textiles Lab at Carnegie Mellon University and is intended to be an open and extensible standard for machine knitting. It can be used with a variety of different knitting machines and software tools.
There are a number of tools available for working with Knitout files, including compilers that can generate Knitout code from higher-level knitting instructions, and simulators that can visualize the resulting fabric.
Prompt
Dispaly a sample for knitting with a pattern, keep the file to less than 50 lines.
ChatGPT Completion
Sure, here is an example Knitout file that specifies a simple knitting pattern:
;;Machine: Brother KH-970
;;Carriers: 2
;;Width: 20
;;Height: 20
inhook 1
x-stitch-number 5
;;cast-on
inhook 2
miss +1
knit - f20
releasehook 2
;;pattern rows
repeat 10 {
inhook 1
tuck - f19
tuck + b19
tuck - b18
tuck + f18
tuck - f17
tuck + b17
tuck - b16
tuck + f16
tuck - f15
tuck + b15
tuck - b14
tuck + f14
tuck - f13
tuck + b13
tuck - b12
tuck + f12
tuck - f11
tuck + b11
tuck - b10
tuck + f10
miss -1
knit + f19
releasehook 1
}
;;bind-off
inhook 1
miss -1
knit - f20
miss -1
knit - f19
miss -1
knit - f20
releasehook 1
This file specifies a simple pattern of X stitches across and Y rows tall, cast-on and bind-off instructions, and instructions for tucking and knitting the yarn to create a desired fabric pattern. Note that this is just a simple example and real-world Knitout files can be much more complex and varied in structure.
Reference: Visual Knitting Machine Programming