This one is for you Arty

Feel free to talk about anything and everything in this board.
Post Reply
Old Timer
Posts: 75
Joined: Sun Sep 27, 2015 3:23 am

This one is for you Arty

Post by Stojan »

I don't know if your into the whole Ai thing, but MS Google etc are all working on Artificial Intelligence being able to ask a question and having the computer spit out the answer.

I just fell over the OpenAi Chatgpt.. and nearly fell over.

One of the questions I asked it and the answer it gave me, now not being a coder I wouldn't know if it was giving me a recipe for sushi..

Arty are you in danger of becoming jobless LOL...???

I asked it the following : code in C++ for generating gears

Then it gave me

Here's an example code in C++ using OpenGL for generating a spur gear:

Copy code
#include <GL/glut.h>
#include <cmath>

const double pi = 3.14159265358979323846;

// Number of gear teeth
const int teeth = 20;

// Pitch diameter of gear
const double pitch_diameter = 1.0;

// Angle between gear teeth
const double tooth_angle = 2 * pi / teeth;

// Width of gear tooth
const double tooth_width = 0.1;

// Depth of gear tooth
const double tooth_depth = 0.2;

// Number of vertices in gear
const int vertices = 2 * teeth;

// Gear vertex array
GLfloat gear_vertices[vertices][3];

void generate_gear()
for (int i = 0; i < teeth; i++) {
double angle = i * tooth_angle;
double x = (pitch_diameter / 2) * cos(angle);
double y = (pitch_diameter / 2) * sin(angle);
gear_vertices[2 * i][0] = x - (tooth_width / 2) * sin(angle);
gear_vertices[2 * i][1] = y + (tooth_width / 2) * cos(angle);
gear_vertices[2 * i][2] = 0.0;
gear_vertices[2 * i + 1][0] = x + (tooth_width / 2) * sin(angle);
gear_vertices[2 * i + 1][1] = y - (tooth_width / 2) * cos(angle);
gear_vertices[2 * i + 1][2] = 0.0;

void draw_gear()
for (int i = 0; i < vertices; i++) {

glVertex3f(0.0, 0.0, 0.0);
for (int i = 0; i <= vertices; i++) {
glVertex3fv(gear_vertices[i % vertices]);

void display()

gluPerspective(60.0, 1.0, 0.1, 10.0);
glTranslatef(0.0, 0.0, -3.0);
glRotatef(45.0, 0.0, 1.0, 0.0);

glColor3f(1.0, 1.0, 0.0);


int main(int argc, char** argv)

glutInit(&argc, argv);
glutInitWindowSize(640, 480);

return 0;
This code uses the GLUT library for creating an OpenGL window and rendering the gear. The gear is defined by the number of teeth, pitch diameter, tooth angle, tooth width, and tooth depth. The generate_gear() function generates an array of vertices that define the gear shape, and the draw_gear() function uses OpenGL commands to draw the gear.
User avatar
Global Moderator
Global Moderator
Posts: 4533
Joined: Sun Sep 05, 2010 6:14 am

Re: This one is for you Arty

Post by ArtF »


Amazing isn't it. I have been using ChatGPT for a few weeks. I'm in the process of adding a cad module to
Ticker so one can quickly draw items for simulation. This means I had to share the Ticker single doc system
so it has multiple views. When I installed a command macro system for the new view in an object owned by
that view, the commands wouldn't get called. So I had a conversations with ChatGPT about it..

I didn't keep the conversation, but it went something like this..

ME: I have a CView that owns a class object and I want that views commands to be sent to that new
object class, what should I do. When I implement a Command macro it seems to get ignored.

ChatGPT: You need to redirect the message from the CView class to your object conatined by
that class by using code that does this..

BOOL CMyViewClass::OnCmdMsg(UINT nID,
int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
if( MyClassObject.OnCmdMsg(nID, pExtra, pHandlerInfo) )
return TRUE;
return CMyViewClass::OnCmdMsg(nID);

ME: Isn't the OnCmdMsg routine a protected routine and therefore inaccessible in the class object
so I cannot call it that way?

ChatGPT: Yes, that routine is inaccessible due to being private, you will have to make a redirection by
using code such as this..

BOOL CMyViewClass::OnCmdMsg(UINT nID,
int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
if ( MyClassObject.HandleCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
return CMyViewClass::OnCmdMsg(nID);
and in your object class

BOOL MyClassObject::HandleCmdMsg(UINT nID, int nCode, void* pExtra,
return OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);

Me: Yes, that looks right.

I then installed that code and it worked great. This is the type of question a programmer
thinks of a few times a day as some of the command redirects and such are not something
you easily memorize. I suspect it saved me an hour or more of web searching.
You'll notice it didn't get it right on the first try, but when prompted to recognize its
mistake it did so and correctly spat out the answer.

I then told it I had a 2 line LED display and an Arduino Due, and could it write a menuing program
to fill 3 important variables with each variable having an appropriate range on its input. I
gave the ranges and it wrote the program. The program was skeletonized, but worked as a
framework, though with many routines such as
void GetInput()
//do input here

I recognized some of the code it fed me, I knew it was GitHub code for the same thing,
but I was amazed it could contextualise it so well. ChatGPT and its ilk is about to change us
a very great deal. If I had a kid, Id buy him or her a subscription at some point. I find myself
having conversations with ChatGPT on many subjects. As a self taught programmer,
I dont have any peers that know what Im talking about when I have a problem.
ChatGPT has already changed my thinking on a few topics.

As another example of how useful this AI is for kicking ideas around. Consider this real
situation I had this week. I was contemplating a small arduino driven device, 3d printed,
that could use two fans, one to create a cloud of colored chalk in a chamber with two doors,
one to black chalk, the other to white chalk. By controlling the two doors I wondered if I could
quickly change the color of the cloud from black to white using the two doors on the chamber
as a second fan blew air through the chamber and out a tube of 1/8" diameter to stick chalk
to a wall the device is pointed at. I could then draw in chalk by moving this device in one way
or another to draw chalk art.

What I remember of the conversation:

Me: Can I drive a cloud of chalk through a tube using laminar flow>

ChatGPT: Yes, <long explanation of the math of laminar flow> ... for a speed of 1500ft/min with 2.5PSI
pressure drop. Use a straight long piece of rod, very smooth.
Me: Can I then make the chalk stick to a wall its pointed at made of concrete?

ChatGPT: Yes, but performance will depend on the walls properties as the chalk will stick only
to disturbances in the flatness of the wall.

Me: Could I enhance this by charging the chalk as it exits the device by perhaps passing
if though a high voltage screen?

ChatGPT: No, a charge will not help, the chalk will only stick through a principle of Adhesion.
Adhesion is < long explanation of the science of adhesion >. If the particles of chalk are too small,
they will not stick , and if too large the same will occur due to clumping. A 1 micron assumed particle
size would stick depending on the walls properties.

Me: Amazing. Thanks for the formulas on laminar flow.

Your welcome, Im happy to help, ask me anything.

So yeah, color me completely amazed. ChatGPT is already affecting my life. If you
have an idea for as gizmo, its like having a professor sitting beside you that you
can bounce ideas' off of. Its a surprising personal relationship you can build, I think
of my ChatGPT as "Frank"...

Old Timer
Posts: 80
Joined: Sun Oct 26, 2014 4:41 am

Re: This one is for you Arty

Post by BMeyers »

way cool. thanks to OP and to Art.
Old Timer
Posts: 75
Joined: Sun Sep 27, 2015 3:23 am

Re: This one is for you Arty

Post by Stojan »

I was using chatgpt and asking it to make some code so I could use a Rino Reduction Gearbox 30:1 as an indexer to cut gears. I just recently bought my self a mini lathe, after a couple of weeks of rectifying various things on it cleaning it up it was ready to go.

I thought well maybe I could attach this Rino gearbox to the lathe and give it a try. The unit I have is the same as this exception that I have some mini jaws fitted to it.
I was searching for something else and came across this guy on youtube.
Someone has already done it, I don't have to build what he has as the rino matches what he has there.

Thought I would share this with you guys here and see what you think. You can get the code and instructions from here and see what its about on the youtube channel.

Would love your opinion on the arduino indexer..

As for ChatGpt, it truly is incredible, I've been writing a book on and off for the last 4 or so years. I pick up the writing when the mood strikes me but I thought I would pass some things through GPT. Well I tell you what, its pretty hard not to use it. For research its amazing I don't have to wade through pages of articles to get to where I want to be.

I forgot myself for a minute and wrote something to it in Serbian, I wasn't thinking as the question was for someone overseas regarding our family tree.
The blessed thing replied to me in Serbian, all the accents were there correctly for the Serbian alphabet and I couldn't fault its grammar.

I asked it then to write something in Farssi lets see how many languages it can use, a good friend of mine is from Iran and he emailed me back and said it was perfect.

I got even more creative so I gave it some details and asked for it to write a poem for my lovely wife.
Well it did, my wife was all clucky and sweet and said how creative and thoughtful I was and that the poem was beautiful. Well until I told her that it wasn't me and the AI did it. Sorta killed the mood lol.

My son lectures at a university accounting, and he is using it to free up time coming up with questions and templates for various tests and exams.

I feel so in the middle of Star Trek - all we need to do now is to be able to talk to it. Computer Earl Gray tea please and have it make one for us LOL.

My son loves the tool, but he is now seeing that some of his students are using it as well. Problem is the language and written essays they have been submitting the language skills used are above his students. Nobody is admitting to anything.

It passes the plagiarism tests for writing as well.

Its going to create a problem for some educational institutions but its going to be an amazing tool to use for many researchers.

It is amazing to know that the code it is giving you with some conversation and prompting is usable. If you can save an hour and not have to dig through pages of code yourself, well that's an hour you can use to sleep in or do other things.

For the computer illiterate (I say that affectionately) rather than trying to find help yourself you can use real language and get an answer.

You are absolutely right, it is like having a professor sitting next to you.

Cheers and avagreatday
greetings from the colonies downunder.
User avatar
Global Moderator
Global Moderator
Posts: 4533
Joined: Sun Sep 05, 2010 6:14 am

Re: This one is for you Arty

Post by ArtF »

>>Would love your opinion on the arduino indexer..

He's a guy doing as I would, so I wont say its brilliant as I'm in no way brilliant, and that's the point.
It is soooo easy now to make things from arduino's and ESP32's ( my favorite as they have wifi built in..).
I keep a bin of various arduinos' esp32's and button/display boards for when I feel inventive. This project
looks very good, I'm impressed.

Once, it had a not too steep learning curve, but with an arduino, a button board and a few hours of
asking the professor GPT sitting beside you, anyone can build an arduino type of project. For a person
willing to learn, the world just got better. I typically spend tens of hours a week just searching for info,
and that's shrinking quickly as I zoom in with Chat to the source I want or need.

Its going to be an interesting world if we can survive it...

Old Timer
Posts: 75
Joined: Sun Sep 27, 2015 3:23 am

Re: This one is for you Arty

Post by Stojan »

I hear you Art,

The world has gotten smaller very quickly and in the same time bigger as well.

Myself personally, the day I saw the first episode of star trek with good old Kirk and Spocky. Talking to the computer having it do the hard yards and spitting out an answer. I couldn't be happier.

I had an interesting thought which I put to GPT, what if I author a book using chatgpt, it gave me all the reasons why I would retain copyright, I just wonder if the owners will be as generous.

I have drawers full of ardruinos and various addons, I just recently added the raspberry pi 4 to the stable as well. I want to automate my telescope so I don't have to fight with the mosquitoes and bugs point and click all within the safe confines of my lounge LOL..

Looking forward to seeing what a clever coder will come up with next.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest