586,076 active members*
4,119 visitors online*
Register for free
Login
IndustryArena Forum > CAD Software > Autodesk > Gcodein - lisp program to read cnc files into autocad
Page 1 of 2 12
Results 1 to 20 of 33
  1. #1
    Join Date
    Apr 2003
    Posts
    416

    Gcodein - lisp program to read cnc files into autocad

    This is a link to a zip file that contains gcodein.fas and a readme.txt file.

    You can use it to read a cnc mill file into Autocad. I also have a lathe version I will post on my website later.

    intergate.com/~wjb1/wjbzone/autocad/gcodein.zip

    Bill

  2. #2
    Join Date
    Mar 2003
    Posts
    6855
    What does that do?

  3. #3
    Join Date
    Apr 2003
    Posts
    416
    You can read a cnc gcode file into an Autocad layer.

    1. Launch your Autocad application.
    2. Use appload to load the gcodein.fas.
    3. Type gcodein at the Autocad command line.
    4. Browse locate your cnc gcode file.

    The cnc file is read into the current Autocad layer as lines and arcs.
    You can step one line at a time or set the number of lines to step.

    I use to verify my code before I run it on my machine.

    Bill

  4. #4
    Join Date
    Mar 2003
    Posts
    6855
    OK, thanks I understand now.

  5. #5
    Join Date
    Mar 2003
    Posts
    35538
    It would be nice if the step number stayed the same so you could just hit enter or right click to step through, right now I had to type the step amount each time. Other than that, it seems to work pretty good.

    Gerry
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  6. #6
    Join Date
    Apr 2003
    Posts
    416
    "It would be nice if the step number stayed the same so you could just hit enter..."

    Gerry,
    That's the way it works. At each pause in execution, the default step number is displayed at the beginning of the command line.
    i.e.
    if the default is 1 the command line reads:
    "1 Enter Step Increment (0 to Continue)"
    if the default is 20 the command line reads:
    "20 Enter Step Increment (0 to Continue)"

    The number at the beginning of the line (the 1 or the 20 shown above) is the default number of steps if you just hit the enter key.

    The only time you should have to type a number is when you want to change the default (can be any positive number).

    Type a 0 (zero) to run without a pause.

    Let me know that is not working for you.

    I'll try to make that more obvious in next revision.

    Bill

  7. #7
    Join Date
    Mar 2003
    Posts
    35538
    My mistake, it does seem to work properly. One thing I noticed with code generated from MeshCAM, It crashed if the first move was:

    G1 Z0.00 F10.00

    I'm guessing it didn't have a place to start with just the Z-value in the first line.

    Gerry
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  8. #8
    Join Date
    Apr 2003
    Posts
    416
    You got me on that one. Looks like a G0 or G1 with a zero move at the start of the program is a problem. I'll get that fixed as soon as I have a chance. Got to to some painting first today.

    Will post again as soon as it's fixed.

    Bill

  9. #9
    Join Date
    Apr 2003
    Posts
    416
    I got the program updated. Fixed the problem with the first move.

    The link on the first post of this thread is the current version.

    Bill

  10. #10
    Join Date
    Oct 2003
    Posts
    263
    Hi,

    Can you use this with AutoCAD 14 and if so, how? I've never run across a .fas file before.

  11. #11
    Join Date
    Apr 2003
    Posts
    416
    Sorry mrainey,
    I don't believe a .fas file can be read into Autocad 14. The lisp routine uses several visual lisp functions. These are supported by Autocad 2000 and above.
    Bill

  12. #12
    Join Date
    Apr 2003
    Posts
    416
    Another update to the gcodein program has been posted. I also put the lathe version (gcodeinL) on my website. (in the Autocad section)

    Bill

  13. #13
    Join Date
    Mar 2003
    Posts
    35538
    BIll, I found a bug in you're program. I'm writing a VBA program to export G-code right from AutoCAD and I was using you're program to test the output. I didn't look into it too much, but I think you're not handling G2 or G3 correctly for arcs greater than 180°. If you try it with the following code, the center of the G3 is not what's specified.

    G1 X-5.6406 Y-11.7226 Z0.2500
    G1 X-2.8821 Y-8.2443 Z0.2500
    G3 X-5.1488 Y-8.3814 I-1.1948 J0.9476
    G1 X-4.3407 Y-9.1800 Z0.2500

    This is incremental I and J, btw. I loaded the code into the KCAM demo and it displayed fine. Just thought I'd let you know.

    Gerry
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  14. #14
    Join Date
    Apr 2003
    Posts
    416
    Gerry,

    Got that one fixed. It now will handle a arc greater then 180 degrees using I and J.

    Let me know if you find anything else.

    Bill

  15. #15
    Join Date
    Apr 2003
    Posts
    416
    I modifed the gcodein file again. Did not change the revision number.
    Had a problem with cw arcs using I and J after fixing the previous error.

    (current version is modified 12/29/2003 3:27pm)

    Bill.

  16. #16
    Join Date
    Mar 2003
    Posts
    35538
    Bill, one thing you should do here is get the value of OSMODE (Osnaps) and reset it when you're done. Every time I run this it turns off my snaps
    One other thing, anything over 999 you're not drawing in the right place I noticed. Is this a bug or intentional. I found this out by running a rather large drawing through my exporter, and reading it in with yours. (It's kind of neat watching it duplicate my drawing while I watch).

    Gerry
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  17. #17
    Join Date
    Apr 2003
    Posts
    416
    Gerry,
    I do save and restore the osmode in gcodein. I checked it out and it resets my osnap to the original settings.

    I think I know what the problem is with the 999. I'll try to get that bug fixed tomorrow. I never ran into the limit with my scale of drawing (in inches).


    Bill.

    One thing I want to figure out is how to make the open file dialogue box default to the autocad drawing folder.

  18. #18
    Join Date
    Apr 2003
    Posts
    416
    Got rev 1f posted.

    Release 1f 1-30-04
    changed open file dialog box to default to current drawing directory
    change to allow coordinate values greater than 999
    change to reset color to previous value
    change method of restoring osnap

    I did not try the 999 coord. fix, let me know if it's working.
    Bill

  19. #19
    Join Date
    Mar 2003
    Posts
    35538
    One thing I want to figure out is how to make the open file dialogue box default to the autocad drawing folder
    You might be able to use the PROJECTNAME variable to help with this. I've never used it, just found it in a quick look through the help file. As for the Osnaps, I've never really looked into it, I just noticed that everytime I've played around with your Gcodein My snaps always ended up turned off. I just use something like this

    at the beginning of your code
    (setq osold (getvar osmode))


    at the end of your code
    (setvar osmode osold)

    Gerry

  20. #20
    Join Date
    Apr 2003
    Posts
    416
    I used the dwgprefix (read only) variable to get the path. The file dialog box is now defaults to the current active drawing directory.


    For the osnap, I had been using (command "osmode" osold)

    I changed it to:
    (setq osold (getvar "osmode"))

    (setvar "osmode" osold)

    The problem with the coords had to do with the way I parsed through each line. I stopped looking after 7 digits. I set it up to 12 digits now.

    Bill

Page 1 of 2 12

Similar Threads

  1. Learning to Program CNC Turning Center
    By Farmer in forum G-Code Programing
    Replies: 13
    Last Post: 09-12-2005, 06:03 AM
  2. Autocad user has newbie SW/CNC questions
    By cadesignr in forum Solidworks
    Replies: 7
    Last Post: 02-11-2005, 08:19 PM
  3. solid works cnc files
    By krustykrab in forum Mastercam
    Replies: 38
    Last Post: 06-19-2004, 03:53 PM
  4. New CNC Controller Program for DOS
    By manfong in forum News Announcements
    Replies: 10
    Last Post: 10-10-2003, 05:30 PM
  5. MDT flow wires to program cnc 3d
    By wjbzone in forum Autodesk
    Replies: 1
    Last Post: 06-24-2003, 01:59 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
  •