81
VB and the development of wizards / Re: Code Won't Load / Success!!!
« on: January 05, 2007, 12:11:41 AM »
In a nutshell, The Code Won't Load because there's no IsLoading() function.
To elaborate. The following code works fine by itself:
While IsActive(Input2)
ActivateSignal(OUTPUT8)
Wend
While IsActive(Input3)
DeActivateSignal(OUTPUT8)
Wend
But when Mach3 loads a program, it does a run simulation as it loads each command. This way it checks commands for syntax and draws the toolpath display. When it encounters code that depends on a mechanical action to continue, it will sit there and wait for that action to occur. Obviously this will never happen since it's a simulation.
Fortunately, there's a command just for this situation. IsLoading: "Returns true if the part program is loading rather than being actually run (e.g. so the toolpath is being generated or regenerated)."
So my little while loop code becomes:
If IsLoading() Then
Else
While IsActive(Input2)
ActivateSignal(OUTPUT8)
Wend
While IsActive(Input3)
DeActivateSignal(OUTPUT8)
Wend
End If
This tells Mach to go on to the next command if it's loading, otherwise do the code.
I knew I had to be missing something simple.
Then again, I guess it's only simple once you've figured it out.
Regards,
Walt
To elaborate. The following code works fine by itself:
While IsActive(Input2)
ActivateSignal(OUTPUT8)
Wend
While IsActive(Input3)
DeActivateSignal(OUTPUT8)
Wend
But when Mach3 loads a program, it does a run simulation as it loads each command. This way it checks commands for syntax and draws the toolpath display. When it encounters code that depends on a mechanical action to continue, it will sit there and wait for that action to occur. Obviously this will never happen since it's a simulation.
Fortunately, there's a command just for this situation. IsLoading: "Returns true if the part program is loading rather than being actually run (e.g. so the toolpath is being generated or regenerated)."
So my little while loop code becomes:
If IsLoading() Then
Else
While IsActive(Input2)
ActivateSignal(OUTPUT8)
Wend
While IsActive(Input3)
DeActivateSignal(OUTPUT8)
Wend
End If
This tells Mach to go on to the next command if it's loading, otherwise do the code.
I knew I had to be missing something simple.
Then again, I guess it's only simple once you've figured it out.
Regards,
Walt