586,104 active members*
3,470 visitors online*
Register for free
Login
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2011
    Posts
    480

    Mach4 autoload Gcode on startup

    Hi all,
    New to Mach4. Bought and AVIDCNC router complete package. I've got most thing working fine, but I need to Automatically load my Gcode file on startup of Mach 4. This machine will only ever use one gcode file, so would like to take the operator "out of the loop" on loading the gcode file.

    Any help greatly appreciated.

    -Matt

  2. #2
    Join Date
    Nov 2013
    Posts
    4375

    Re: Mach4 autoload Gcode on startup

    Hi,
    you could put some code in the PLC script.

    The Screen Load script loads first when Mach4 fires up. At the conclusion of that script loading then the PLC runs. There is a counter so that you can detect the first run of
    the PLC script, and in that section you would put such things a module loads, and in your case open a Gcode file. The code in this section is executed just the once,
    imediately after the Screen Load script.

    Would that be adequate?

    Craig

  3. #3
    Join Date
    Mar 2011
    Posts
    480

    Re: Mach4 autoload Gcode on startup

    Hi Craig,
    Yes, that would work. I tried editing the LUA load screen file (see below) from a thread I found on the Artsoft support forum. I tried both formats discussed in the string using "//" vs "/" in the file name but cant get the file loaded. Unfortunately the Admin has not approved my account for the forum yet, so I'm reaching out here.

    Thanks for the response.

    -------------------------------------------------------
    -- Screen Load Script
    -------------------------------------------------------

    pageId = 0
    screenId = 0
    testcount = 0
    machState = 0
    machStateOld = -1
    machEnabled = 0
    machWasEnabled = 0
    inst = mc.mcGetInstance()
    mc.mcCntlLoadGcodeFile(inst, "C:/Mach4Hobby/GcodeFiles/O0001.ngc")
    mc.mcToolPathGenerate(inst)

  4. #4
    Join Date
    Nov 2013
    Posts
    4375

    Re: Mach4 autoload Gcode on startup

    Hi,
    no you don't want to put it in the screen load script. The script loads little chunks at a time. What happens if the bit they you want to load requires some other bit that has
    not yet loaded....it'll fail. No....what you do is wait until the screen load script has fully loaded and started running so all of Machs framework is in place and then call your Gcode file.

    Open the screen editor and peruse the PLC script. You'll see a section that runs when the variable testcount is 1 and not otherwise. That is where you would put your script or better still a a pointer or call to it.

    I would construct your script 'in a sand box' and NOT put it in the PLC UNTIL is be written and debugged. Its a f*****kup to put faulty code into the PLC because it run every few milliseconds
    and any cockup gets repeated and repeated again.

    Craig

  5. #5
    Join Date
    Mar 2011
    Posts
    480

    Re: Mach4 autoload Gcode on startup

    Thanks Craig,
    I'll look at in the AM and post results.

  6. #6
    Join Date
    Mar 2011
    Posts
    480

    Re: Mach4 autoload Gcode on startup

    Hi Craig,
    I assume you mean PMC vs PLC ?. I have a PMC editor for ladder logic which I have done. When I look at the PMC file, I don't see any reference to timers. In the Ladder logic utility, i don't see a method to load gcode files.
    Sorry if I'm missing something obvious as I'm new to Mach4.


    Attachment 503594
    Attachment 503596

  7. #7
    Join Date
    Mar 2011
    Posts
    480

    Re: Mach4 autoload Gcode on startup

    Hey Craig,
    I think I found what you were referring to after I made the post, so disregard. Thanks

    Quote Originally Posted by AUSTINMACHINING View Post
    Hi Craig,
    I assume you mean PMC vs PLC ?. I have a PMC editor for ladder logic which I have done. When I look at the PMC file, I don't see any reference to timers. In the Ladder logic utility, i don't see a method to load gcode files.
    Sorry if I'm missing something obvious as I'm new to Mach4.


    Attachment 503594
    Attachment 503596

Similar Threads

  1. Problem loading Gcode on new Mach4 machine
    By cncneon in forum Mach Software (ArtSoft software)
    Replies: 3
    Last Post: 07-22-2020, 10:59 PM
  2. Replies: 0
    Last Post: 09-19-2017, 09:03 AM
  3. 5 Axis Gcode Interpreter for Mach4
    By ChristianLL in forum Mach 4
    Replies: 8
    Last Post: 09-03-2016, 12:52 PM
  4. cnc plasma tube/pipe machine with autoload
    By dhelfter in forum News Announcements
    Replies: 1
    Last Post: 11-07-2012, 08:33 AM
  5. SMW Spacesaver autoload 12.65 Bardeeder
    By javajesus in forum Mazak, Mitsubishi, Mazatrol
    Replies: 23
    Last Post: 03-17-2009, 04:52 PM

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
  •