Hello Guest it is April 26, 2024, 04:38:01 AM

Author Topic: Testing scripts  (Read 2906 times)

0 Members and 1 Guest are viewing this topic.

Offline dah79

*
  •  35 35
    • View Profile
Testing scripts
« on: May 23, 2016, 08:30:51 AM »
Is there a way to simulate a input so I can test a macro script using Mach4 Demo version in simulation mode?

Thanks

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: Testing scripts
« Reply #1 on: May 23, 2016, 10:17:35 AM »
You could use the keyboard plugin and assign a key to an input.

DazTheGas
New For 2022 - Instagram: dazthegas

Offline dah79

*
  •  35 35
    • View Profile
Re: Testing scripts
« Reply #2 on: May 24, 2016, 09:47:42 AM »
Thanks Daz, that worked.

 I have another question..  I have created a macro, that for some reason I cannot get to work (using DEMO version of Mach4 Hobby).  If I open the script and debug and run, it will work.  If I use MDI and type m1002, nothing happens.  I have diagnostics tab open so I can see if the output comes on.  Also, If I change the output to 0, then it will work in MDI.  I am at a loss.

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: Testing scripts
« Reply #3 on: May 25, 2016, 11:24:05 AM »
can you post the code instead of a picture....

a lot easier to debug.

DazTheGas
New For 2022 - Instagram: dazthegas

Offline dah79

*
  •  35 35
    • View Profile
Re: Testing scripts
« Reply #4 on: May 25, 2016, 03:27:21 PM »
Sorry.  As stated, I am able to run this macro when in McLua, but not through calling it in a Gcode or MDI.

Thanks for any assistance.

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: Testing scripts
« Reply #5 on: May 25, 2016, 04:24:09 PM »
Well this is what I have done using the out of box mach4mill profile.

1. Removed  local rc = 0; --return code.  on line 7, as your not using a return code anywhere within the function
2. Replaced local state, rc = mc.mcSignalGetState (mc.mcSignalGetHandle (0, mc.ISIG_INPUT5)) with local state = mc.mcSignalGetState (mc.mcSignalGetHandle (0, mc.ISIG_INPUT5)) on line 19
3. Removed duplicate local inst = mc.mcGetInstance() on line 21
4. copied to my profile/macros folder
5. from mdi - m1002

All worked as expected, so thought I would try in demo mode again all worked, finally I decided to try without any motion device selected and it didnt run.

Check that you have the sim plugin activated and selected as motion device then try the mdi again.

DazTheGas
New For 2022 - Instagram: dazthegas

Offline dah79

*
  •  35 35
    • View Profile
Re: Testing scripts
« Reply #6 on: May 25, 2016, 04:59:30 PM »
Thanks Daz!  After I replied last time, everything starting working (other than in MDI mode).  I was able to simulate a running gcode with my macro in it and it worked...

As far as the rc - I have no idea what that is even for, I just copied some code somewhere.  I am still learning, yet very slowly.  I will modify as you have and try in MDI mode again.

Thanks again for your help!!

Offline dah79

*
  •  35 35
    • View Profile
Re: Testing scripts
« Reply #7 on: May 25, 2016, 05:21:42 PM »
Works now in MDI mode as well, not sure why.  Everything was enabled.