Results 1 to 3 of 3

Thread: attachment test

  1. #1
    Registered
    Join Date
    May 2005
    Location
    canada
    Posts
    1,164
    Downloads
    0
    Uploads
    0

    attachment test

    can't paste this. try attachment
    Anyone who says "It only goes together one way" has no imagination.


  2. #2
    Registered Dolphin USA's Avatar
    Join Date
    May 2007
    Location
    USA
    Posts
    412
    Downloads
    0
    Uploads
    0
    #!/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
    # %
    ###########################################################################







    Thats what I got


  3. #3
    Registered
    Join Date
    May 2005
    Location
    canada
    Posts
    1,164
    Downloads
    0
    Uploads
    0
    That's not what I hoped for exactly. Deleting it now.

    Thanks for checking
    Anyone who says "It only goes together one way" has no imagination.


Similar Threads

  1. just a test of posting with an attachment
    By rancherbill in forum Test Forum
    Replies: 2
    Last Post: 12-12-2006, 02:32 PM
  2. Anyone knows what's this attachment and what's the use??
    By cbucner in forum General Metalwork Discussion
    Replies: 6
    Last Post: 04-03-2006, 11:04 PM
  3. Tapping attachment
    By phantomcow2 in forum Bridgeport and Hardinge Mills
    Replies: 3
    Last Post: 01-03-2006, 09:46 PM
  4. Identifying a printed attachment
    By Rance in forum DIY CNC Router Table Machines
    Replies: 5
    Last Post: 11-16-2005, 06:56 AM
  5. Attachment for moving a mill?
    By FLUTE HEAD in forum General Metal Working Machines
    Replies: 7
    Last Post: 04-05-2005, 10:33 AM

Posting Permissions


 


About CNCzone.com

    We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

Follow us on

Facebook Dribbble RSS Feed


Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.