I glanced at this earlier, but didn't have time then. Know that I have time to carefully read it, I don't see any questions in there.
I wrote an AutoCAD VBA macro that exports g-code. It's basically just a series of if..then...else statements
What I do is open a file to write to.
Set fs = CreateObject("Scripting.FileSystemObject")
Set gcode = fs.CreateTextFile(Fpath, True)
Then get all the values you need, and concatenate them into a string (along with your G1 X Y Z...). I don't have Excel here, so I'm guessing a little (along with googling).
Set up a string variable to use for each line of code.
Gcodeline = "G28 M6"
Write the line to the file
gcode.writeline (Gcodeline)
Set up the next line:
Gcodeline = "G1 X" + Cstr(Range(A1).value) + " Y" + Cstr(Range(A2).value) + " Z" + Cstr(Range(A3).value) + " M6"
gcode.writeline (Gcodeline)
Keep going until your done, and close the file. Is that what your looking for?


LinkBack URL
About LinkBacks





