951
General Mach Discussion / New Mach3 v4 VB Interface
« on: October 16, 2009, 09:45:49 PM »
Below is the proposed set of VB functions to be supported in the first release of the Mach3 v4 VB interface, excluding Modbus and Serial. Modbus will remain unchanged for now, and Serial support will be completely new, but is, as yet, undefined.
All you VB users, please review, and if you see any missing functionality, or have questions about what some of the functions do, or how, please let me know. The interfaces have been "regularized", to make them more consistent, and in the hopes of making the functions more clear just from the names. Redundancy has been eliminated, and arguments and return values are now also consistent. So, for example, in the old interface, FeedRate returned the FeedRate in units/min, but SetFeedRate set the new FeedRate in units/second, the new GetFeedRate and SetFeedRate both operate in units/minute. The "Is" functions now all return Booleans, rather than Integers. Overall, it should be FAR easier to learn to write and debug Mach3 macros.
There are also countless "invisible" changes that will eliminate some of the more frustrating aspects of Mach3 programming. For example, it should normally *never* be necessary to insert wait loops or Sleeps in the code, as it currently is. Execution will be far more deterministic, with far fewer hidden pitfalls.
Port/Signal I/O:
Sub AssertOutput(Signal As Integer)
Sub DeassertOutput(Signal As Integer)
Function IsInputAsserted(Signal As Integer)As Boolean
Function IsSignalDefined(Signal As Integer) As Boolean
Function IsOutputAsserted(Signal As Integer) As Boolean
File I/O:
Sub OpenDigFile()
Sub CloseDigFile()
Function OpenTeachFile (Filename As String) As Integer
Function AppendTeachFile(Filename As String) As Integer
Sub CloseTeachFile() As Integer
Sub LoadTeachFile() As Integer
Function GetFileName() As String
Function GetMach3Folder() As String
Sub LoadProgram(FilePath As String) As Integer
Sub LoadAndRunProgram(FilePath As String) As Integer
Sub RunProgram() As Integer
Sub LoadWizard(WizardName As String) As Integer
Screenset/UserI/O:
Function AskUserForDouble() As Double
Function AskUserForText() As String
Function AskUser(Prompt, “Title” As String, DialogType As Integer) As Integer
Sub ErrorMessage(MessageText As String)
Sub TickerMessage(TickerNum As Integer, TickerText As String)
Function AskUserForCoords(Prompt As String) As Integer
Function GetXCoord() As Double
Function GetYCoord() As Double
Function GetZCoord() As Double
Function GetACoord() As Double
Function GetBCoord() As Double
Function GetCCoord() As Double
Sub DoOEMButton(OEMButtonCode As Integer)
Function GetOEMLED(LEDNum As Integer) As Integer
Sub SetOEMDRO(DRONum As Integer, DROVal as Double)
Function GetOEMDRO(DRONum As Integer) As Double
Sub SetUserLED(LEDNum As Integer, State As Integer)
Function GetUserLED(LEDNum As Integer) As Integer
Sub SetUserDRO(DRONum As Integer, DROVal As Double)
Function GetUserDRO(DRONum As Integer) As Double
Sub SetVar(VarNum As Integer, Val As Double)
Function GetVar(VarNum As Integer) As Double
Sub SetUserLabel(LabelNum As Integer, LabelText As String)
Function GetUserLabel(LabelNum As Integer) As String
Sub SetButtonText(Text As String)
Function GetButtonText() As String
Sub SetScreensetPage()
Function GetScreensetPage() As Integer
Sub ToggleScreenset()
Sub ReloadScreenset()
Sub SetTriggerMacro(Signal As Integer, MacroName As String)
G-Code:
Sub SetBufferedCodeState(Boolean)
Function GetBufferedCodeState() As Boolean
Sub Code(Gcode As String)
Machine Control:
Sub SpindleOn(DIR)
Sub DoSpinCW()
Sub SpindleOff()
Sub SetRPM(RPM As Integer)
Function GetRPM() As Double
Function IsSpindleOn() As Boolean
Sub SetFeedRate(FeedRate As Double)
Function GetFeedRate() As Double
Sub Function CoupleSlave(MasterAxis As Integer, SlaveAxis As Integer)
Sub UncoupleSlave()
Function GetCurrentTool() As Integer
Sub SetIJIncremental(Boolean)
Function IsIJIncremental() As Boolean
Sub SetSafeZPos(SafeZ As Double)
Function GetSafeZPos() As Double
Sub GotoSafeZ()
Function IsSafeZEnabled() As Boolean
Sub SetAxisScale(Axis As Integer, Scale As Double)
Function GetAxisScale(Axis As Integer) As Double
Function GetSelectedTool() As Integer
Sub SetCurrentTool(ToolNum As Integer)
Function GetAxisToolChangeStartPos()
Function GetToolDesc(ToolNum As Integer) As String
Sub SetToolParam(ToolNum As Integer, ParamNum As Integer, ParamVal As Double)
Function GetToolParam(ToolNum As Integer, ParamNum As Integer)
Function ToolLengthOffset() As Double
Sub SetParam(ParamName As String, ParamVal As Double)
Function GetParam(ParamName As String) As Double
Function IsInEStop() As Boolean
Function IsProgramLoading() As Boolean
Function IsMoving() As Boolean
Function GetXMaxExtent() As Double
Function GetYMaxExtent() As Double
Function GetXMinExtent() As Double
Function GetYMinExtent() As Double
Sub WaitForTrigger(Signal As Integer)
Sub SwapAxis(FirstAxis As Integer, SecondAxis As Integer)
Sub UnSwapAxis()
Sub AxisJogOff(Axis As Integer)
Sub AxisJogOn(Axis As Integer, Dir as Integer)
Sub FeedMove(X, Y, Z, A, B, C As Double)
Sub RapidMove(X, Y, Z, A, B, C As Double)
Function SingleVerifyReport(Axis As Integer)
Sub SingleVerify(Axis As Integer)
Sub VerifyAxis(Silent As Boolean)
Sub RefCombination(Axes As Integer)
Sub THCOff()
Sub THCOn()
Sub ZeroTHC()
Sub ResetTHC()
Sub NotifyPlugins(Event As Integer)
Function QueueDepth() As Integer
Function CannedCycleRetractMode() As Integer
Sub SaveWizard() As Integer
Function SetAxisFormula(Axis As Integer, Formula As String) As Integer
Sub SetSpindlePulley(Pulley As Integer)
Lathe Only:
Function IsDiameterMode() As Boolean
Function GetToolTurretAng() As Double
VB/Misc:
Function PParameter() As Double
Function QParameter() As Double
Function RParameter() As Double
Sub PlayWave(Filename As String)
Sub Sleep(Time As Integer)
Sub Speak(TextToSpeak As String)
Function GetVBVersion() As String
Function GetMach3Version() As String
All you VB users, please review, and if you see any missing functionality, or have questions about what some of the functions do, or how, please let me know. The interfaces have been "regularized", to make them more consistent, and in the hopes of making the functions more clear just from the names. Redundancy has been eliminated, and arguments and return values are now also consistent. So, for example, in the old interface, FeedRate returned the FeedRate in units/min, but SetFeedRate set the new FeedRate in units/second, the new GetFeedRate and SetFeedRate both operate in units/minute. The "Is" functions now all return Booleans, rather than Integers. Overall, it should be FAR easier to learn to write and debug Mach3 macros.
There are also countless "invisible" changes that will eliminate some of the more frustrating aspects of Mach3 programming. For example, it should normally *never* be necessary to insert wait loops or Sleeps in the code, as it currently is. Execution will be far more deterministic, with far fewer hidden pitfalls.
Port/Signal I/O:
Sub AssertOutput(Signal As Integer)
Sub DeassertOutput(Signal As Integer)
Function IsInputAsserted(Signal As Integer)As Boolean
Function IsSignalDefined(Signal As Integer) As Boolean
Function IsOutputAsserted(Signal As Integer) As Boolean
File I/O:
Sub OpenDigFile()
Sub CloseDigFile()
Function OpenTeachFile (Filename As String) As Integer
Function AppendTeachFile(Filename As String) As Integer
Sub CloseTeachFile() As Integer
Sub LoadTeachFile() As Integer
Function GetFileName() As String
Function GetMach3Folder() As String
Sub LoadProgram(FilePath As String) As Integer
Sub LoadAndRunProgram(FilePath As String) As Integer
Sub RunProgram() As Integer
Sub LoadWizard(WizardName As String) As Integer
Screenset/UserI/O:
Function AskUserForDouble() As Double
Function AskUserForText() As String
Function AskUser(Prompt, “Title” As String, DialogType As Integer) As Integer
Sub ErrorMessage(MessageText As String)
Sub TickerMessage(TickerNum As Integer, TickerText As String)
Function AskUserForCoords(Prompt As String) As Integer
Function GetXCoord() As Double
Function GetYCoord() As Double
Function GetZCoord() As Double
Function GetACoord() As Double
Function GetBCoord() As Double
Function GetCCoord() As Double
Sub DoOEMButton(OEMButtonCode As Integer)
Function GetOEMLED(LEDNum As Integer) As Integer
Sub SetOEMDRO(DRONum As Integer, DROVal as Double)
Function GetOEMDRO(DRONum As Integer) As Double
Sub SetUserLED(LEDNum As Integer, State As Integer)
Function GetUserLED(LEDNum As Integer) As Integer
Sub SetUserDRO(DRONum As Integer, DROVal As Double)
Function GetUserDRO(DRONum As Integer) As Double
Sub SetVar(VarNum As Integer, Val As Double)
Function GetVar(VarNum As Integer) As Double
Sub SetUserLabel(LabelNum As Integer, LabelText As String)
Function GetUserLabel(LabelNum As Integer) As String
Sub SetButtonText(Text As String)
Function GetButtonText() As String
Sub SetScreensetPage()
Function GetScreensetPage() As Integer
Sub ToggleScreenset()
Sub ReloadScreenset()
Sub SetTriggerMacro(Signal As Integer, MacroName As String)
G-Code:
Sub SetBufferedCodeState(Boolean)
Function GetBufferedCodeState() As Boolean
Sub Code(Gcode As String)
Machine Control:
Sub SpindleOn(DIR)
Sub DoSpinCW()
Sub SpindleOff()
Sub SetRPM(RPM As Integer)
Function GetRPM() As Double
Function IsSpindleOn() As Boolean
Sub SetFeedRate(FeedRate As Double)
Function GetFeedRate() As Double
Sub Function CoupleSlave(MasterAxis As Integer, SlaveAxis As Integer)
Sub UncoupleSlave()
Function GetCurrentTool() As Integer
Sub SetIJIncremental(Boolean)
Function IsIJIncremental() As Boolean
Sub SetSafeZPos(SafeZ As Double)
Function GetSafeZPos() As Double
Sub GotoSafeZ()
Function IsSafeZEnabled() As Boolean
Sub SetAxisScale(Axis As Integer, Scale As Double)
Function GetAxisScale(Axis As Integer) As Double
Function GetSelectedTool() As Integer
Sub SetCurrentTool(ToolNum As Integer)
Function GetAxisToolChangeStartPos()
Function GetToolDesc(ToolNum As Integer) As String
Sub SetToolParam(ToolNum As Integer, ParamNum As Integer, ParamVal As Double)
Function GetToolParam(ToolNum As Integer, ParamNum As Integer)
Function ToolLengthOffset() As Double
Sub SetParam(ParamName As String, ParamVal As Double)
Function GetParam(ParamName As String) As Double
Function IsInEStop() As Boolean
Function IsProgramLoading() As Boolean
Function IsMoving() As Boolean
Function GetXMaxExtent() As Double
Function GetYMaxExtent() As Double
Function GetXMinExtent() As Double
Function GetYMinExtent() As Double
Sub WaitForTrigger(Signal As Integer)
Sub SwapAxis(FirstAxis As Integer, SecondAxis As Integer)
Sub UnSwapAxis()
Sub AxisJogOff(Axis As Integer)
Sub AxisJogOn(Axis As Integer, Dir as Integer)
Sub FeedMove(X, Y, Z, A, B, C As Double)
Sub RapidMove(X, Y, Z, A, B, C As Double)
Function SingleVerifyReport(Axis As Integer)
Sub SingleVerify(Axis As Integer)
Sub VerifyAxis(Silent As Boolean)
Sub RefCombination(Axes As Integer)
Sub THCOff()
Sub THCOn()
Sub ZeroTHC()
Sub ResetTHC()
Sub NotifyPlugins(Event As Integer)
Function QueueDepth() As Integer
Function CannedCycleRetractMode() As Integer
Sub SaveWizard() As Integer
Function SetAxisFormula(Axis As Integer, Formula As String) As Integer
Sub SetSpindlePulley(Pulley As Integer)
Lathe Only:
Function IsDiameterMode() As Boolean
Function GetToolTurretAng() As Double
VB/Misc:
Function PParameter() As Double
Function QParameter() As Double
Function RParameter() As Double
Sub PlayWave(Filename As String)
Sub Sleep(Time As Integer)
Sub Speak(TextToSpeak As String)
Function GetVBVersion() As String
Function GetMach3Version() As String