G-code editor


Page 1 of 2 12 LastLast
Results 1 to 20 of 27

Thread: G-code editor

  1. #1
    Member
    Join Date
    Sep 2017
    Posts
    62
    Downloads
    0
    Uploads
    0

    Default G-code editor

    Newbie question. If you write a quick routine in G-code, what software do you use? I wrote a simple routine to spot drill, G81 drill corner holes, and G1 move a 1/4" end mill to route finger joints in boards for some bee hives. I put in the actual dimensions and added 0.002" on each cut to make a little clearance so they'd easily slip together. Turned out I needed a little more clearance, so had to go in and retype all of the coordinates to make the cuts a little deeper. I used Notepad for the editing.

    I'm thinking there must be something out there that lets you assign a variable, then call the variable throughout the routine. In my case, the Y-axis dims were the same on every finger joint, so would be nice to name a variable something like "finger joint depth" and have another variable like "depth clearance" assigned with 0.002". When the routine runs, it's add/subtract the clearance from the dim for the actual target. If the joint was sloppy, make the clearance smaller or bigger if it's too tight.

    I'm probably going to use Excel as I could set up a header area with cells to do the math and have the routine reference those cells. Then do a Save As *.txt file for dumping onto my 1100.

    Thanks, Bruce

    p.s. Learning Fusion 360 will be a winter project. My wife is a Unigraphics/ Solidworks designer so have an in-house tutor.

    Similar Threads:


  2. #2
    Member
    Join Date
    Nov 2012
    Location
    United States
    Posts
    591
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    I use gedit on the Linux box that runs PathPilot.

    Note that PathPilot supports the full LinuxCNC language, which lets you declare and use variables right in the code.

    See for example: G Code Overview

    Code:
    #<Xstart> = 1.0
    #<Ystart> = 2.0
    #<Zend> = -0.5
    #<Xdelta> = 0.5
    #<Ydelta> = 0.3
    
    M03 S3000
    
    G0 X[#<Xstart>] Y[#<Ystart>] Z1.0
    G0 Z0.1
    G1 [#<Zend>] F150
    G0 Z1.0
    G0 X[#<Xstart>+#<Xdelta>] Y[#<Ystart>] Z1.0
    G0 Z0.1
    G1 [#<Zend>] F150
    G0 Z1.0
    G0 X[#<Xstart>+#<Xdelta>] Y[#<Ystart>+#<Ydelta>] Z1.0
    G0 Z0.1
    G1 [#<Zend>] F150
    G0 Z1.0
    G0 X[#<Xstart>] Y[#<Ystart>+#<Ydelta>] Z1.0
    G0 Z0.1
    G1 [#<Zend>] F150
    G0 Z1.0
    
    M30
    G30
    (This is untested, but should illustrate the principle I think.)



  3. #3
    Member
    Join Date
    Sep 2017
    Posts
    62
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by jwatte View Post
    I use gedit on the Linux box that runs PathPilot.

    Note that PathPilot supports the full LinuxCNC language, which lets you declare and use variables right in the code.

    See for example: G Code Overview

    Code:
    #<Xstart> = 1.0
    #<Ystart> = 2.0
    #<Zend> = -0.5
    #<Xdelta> = 0.5
    #<Ydelta> = 0.3
    
    M03 S3000
    
    G0 X[#<Xstart>] Y[#<Ystart>] Z1.0
    G0 Z0.1
    G1 [#<Zend>] F150
    G0 Z1.0
    G0 X[#<Xstart>+#<Xdelta>] Y[#<Ystart>] Z1.0
    G0 Z0.1
    G1 [#<Zend>] F150
    G0 Z1.0
    G0 X[#<Xstart>+#<Xdelta>] Y[#<Ystart>+#<Ydelta>] Z1.0
    G0 Z0.1
    G1 [#<Zend>] F150
    G0 Z1.0
    G0 X[#<Xstart>] Y[#<Ystart>+#<Ydelta>] Z1.0
    G0 Z0.1
    G1 [#<Zend>] F150
    G0 Z1.0
    
    M30
    G30
    (This is untested, but should illustrate the principle I think.)
    Thanks! I have lots of learning to do. Will start reading the G code reference link you included in your post during lunch breaks.

    Bruce



  4. #4
    Community Moderator Jim Dawson's Avatar
    Join Date
    Dec 2013
    Posts
    5717
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    Bruce, it's time to learn Fusion 360. https://academy.titansofcnc.com This is the simplest course I have seen and it's free. Took me from zero to semi-competent in a couple of days.

    I use Notepad for quick editing and really quick stuff, but for anything that requires tool offsets and the like I use CAM to generate the G code. Prior to using Fusion 360 I was using AutoCAD and CamBam, don't use that much anymore.

    Jim Dawson
    Sandy, Oregon, USA


  5. #5
    Junior Member vicpaulsen's Avatar
    Join Date
    Apr 2018
    Location
    Mineral Wells
    Posts
    20
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    Have you looked at CNCCookbook's G-Wizzard Editor here is the link
    https://www.cnccookbook.com/g-code-s...rator-gwizard/



  6. #6
    Member he1957's Avatar
    Join Date
    Jun 2018
    Location
    Tasmania
    Posts
    362
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    Have a look at SimplyCam, not free but not expensive either. You can draw your part outline, generate and view tool paths including ISO views for a wide variety of controls.

    WebSite: MR-Soft Nc Software Tools

    To allow for the tolerances you mention you can just change the tool diameter a little bit and regenerate the G-code file, it will apply the offsets in the tool path.



  7. #7
    Member
    Join Date
    Sep 2009
    Location
    US
    Posts
    624
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    Any text editor. Gedit, etc. Just not Word or equivalent, which hides all kinds of invisible stuff in the document as well (sometimes, in some cases, saving as plain text files works).

    The one thing I would NOT do is use Excel. Excel is not a document processor; that's why Microsoft sells it with Word. Excel can be made to handle text, and there are some g-code generators that use Excel, but eventually you'll wind up twisting into unlikely contortions in order to do something that would be straightforward in a text editor. Use a tool designed for the job.



  8. #8
    Member kstrauss's Avatar
    Join Date
    Apr 2013
    Location
    Canada
    Posts
    1788
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    Certainly Excel is not a great text editor. However, Excel is actually very useful to produce gcode if your data is generated in Excel (or can be read by Excel). For example, I've used Excel to mill 3D surfaces that are defined by an equation or mesh data that has been smoothed in Excel.



  9. #9
    Member kstrauss's Avatar
    Join Date
    Apr 2013
    Location
    Canada
    Posts
    1788
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    I paid for Gwizard Editor but it doesn't have any special handling for LinuxCNC specific constructs.

    I often use the free Notepad++ (https://notepad-plus-plus.org/download/v7.7.1.html)



  10. #10
    Member
    Join Date
    Sep 2017
    Posts
    62
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    Hi Jim,

    Yeah, I often wonder why I keep beating my head against the wall . . . . I plan to learn Fusion 360 this winter. Always like to have multiple options for doing the same thing. Kind of like edge finding on the mill. I have a Haimer taster, Wildhorse probe, mechanical edge finder, electronic edge finder, centering scope, etc. Almost like a collector in some regards.

    Thanks all for the suggestions here. Always something new to learn.

    Bruce



  11. #11
    Member
    Join Date
    Sep 2017
    Posts
    62
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    One of my projects is a 75-tooth gear that has an OD of about 1.5" (yes, really small teeth). I'm still learning the nuances of G-codes, know there's a looping function which would make the indexing pretty simple. I used program in Z-80 code on a TRS-80 computer back in the day (Google Bruce Hansen TRS-80). If I was writing a routine in BASIC, it'd go something like:

    G0 X0 Y0 Z0 (set up for first pass, move in X to cut the tooth, Y 0 is on the edge of the blank, Z 0 is at the center of the blank, X 0 is to the left of the blank)
    G1 Y -0.050 (assuming a 0.050" depth of cut)
    FOR I= 0 to 360 STEP (75/360)
    G1 A I (rotate the 4th axis to the "I" angle)
    G1 X 1.5 (move X to make the pass, Y/Z are already set to depth)
    G1 X 0 (return to start)
    NEXT I (loops back up and indexes I by 75/360)

    Same type of thing I'm sure can be done in G-code, just gotta read up on it and make the conversions.

    Thanks again, Bruce



  12. #12
    Member kstrauss's Avatar
    Join Date
    Apr 2013
    Location
    Canada
    Posts
    1788
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    Following is some hand produced code that I've used to cut gears using a gear cutter. Hopefully it will provide a few hints regarding one approach.

    (program to cut a gear)
    g90 (ensure not in incremental)

    #<GearTeeth> = 52
    #<GearWidth> = .18
    #<GearDiameter> = 1.102
    #<ToothDepth> = 0.047



    (Setup)
    ( Gear left face is at x=0)
    ( Gear axis is at y=0 / z=0)

    #<GearRadius> = [#<GearDiameter>/2]

    (parameters for 20T gear cutter)
    #<ToolNum> = 203
    (Aluminum: DoC 0.015, Feed 6, RPM 1000)
    (Delrin: DoC 0.025, Feed 3, RPM 1700)
    (Brass: DoC 0.010, Feed 3, RPM 565)
    #<DoC> = 0.015
    #<FinalDoC> = 0.005
    #<cutFeed> = 6
    #<cutRPM> = 1000

    (Choose gear tooth cutter -- tool 203)
    T#<ToolNum>M6G43
    #<CutterRadius> = [#5410 / 2]
    #<YcutterTouch> = [#<gearRadius> + #<CutterRadius>]
    #<strokes> = [FUP[[#<ToothDepth> - #<finalDoC>] / #<DoC>]] (calc minimum # strokes)
    #<DoC> = [[#<ToothDepth> - #<finalDoC>] / #<strokes>]
    #<x_home> = [#<GearWidth> + 0.5] (offset to ensure cutter clears spindle)
    #<y_home> = [#<YcutterTouch> + 0.5]
    #<Z_home> = 0
    #<A_home> = 0
    #<angle_inc> = [360 / #<GearTeeth>]
    #<curr_angle> = 0
    #<A_backup> = -3 (amount to reverse 4th axis to ensure that backlash is removed)
    #<Y_backoff> = .25 (retract after cutting)
    (DEBUG,#<GearTeeth> teeth, #<GearWidth> wide, #<GearDiameter> diameter, depth #<ToothDepth>)
    (DEBUG,#<strokes> strokes with adjusted DoC of #<DoC>)
    (DEBUG,At Y=#<YcutterTouch>, #<CutterRadius> radius cutter touches gear blank)
    M01 (pause to display values)

    #<XleadOut> = 0.05 (amount past face of gear to cut)
    (XleadIn must be greater than 1/2 of the chord with a sagitta of #<Doc>)
    #<XleadIn> = 0.25 (amount before face of gear to begin cut)
    #<CutWidth> = [#<GearWidth> + #<XleadOut> + #<XleadIn> ]

    G92A#<A_home> (quickly reset 4th axis position)
    G00 Y#<y_home> A#<A_backup> (take up any backlash)
    G00 X#<x_home> A#<A_home> Z#<Z_home>

    S #<cutRPM>
    M03 (spindle ON)
    M08 (coolant ON)

    o101 repeat [#<GearTeeth>]
    G00 A#<curr_angle> X[#<XleadIn> + #<GearWidth>]
    g00 y[#<YcutterTouch>] (move to just touching outside of gear blank)
    F #<cutFeed>
    G91 (begin incremental mode)
    o110 repeat [#<strokes>]
    G00 Y[-#<DoC>]
    G01 X[-#<CutWidth>]
    G00 Y#<Y_backoff>
    G00 X[#<CutWidth>]
    g00 Y[-#<Y_backoff>]
    o110 endrepeat

    G0 Y[-#<FinalDoC>] (make one final cut)
    G01 X[-#<CutWidth>]
    G00 Y#<Y_backoff>

    G90 (begin absolute mode)

    #<curr_angle> = [#<curr_angle> + #<angle_inc>]
    G00 A#<curr_angle> F1250

    o101 endrepeat

    g00 X#<X_home>
    g00 Y#<Y_home>

    M09 (coolant OFF)
    M5 (spindle off)



  13. #13
    Member
    Join Date
    Sep 2017
    Posts
    62
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    Thanks! That's the type of routine I was thinking about. My other "brute force" method was going to be writing a formula in Excel. It'd be pretty simple in Excel, but your G-code routine is the way to go.

    Bruce



  14. #14
    Member
    Join Date
    Jun 2012
    Location
    usa
    Posts
    182
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    Fusion 360 CAM can use patterns, so you would only need to create the toolpath for 1 tooth, then pattern the rest.



  15. #15
    Member kstrauss's Avatar
    Join Date
    Apr 2013
    Location
    Canada
    Posts
    1788
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    How would patterns help if he is using a gear cutter? For the size gears that he wanted to cut a 0.5mm endmill would be too large.



  16. #16
    Member
    Join Date
    Jun 2012
    Location
    usa
    Posts
    182
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    What difference would it make whether it's a gear cutter or an endmill? You create the gcode path for 1 tooth, then repeat for each tooth.



  17. #17
    Member mountaindew's Avatar
    Join Date
    Nov 2007
    Location
    earth
    Posts
    2151
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    My cam system post processor generates simple repeated code. The tool path code is repeated for each tooth and the only change is 4th axis move.
    G-code editor-geartoolpaths-jpg



  18. #18
    Member routalot's Avatar
    Join Date
    Dec 2003
    Posts
    1206
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    If you operate in the world of Windows, wordpad works.In a Linux environment I use mousepad.



  19. #19
    Member kstrauss's Avatar
    Join Date
    Apr 2013
    Location
    Canada
    Posts
    1788
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    Probably my lack of knowledge of Fusion is showing but setting up a 4-axis job to simply move a cutter parallel to the rotary axis and at the z-height of the rotary's centre line seems unduly complicated.



  20. #20
    Member
    Join Date
    Sep 2017
    Posts
    62
    Downloads
    0
    Uploads
    0

    Default Re: G-code editor

    Here are a couple of the gears I've made using a conventional dividing head. One's a 50-tooth gear, others are 10/75 teeth. I've got the gear cutters for all three though the 10-tooth is using whatever the smaller number of teeth you can get with a cutter, something like 12 or 13 teeth. Not the correct cutter as they don't make one for 10 teeth, but as close as I could get. Use is in a toy, so not Space Shuttle tolerances.

    I'll be learning Fusion this winter. I'm thinking that it's really a simply process for conversational G-code since it's just making a pass, returning to the original position, rotate the 4th axis, then repeat. I've got the math down on determining the gear blank OD, diametral pitch, tooth whole depth, etc. Nice to have some canned math equations (i.e. whole depth = 2.157 / P) so I don't have to manually calculate the coordinates for each different gear.

    Tips below will help immensely. I was unaware that G-code allowed variable names to be assigned. I can see writing a number of canned routines, like cutting gears, tension/compression tapping, etc. that can be added into other pieces of the CAD design.

    For example, might be easier to draw the shape of a part in Fusion, put in the holes, but do the tapping after the fact from a G-code routine calling up Tormach's recommended tension/compression G-code routine. I've got a number of thread mills also, so can go that route too. Just don't understand (yet) how Fusion would know to make a 1/4"-20 hole via a thread mill or a T/C head with a tap.

    Thanks again for the help,

    Bruce


    G-code editor-cutting-p50s-jpg
    G-code editor-cv-cw-jpg

    Attached Thumbnails Attached Thumbnails G-code editor-cv-cw-jpg   G-code editor-cutting-p50s-jpg  


Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

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


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

G-code editor

G-code editor