Click here to Skip to main content
15,925,255 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi
My name is Arsalan and I'm a BSc student in electronics, making a CNC machine as a university project. My hardware is almost ready, what bothers me is the program. My task is to make a program which takes alphanumeric characters and generate its g code. Initially I was thinking of using some ready made program, which are quite easy.

In the last meeting with my teachers they give us a condition to learn to develop your own program which can generate g code..

I know a little bit of VB, but I can learn. If you tell me that it is possible that we can write a program in VB for G-Code.

Please give me some advice i really need your help..

u can mail me at [Email Deleted]

[edit]Email address deleted[/edit]
Posted
Updated 1-Aug-10 6:02am
v3
Comments
OriginalGriff 1-Aug-10 10:12am    
Never post your email address in any forum, unless you really like spam! If anyone replies to you, you will receive an email (like this one) to let you know.

I've never done any of this before, hopefully someone will have experience of CNC.
Anyway, I took a look at the Wikipedia page on G-Code.

G-code

It does look possible to write an interpreter to take some input and translate it into g-code. You face two problems:

  1. Can you write a clearer language than g-code:- The answer is almost certainly yes. Wikipedia even gives you a head start, for example you can simply replace M07 with CoolantOnMist and M08 with CoolantOnFlood for example, and just do a replace.
  2. You have the proble of checking the program symantically. e.g. if the program starts the coolant, does the program end the coolant. It the lathe spindle stopped before the program finishes? Does the program do anything that will damage the lathe or prevent the lathe from working?

You could almost create a database (or XML definition???) of friendly names versus G-Code codes. This would immediately resolve point 1. Point 2 is more difficult, it depends how much time and effort you are willing to put in.

I found some free CNC simulators, I don't know how good they are, but they should help you test your generate code before it touches the hardware:
http://www.cncsimulator.com/[^]
 
Share this answer
 
thx for ur comment

bt my task to develop a software which can generate g code..
jst like that software

http://www.cnc.yertiz.com/text2.htm
 
Share this answer
 
I thought you wanted to make g-Code simpler to write.
The example program is possible to write (the people at the website managed!), but I'd have to work through the problem for quite some time to be able to help.

In general I'd say:
1. Create a standard start g-code script that starts moves the tool start position, starts cooling etc.
2. Move the bit over the job as required, you can use the the x-y cordinates of the graph (scaled to real size) to guide the tool (or bit I'm assuming here). I don't know if the g-code can draw geometric shapes (such as circles directly). If so, you need to represent this in you VB program by having a circle tool etc.
3. You can increase the sophistication of the program by having different colors when the bit is above the job, or when it is cutting the surface.
4. Create a standard start g-code script that stops cooling, stops the bit spinning and moves it away from the job.


My dad was a time-served toolmaker BTW. (Though he teaches science now).
 
Share this answer
 

ok once again i appreciate ur effort although u r not very familiar with g code.

i just want a guide line to generate g code by making my own software in VB or jave.

it can only be answer by whom who did this before i hope somebody soon pull me out of this trouble.
 
Share this answer
 
Comments
Christian Graus 1-Aug-10 16:23pm    
The button you keep pressing has 'answer' written on it, yet you're not posting answers. See what I did ? I am not posting an answer, but commenting on a post, so I pressed the 'comment' button. Please also do not use txt speak, you have a full keyboard in front of you, and you're not in a room full of children. It just makes you look dumb. Your teachers condition is that you learn something. You appear to be sidestepping that, and asking us to tell you how to do it. I think you've got more help than you should expect, when you're asking us to do your homework for you. You should try to do your own work and ask SPECIFIC questions when you get stuck.
Keith Barrow 1-Aug-10 17:59pm    
You are very unlikely to get a guide to writing g-Code from VB, I doubt many people have used it here. It tends to be lathe operators etc who use it and the intersection of the set lathe operator and .net programmer is probably pretty small. You might strike lucky and get a better answer than mine, but I suggest you try to write your own code, as a response will probably be slow.
arzoo105 2-Aug-10 10:05am    
well i never prefer done my work by others because they will not produce my standard work..

guyz jst i want to know the theory behind the g code generation not the code

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900