Hello Guest it is May 13, 2021, 05:04:32 PM

Author Topic: Open Mach4 with default toolpath  (Read 3714 times)

0 Members and 1 Guest are viewing this topic.

Offline dah79

*
  •  35 35
    • View Profile
Open Mach4 with default toolpath
« on: March 14, 2016, 11:36:45 AM »
Total newbe here, with the first of I'm sure many questions. 

Is there a way to open Mach4 with a specific toolpath file already loaded?
Re: Open Mach4 with default toolpath
« Reply #1 on: March 14, 2016, 03:58:10 PM »
Dah79,

The tool path is defined by the Gcode program that is loaded into MACH4.  Why would you want a default gcode program loaded.  If you want to see the tool path just open a gcode file like roadrunner, which is included as one of the gcode files in c:\mach4hobby\gcodefiles\roadrunner.tap

Russ

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: Open Mach4 with default toolpath
« Reply #2 on: March 14, 2016, 06:17:45 PM »
Theres always a way :-)

You will need to use 2 commands here within the screen load script.

From the screen editor you will need to edit the bottom of the screen load script with  mc.mcCntlLoadGcodeFile(inst, stringFileToLoad) first then create the toolpath with  mc.mcToolPathGenerate(inst)

Example with roadrunner.

Code: [Select]
    mc.mcCntlLoadGcodeFile(inst, "C:\\Mach4Hobby\\GcodeFiles\\roadrunner.tap")
    mc.mcToolPathGenerate(inst)

Hope this helps

DazTheGas
Theres always time for a choccy biccy

Offline dah79

*
  •  35 35
    • View Profile
Re: Open Mach4 with default toolpath
« Reply #3 on: March 15, 2016, 06:52:10 AM »
Russ, this is a special situation where I want to make sure that this file is ran first.  That is why I wanted a way to have it loaded on Mach startup.

Daz, thank you for your reply.  I will try this when I get my software and controls.

Dave

Offline dah79

*
  •  35 35
    • View Profile
Re: Open Mach4 with default toolpath
« Reply #4 on: March 29, 2016, 07:24:13 AM »
Finally got around to this, but had a couple of issues.  First of all, the slash (/) has to be in this direction or you get a syntax error.  This is what I ended up putting in the 'Screen Load Script':

-------------------------------------------------------
--  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)

This worked to load the default toolpath, but now I don't get the normal startup screen.  This is what I get (see attachment).  What did I do wrong?


Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: Open Mach4 with default toolpath
« Reply #5 on: March 29, 2016, 08:19:22 AM »
Quote
First of all, the slash (/) has to be in this direction or you get a syntax error.

The code I posted is 100% correct way of doing it and they want to be last 2 lines of the screenload script.

I will check again when near machine.

DazTheGas
Theres always time for a choccy biccy

Offline dah79

*
  •  35 35
    • View Profile
Re: Open Mach4 with default toolpath
« Reply #6 on: March 29, 2016, 08:31:34 AM »
Daz,

Please do check and report back.  I did put the code in the last 2 lines as shown in the above post.  See the attachment in the above post, it is a screen shot of how Mach4 opened after making those changes.

Thanks for your help.

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: Open Mach4 with default toolpath
« Reply #7 on: March 29, 2016, 04:37:19 PM »
Yep checked on fresh install of mach4 and added last 2 lines and works as should.

DazTheGas
Theres always time for a choccy biccy

Offline dah79

*
  •  35 35
    • View Profile
Re: Open Mach4 with default toolpath
« Reply #8 on: March 29, 2016, 05:27:46 PM »
Daz,

I am running the demo version of Mach4, if that makes any difference.  From looking at my modifications above, do you see anything that I did wrong that would cause Mach to start up like what is in the attachment posted above?  If I put the (/) in the other direction (\), I get a syntax error every time and that is all I change to get rid of it.

I have made no other changes...

Dave

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: Open Mach4 with default toolpath
« Reply #9 on: March 29, 2016, 05:50:22 PM »
Not sure but looks like your running XP,

If so I will hunt down an xp machine tomoro and try, just wondering if there is an error between xp and mach4 thats actually outputting some error text you cant see before it draws the main tabs.

DazTheGas
Theres always time for a choccy biccy