Android Question Text to GCode CNC Machine

fernando.oliboni

Active Member
Licensed User
Longtime User
Yes I know. I have to write the codes, but I do not know how to transform a letter into an object and work with the points of that object.
 
Upvote 0
D

Deleted member 103

Guest
Yes I know. I have to write the codes, but I do not know how to transform a letter into an object and work with the points of that object.
A GCode has nothing to do with objects, it is pure text.
Here is a part of Gcode:
 
Upvote 0

fernando.oliboni

Active Member
Licensed User
Longtime User
I know how to write an NC code for machines, what I need is to transform a user-entered text of the app into Gcode. To do this, I need to find the points of the letters, I need to find the coordinates of the points of the letters that were typed.
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
It' s crazy job. Nobody do it. Any CAM software will do it for you, with any font you like ....
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
I need to find the coordinates of the points of the letters that were typed

Everybody in this thread has answered your initial question. It seems this is the question you should have asked from the very beginning.

I'm not aware of an android based solution where you can convert characters to actual coordinates, perhaps somebody else in the forum knows more about this.

If we for the moment assume it's not possible, one working solution could be including a svg file per character in your app. The user types in YOLO and you grab the files Y.svg, O.svg and L.svg and offset them according to a pre-generated character width file.

Of course, if that's the route you're interested in, there's nothing stopping you from skipping the svg step entirely and just have GCode coordinates instead. One thing that might be interesting with svg though is the ability to preview the output using the svg library from @agraham.
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
Sandman gave you the solution. Use a cad/cam software and generate a text file for each characters.
I use this solution because I can quickly generate serial number (But I just need chars from 0 to 9) without modifying the source design and build gcode everytimes.
You just need to adjust the distance from each characters (after a "I" you need less distance for example).
But is a fixed height and font solution.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
if you have already the gcode for each letter you just need to create a map with the letter as the key and the gcode output string as the object. then if the user want to engrave "B4X" just out put that string from the map.

i am a CNC programmer for almost 12 years, if you need any help in gcode let me know.

(some parts i did lately)

 
Upvote 0

ilan

Expert
Licensed User
Longtime User
the only thing you will need to calculate is the new X location after each letter. it should not be hard at all to do that. so just keep a map of all letters and their GCode and then always calculate the new X Position after each letter so you know how much to move to the left and start the new letter. you can use also a code module for that and use types that will hold a string and a letterWidth amount. string is the gcode and letterWidth is the amount to move after that letter was engraved.

EDIT: if i think about it, it would be really interesting to create such a lib for b4x
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…