Is it possible to teach ChatGPT to write/draw knitting machine code

How to teach ChatGPT to draw GUI code for knitting machine programming?
Or should I be looking for a Graphical AI drawing program?

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.


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.


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

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

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

Hi Guys and AIs, this replay is to all of you.
Do I know about Knitout? no, not in any detail. Yes, I should spend some time catching up.
I have been programming industrial knitting machines since 1987. The first was with punched paper tape then onto a GUI that wrote the machine code for you. The on to the Raynen KnitCAD in 2019 and various version updates up to today.
The primary issue is the user manuals are either not written or are translated in an unhelpful way.
So I want lots of things.
And the questions you have kindly responded to are my first attempt to get acquainted with ChatGPT.
The next step for me to undertake is to have a close look at some of the compiled files I load into the knitting machine (Longxing KSC093DC) which I believe were compiled by a C/C++ compiler.
This would suggest my next question for ChatGPT will be along the lines of “how do I read C/C++ compiled files?”.
Thanks for all your suggestions and best regards, Alex 1759 (1759 is the registered number of my sailing dinghy, which I go sailing in when I need time to think about difficult topics :-)).

1 Like

Hi @alex1759

Let me caution and advise you that ChatGPT is just a powerful text generator. It is a language model which takes a sequence of text and generates the next sequence of text based on probabilities within a large language model.

This means that ChatGPT can generate a lot of great sounding text, but the accuracy is generally very poor, especially for large / long technical responses.

You @alex1759 must carefully verify any knitting machine code generated by ChatGPT.



Hi Ruby
Thanks for your words of caution. And they are duly noted.
I think I should try to see what happens when I ask questions that can be answered with words?
Thanks again and best regards, Alex 1759

Of course you should experiment and enjoy!

Words, code, instructions, formulas, math. technical data, whatever…

ChatGPT is a text completion engine which just “makes things up” based on its prediction engine in it’s large language model, a few tokens at a time.

So, it has “zero idea” what it is doing or anything about the tech it is doing, it’s just a LANGUAGE MODEL. It is not an expert system AI.

So ChatGPT can generate very elegant text in a very confident way. This applies to words, code, formulas, programming language methods, etc.

This means that if you are writing fiction or anything which does not require technical accuracy, you don’t have to worry about accuracy. It’s a language model just generating text.

HOWEVER, if you are generating something which must be technically accurate, like a computer program or a knitting machine code pattern, etc you CAN NOT trust what ChatGPT generates. You must verify it.

You might get lucky and get something close to accurate especially on some short completion, but in general, the longer the completion, the more ChatGPT will “wonder off course”.

It’s simply the nature of how LLMs work.

They are “language generating assistants which must be checked and verified”. It’s that simple.

Enjoy BUT verify.