Hello Guest it is March 28, 2024, 07:41:24 PM

Author Topic: Need help: VB macro compile error  (Read 7350 times)

0 Members and 1 Guest are viewing this topic.

Need help: VB macro compile error
« on: July 25, 2013, 06:39:06 PM »
I'm in the last stages of a Mach3 retro on a machine that I had running ok under the Industry Controls version of Mach3.  Everything is pretty much up and running except the tool changer.  I edited the m6start macro that I used in Industry Controls  to work in Mach3, there are some very slight differences.  Also in the conversion the a axis became the c axis.  The macro runs fine from the VB window, both stepping through with F7 and running with the play button.  However when I call an M6 from Mach I get a compile error in the message window.  Any ideas?  This was a running macro.  The changes made were removing a door interlock, changing a to c, changing an m code for enabling position control of the spindle, changing "codesingle()" to "code()" in all instances.  I think that's it for changes.

Any help is greatly appreciated.  Thank you.

TOM
Re: Need help: VB macro compile error
« Reply #1 on: July 25, 2013, 08:30:14 PM »
I can post a copy of the macro tomorrow am, forgot to grab a copy off the machine
Re: Need help: VB macro compile error
« Reply #2 on: July 26, 2013, 07:01:55 AM »
See attached for code

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Need help: VB macro compile error
« Reply #3 on: July 26, 2013, 08:36:30 AM »
Hi Tom

Close but no cigar...  ;D

The macro runs fine from the VB window, both stepping through with F7 and running with the play button.
No it doesn't.

The changes made were ... changing "codesingle()" to "code()" in all instances.
No they weren't.

Ian
Re: Need help: VB macro compile error
« Reply #4 on: July 26, 2013, 09:38:42 AM »
Sorry, wrong file.  They were all changed.  Been working with a friend we got it figured out.  In program run mode mach hangs on my M13, the code that switches the spindle into position mode.  In order to change tools the spindle needs to change to position mode and then home to get the correct orientation for the tool changer.  Mach, doesn't like when you hit the home button during program run...imagine that.  We're working on that now.

Thanks Stirling, you helped me realize that in the vb window i had been working on my backup copy....i'm a dumba$$

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Need help: VB macro compile error
« Reply #5 on: July 26, 2013, 10:07:57 AM »
Sorry, wrong file.
:-X

In program run mode mach hangs on my M13, the code that switches the spindle into position mode.
M13? - you're not writing a macro and naming it M13 are you? (Hint: Yes is the wrong answer  ;))

Ian
Re: Need help: VB macro compile error
« Reply #6 on: July 26, 2013, 10:14:13 AM »
M13? - you're not writing a macro and naming it M13 are you? (Hint: Yes is the wrong answer  ;))

???

The toolchange macro is M6Start.  M13 is just a macro that changes some settings in the vfd via modbus, turns on an output, enables the c axis, and homes the c axis.  The M13 works fine on it's own, commanded in mdi, as does the M6.  The M13 is commanded inside the M6 macro, to switch the spindle to position mode for orientation and indexing of the tool changer.  Mach just doesn't allow a home button to be pushed via script during a program run.

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Need help: VB macro compile error
« Reply #7 on: July 26, 2013, 10:31:31 AM »
I'm guessing the short answer was yes. (But nicely avoided BTW  ;D)

Not a good idea to create macros under 100. They're "reserved".

Also not a good idea to call a macro from a macro. It's likely to turn around and kick you up the ***.
Re: Need help: VB macro compile error
« Reply #8 on: July 26, 2013, 10:38:12 AM »
I'm guessing the short answer was yes. (But nicely avoided BTW  ;D)
Thank you, thank you.

Also not a good idea to call a macro from a macro. It's likely to turn around and kick you up the ***.
Yep, agreed, I was being lazy.  Found it when I moved all the code from the M13 and M15 (cancel position mode) into the M6 to avoid the M call.  Getting in contact with the Vital System guys, need to find some way to tell the DSPMC to home without using a home button in Mach.

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Need help: VB macro compile error
« Reply #9 on: July 26, 2013, 10:53:38 AM »
Not sure if I'm off track here but when you say "using the home button" how do you mean? I ask because you can't "hit" the screen home button from code (like you can with say cycle-start with doOEMButton etc.). The home BUTTON (on the standard screen anyway) is just a script and doesn't have an OEM code. If you want to home C from code you'd just do a doOEMButton(1027).