587,229 active members*
4,479 visitors online*
Register for free
Login
Results 1 to 11 of 11
  1. #1
    Join Date
    May 2005
    Posts
    1662

    g-code generators!

    A couple of gcode generators have shown up in the wiki
    http://wiki.linuxcnc.org/cgi-bin/emc...ode_Generators

    Sounds like there's more to come. Thanks Big John T and Dan Falck.

    We already had these;
    http://www.pico-systems.com/gcode.html
    but having stuff in python is cool. Easy to hack around in if you want something custom.

    Dan Falck, if you're out there, what's the purpose of the scale widget? Seems redundant at first glance. Maybe it's part of a template for future code?

    O.T. What's the gnome equivalent of KNotes? Having a sticky notepad is handy when posting links. Ubuntu is cool but sometimes I miss the Kde toys.
    Anyone who says "It only goes together one way" has no imagination.

  2. #2
    Join Date
    Apr 2005
    Posts
    1778
    Cyclestart,

    There is a Ubuntu download configured with Kde instead of Gnome. I don't know how tightly Axis is tied to Gnome. You might want to try it out and let us know.

    Alan

  3. #3
    Join Date
    Mar 2004
    Posts
    261
    GCam - http://gcam.js.cx/index.php/Main_Page

    See package gcam-2007.09.15.tar.gz below Windows stable package

    OpenCam - http://opencam.sourceforge.net/

    Written to run with GamBas

    Enjoy,
    RipperSoftware

  4. #4
    Join Date
    Oct 2006
    Posts
    15
    I like the goal of gcam:

    Design Goals

    Indisputable domination of both free and commercial CAM software markets.

  5. #5
    Join Date
    May 2005
    Posts
    1662
    Quote Originally Posted by acondit View Post
    There is a Ubuntu download configured with Kde instead of Gnome. I don't know how tightly Axis is tied to Gnome. You might want to try it out and let us know.
    Whoa, that seems a little extreme, but probably serves me right for being so lazy! Otoh, if there's an interest in emc/kde, I'm a cheerful testmule. The Gnome applet is 'sticky notes' and can be added by right clicking the top panel.

    Rippersoft

    I was aware of those two programs. The gcode generators on the wiki are simple helpers for people who hand code. What they are at the moment is less exciting than what they could become with a little more work. The script is written in an easy to edit form . Tied together they could be a suite of sorts. Like cad/cam without the cad. Emc's holecircle.py is an example of how nice the these little apps can turn out.
    Anyone who says "It only goes together one way" has no imagination.

  6. #6
    Join Date
    May 2005
    Posts
    1662
    I've been having some fun with this idea. This is a quick, dirty, possibly error filled, and hopefully highly readable, take on makering.c. Makering.c can be found in the pico systems link in the first post. I'll add an attachment to this post when/if the code improves. Warning, I use program language like a monkey uses a hand grenade.

    #!/usr/bin/python
    from Tkinter import *
    import math

    root = Tk() #makes the window, root is just a convention
    root.title("DangerCam") #name for title bar

    def gcodeme(): #this function is called below, see "Button"
    saved = name.get() #collect the "saved as" name for file
    f = file(saved, 'w') #open that file for writing
    speed = int(rpm.get()) #collect the other entry box values
    firstcut = float(rough.get())
    tool = float(cutter.get())
    permin = float(feed.get())
    cx = float(cenx.get())
    cy = float(ceny.get())
    secondcut = float(final.get())
    depth = float(deep.get())

    pathone = (firstcut / 2) - (tool / 2) #followed by a few
    pathtwo = ((secondcut - firstcut) / 2) + pathone #calculations
    threeoclock = pathone + cx
    nineoclock = cx - pathone
    twelveoclock = cy + pathtwo
    sixoclock = cy - pathtwo
    #and then write the gcode to file

    f.write("% n")
    f.write("S%i M03 n" % (speed))
    f.write("G00 X% 8.4f Y% 8.4f n" % (threeoclock, cy))
    f.write("Z.1000 n")
    f.write("G01 Z% 8.4f F% 8.4f n" % (depth, permin))
    f.write("G03 X% 8.4f Y% 8.4f R% 8.4f n" % (nineoclock, cy, pathone))
    f.write("X% 8.4f Y% 8.4f R% 8.4f n" % (threeoclock, cy, pathone))
    f.write("X% 8.4f Y% 8.4f R% 8.4f n" % (cx, twelveoclock, pathtwo))
    f.write("X% 8.4f Y% 8.4f R% 8.4f n" % (cx, sixoclock, pathtwo))
    f.write("X% 8.4f Y% 8.4f R% 8.4f n" % (cx, twelveoclock, pathtwo))
    f.write("G00 Z2 n")
    f.write("M02 n")
    f.write("% n")

    f.close() #close file This might not be quite right??
    root.destroy() #destroys window, end of function gcodeme



    rpmlabel = Label(root, text = "Spindle RPM") #a few labels
    roughlabel = Label(root, text = "Rough Diameter")
    cutterlabel = Label(root, text = "Cutter Diameter")
    feedlabel = Label(root, text = "Feed Rate")
    cenxlabel = Label(root, text = "X center")
    cenylabel = Label(root, text = "Y center")
    finallabel = Label(root, text = "Finish Diameter")
    deeplabel = Label(root, text = "Depth")
    namelabel = Label(root, text = "Save File as")

    rpm = Entry(root, width = 30) #a few entry widgets
    rough = Entry(root, width = 30)
    cutter = Entry(root, width = 30)
    feed = Entry(root, width = 30)
    cenx = Entry(root, width = 30)
    ceny = Entry(root, width = 30)
    final = Entry(root, width = 30)
    deep = Entry(root, width = 30)
    name = Entry(root, width =30)

    Label(root, text = "DANGER!", fg = '#006699', font = ('Papyrus', 20)).grid()
    # some descriptive text, you've been warned !

    rpmlabel.grid() #add stuff to the window
    rpm.grid()
    roughlabel.grid()
    rough.grid()
    cutterlabel.grid()
    cutter.grid()
    feedlabel.grid()
    feed.grid()
    cenxlabel.grid()
    cenx.grid()
    cenylabel.grid()
    ceny.grid()
    finallabel.grid()
    final.grid()
    deeplabel.grid()
    deep.grid()
    namelabel.grid()
    name.grid()

    Button(root, text = "Make it so", command = gcodeme).grid()
    # command calls function gcodeme()

    root.mainloop() #keeps window open until killed in gcodeme function

    ################################################## #########################
    # the gcode program the python program is based on
    ################################################## #########################
    # %
    # #100= 1000 (RPM)
    # #101= 2 (rough diam)
    # #102 = .5 (cutter diam)
    # #103= 60 (feed)
    # #104= 0 (x center)
    # #105= 0 (y center)
    # #106= -.25 (depth)
    #
    # #107= [[#101/2]-[#102/2]]
    # (circle r - cutter r)
    #
    # #108= 2.02 (finish diam)
    # #109= [[[#108-#101]/2]+#107]
    #
    # S#100 m03
    # g00 x[#107+#104] y#105
    # z.1
    # g01 z#106 f#103
    # g03 x[[-1*#107]+#104] y#105 r#107
    # x[#107+#104] y#105 R#107
    # x#104 y[#105+#109] r#109
    # x#104 y[#105-#109] r#109
    # x#104 y[#105+#109] r#109
    # g00 z2
    # m02
    # %
    ################################################## #########################
    edit: can't seem to post backslashes inside a quote. Assume all single lowercase "n" are preceded by a backslash .
    \n

    postscript/ I've made several improvements to the code including some graphics. Unfortunately [code] tags don't work well on this forum. The loss of whitespace being the worst (and fatal) problem. Maybe I'll host the files myself at a later date.
    Anyone who says "It only goes together one way" has no imagination.

  7. #7
    Join Date
    Sep 2004
    Posts
    149
    I put in the scale widget as a cheap and dirty way of converting between inch and metric. I was using an earlier version to dump points into vectorcam using it's plc (point, line, circle) format. It assumes everything coming into it in that format is in metric. So, I was entering the scale as 25.4 and Vector seemed happy. But, yes, it is kind of redundent. It's easy enough to take it out.

    Thanks for looking at it.
    Dan

  8. #8
    Join Date
    May 2005
    Posts
    1662
    Quote Originally Posted by acondit View Post
    There is a Ubuntu download configured with Kde instead of Gnome. I don't know how tightly Axis is tied to Gnome. You might want to try it out and let us know.
    Emc2 simulator and Axis seem to be running nicely on Mepis/kde. Combine cabin fever with curiosity and strange things happen

    Dan
    Living in a (sort of) metric country I should have figured that out.

    edit/ added a screenshot. An idea is brewing.

    A couple of people have been complaining about the heaviness of Ubuntu (it's fast enough for me by the way). Is the issue really Ubuntu or is it Gnome? The screenshot shows a 3d desktop I use occasionally. This is accessed by logging into a new session. Window makers like fluxbox can also be created in a new session. Wonder if emc2 will work properly in this type of environment?

    Wow this is going OT Off to experiment.
    Attached Thumbnails Attached Thumbnails 3demc.png  
    Anyone who says "It only goes together one way" has no imagination.

  9. #9
    Join Date
    May 2005
    Posts
    1662
    The holecutting code is improving somewhat. Attached is the current .py file. This program will cut a ring, leaving a center slug. Some caution needed when the slug lets go. Why make chips if you don't need to.

    This script can be run stand-alone or placed in /usr/share/emc/ncfiles/ to take advantage of the write to Axis function. Ability to use fractions removed at this point.

    Any feed back welcome. Features or scripts you would like see. Problems with resolution or features. Even "Quit dragging up this thread you moron !!!". I'm thick skinned. Positively obtuse some would say.

    Thanks John T for the vast majority of the script.
    Attached Files Attached Files
    Anyone who says "It only goes together one way" has no imagination.

  10. #10
    Join Date
    Aug 2005
    Posts
    301

    G-code generators

    Hi,

    Being a complete tyro when it comes to g-code,I have a question. If you use this method to generate the code and save it as a .txt file and then load it into your machine will it work?

    Thanks,

    Ernied

  11. #11
    Join Date
    May 2005
    Posts
    1662
    Ernied

    Good question. I had only run it in simulation up until you asked! But yeah, I'll give it a qualified passing grade. Qualified because I'm using the program to cut the z axis parts for my mini-mill. Made a 1.735 hole in a 1" block of aluminum while approximating the plunges with hand feed.

    If you do run the program use the usual cautions. The endmill must be capable of plunging. Make sure the spindle is in a safe position for the first rapid move. Backplot in Axis in sim mode and think through what the program is doing. Read the included "Help info" file before running. The same cautions really apply to any code generating software, but doubly so in this case. Single stepping with one hand on the "OH S**T" button highly recommended for the first run.
    Anyone who says "It only goes together one way" has no imagination.

Similar Threads

  1. learning g code or cad-cam code output?
    By slow_rider in forum G-Code Programing
    Replies: 3
    Last Post: 02-28-2010, 03:48 AM
  2. G-code for beginners - want to learn G-code
    By FPV_GTp in forum G-Code Programing
    Replies: 7
    Last Post: 11-18-2008, 06:25 AM
  3. simple python g-code generators
    By Dan Falck in forum OpenSource Software
    Replies: 0
    Last Post: 11-26-2007, 11:37 PM
  4. Manual Pulse Generators
    By Michael M in forum CNC Machine Related Electronics
    Replies: 0
    Last Post: 09-28-2004, 11:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •