Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: babinda01 on April 19, 2011, 07:16:35 PM
-
Hi Guys,
I am trying to find a way write a gcode program so that I can engrave a row of text on my part. At the moment I use the 'write' wizard to creat my engraving gcode which I then cut and paste into my main program. But I am wanting to find a much cleaner solution, can I somehow call the relevant write macro from within the gcode program somehow? ie G00 X0 Y0 Z0, M750 "FRED WAS HERE". All my engraving is the same font, same size, same seperation etc, just the text itself changes, and the position where the text is written. Does anyone have any thoughts on how I can do this?
Thanks for your help
Andrew
-
There are solutions depending on what sort of program you are using to draw your part.
You can of course import your dxf file into LazyCam and then use the text function in LazyCam to write your text.
I use DeskEngrave a free program from www.DeskCAM.com to write my text to a DXF file then import that dxf file into a drawing I have created with CADX11 (another free-be, but if you get really serious you will want to upgrade - its cheap!). The file is then saved as a DXF and imported into the G-code producing program you are using. Works with both LazyCam and D2NC.
If the part you want to engrave has already been made you can have DeskEngrave produce a G-code that you may be able to use in Mach3. I have never used that option since the part I am making and the engraving have been designed together. But the code appears to be Mach3 friendly.
CADX can be found at http://www.graytechsoftware.com/
D2NC is an inexpensive program ($79.00) although you can download a complete free trial program. It does take some practice before being easy to work with, but I really like it.
D2 can be found at http://www.d2nc.com/index.html
AutoCad does not like the dxf files that DeskEngrave creastes and will not create a usable DXF file
Bob @BobsShop - Is not affiliated with DexkCam, CadX, LazyCam, AutoCad, Mach3 or any other entity!
-
Hi Bob
Thanks for the reply, I was wanting to define my engraving at the gcode level, so that it is done at runtime, by running a macro possibly. I don't want to use any external tool to generate my engraving code.
Thanks for your input.
Andrew
-
What are you using to compile your g-code? If you would like to attach a copy of a dxf and tell me what text you want to appear where, I will demonstrate what can be done with the programs I mentioned. May or may not be what you are looking for.
Bob@BobsShop
-
Hi Andrew - using your current method (the write wizard) how do you determine where you want the position of your text to be? Is your chosen font a monotype? Does the position depend at all on the length of the text?
Ian
-
Hi Ian,
At the moment I always program the text at 0,0,0 and have a work offset just for the engraving. Yes, my font is a monotype style. No I always start the font at the same point (0,0,0) irrespective of the length of the text.
Regards
Andrew
-
Andrew - I've taken a look at the relevant macros and I reckon what you want to do is possible but it'll involve a fair amount of hacking. Depends how much you want it I guess.
Cheers
Ian
-
Hi Ian
I was hacking around with the macro a bit yesterday. The trouble I have is how to pass the text that I want engraved to the macro. If you try and use the parameters (P,Q or R) these only accept a double value, so what I did was assign a two digit number to each letter ie A becomes 01 all the way through to Z = 26, I then convert this to a base 6 (senary) binary and then back to a double, In this way If I use all three parameters, I can achieve the number of letters I need to engrave ......... this works ok for me, and it is producing the correct gcode, BUT it isn't very neat.....
Any thoughts on a better way to send the text string to the macro.
Andrew
-
You can pass the text to the macro via the Gcode # variables.
M2222 #1=a #2=b #3=e etc,etc
Somwhere I have an engraving macro we worked with years ago. Originally it was writtne in Fanuc Macro B but I converted it to machism (;-). I can dig it out if you are interested. I was a time saver to be able to call the engraver at will from the Gcode file.
Just a thought, (;-) TP
-
Hi TP
That sound exactly what I am looking for, if you could find the macro I would be very greatfull.
Regards
Andrew
-
OK found a bunch of old code done 2 ways one is throught VB macro and the other is through Gcode Subs.
The Gcode subs has always been rock dependable so I will clean up that version first.
The way it will work is you load all the subs A-Z into the sub directory. You would then set a few variable to define the width height and spacing
#500=1.000 #501=.100 #502=1.00
#1=8.0 #2=-.02 #3=15 #4=40 #5=1.0 #7=30
You only have to define these once per session of mach. Mach holds them inMEM until it is shut down. We can also make these so mach will always remeber them until you change them.
Then all you have to do is call the sub via the M98 call
M98 (C.txt)
M98 (A.txt)
M98 (T.txt)
Mach will then cut CAT.
I f this is what you are looking for then I will clean it all up and post it.
(;-) TP
-
A dodge I've used before to pass a string to a macro is to gcode something like:
...
(some text)
M750
...
Then in the macro use the apparantly undocumented "getMessage" function. You should probably plate this up a tad like:
(%some text%) and check for the %s just in case an otherwise generated message springs up and overwrites the message before you read it.
Ian
-
OK I have placed the Engraving Subs in the MACH TOOL BOX. There is also a set of instructions on how they work.
As always test them for your application FIRST.
Have Fun (:-) TP
-
Hi TP
Thanks heaps for your help, I will give it a go, but I am pretty sure it will work perfectly for me.
Regards
Andrew