unit Mach4_TLB;

// ************************************************************************ //
// WARNING                                                                    
// -------                                                                    
// The types declared in this file were generated from data read from a       
// Type Library. If this type library is explicitly or indirectly (via        
// another type library referring to this type library) re-imported, or the   
// 'Refresh' command of the Type Library Editor activated while editing the   
// Type Library, the contents of this file will be regenerated and all        
// manual modifications will be lost.                                         
// ************************************************************************ //

// PASTLWTR : 1.2
// File generated on 12/1/2008 12:23:13 PM from Type Library described below.

// ************************************************************************  //
// Type Lib: C:\Mach3\Mach3.exe (1)
// LIBID: {316FD4DD-E21C-4672-A938-0B36276C54A0}
// LCID: 0
// Helpfile: 
// HelpString: 
// DepndLst: 
//   (1) v2.0 stdole, (C:\Windows\SysWOW64\stdole2.tlb)
// Errors:
//   Hint: Parameter 'var' of IMyScriptObject.GetVar changed to 'var_'
//   Hint: Parameter 'var' of IMyScriptObject.SetVar changed to 'var_'
//   Hint: Parameter 'String' of IMyScriptObject.SendSerial changed to 'String_'
//   Hint: Parameter 'function' of IMyScriptObject.DoButton changed to 'function_'
//   Hint: Parameter 'Label' of IMyScriptObject.SetUserLabel changed to 'Label_'
//   Hint: Parameter 'type' of IMyScriptObject.tSetCutType changed to 'type_'
//   Hint: Parameter 'type' of IMyScriptObject.tSetInFeedType changed to 'type_'
//   Hint: Parameter 'Program' of IMyScriptObject.RunProgram changed to 'Program_'
//   Hint: Parameter 'type' of IMyScriptObject.MachMSG changed to 'type_'
// ************************************************************************ //
// *************************************************************************//
// NOTE:                                                                      
// Items guarded by $IFDEF_LIVE_SERVER_AT_DESIGN_TIME are used by properties  
// which return objects that may need to be explicitly created via a function 
// call prior to any access via the property. These items have been disabled  
// in order to prevent accidental use from within the object inspector. You   
// may enable them by defining LIVE_SERVER_AT_DESIGN_TIME or by selectively   
// removing them from the $IFDEF blocks. However, such items must still be    
// programmatically created via a method of the appropriate CoClass before    
// they can be used.                                                          
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. 
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
{$VARPROPSETTER ON}
interface

uses Windows, ActiveX, Classes, Graphics, OleServer, StdVCL, Variants;
  

// *********************************************************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:        
//   Type Libraries     : LIBID_xxxx                                      
//   CoClasses          : CLASS_xxxx                                      
//   DISPInterfaces     : DIID_xxxx                                       
//   Non-DISP interfaces: IID_xxxx                                        
// *********************************************************************//
const
  // TypeLibrary Major and minor versions
  Mach4MajorVersion = 1;
  Mach4MinorVersion = 0;

  LIBID_Mach4: TGUID = '{316FD4DD-E21C-4672-A938-0B36276C54A0}';

  DIID_IMach4: TGUID = '{D5DC1674-0CB6-47D4-BD22-E6D60631C86D}';
  DIID_IMyScriptObject: TGUID = '{F1D3EE6C-AB32-4996-B270-F415613F5BA3}';
  CLASS_CMach4Doc: TGUID = '{CA7992B2-2653-4342-8061-D7D385C07809}';
type

// *********************************************************************//
// Forward declaration of types defined in TypeLibrary                    
// *********************************************************************//
  IMach4 = dispinterface;
  IMyScriptObject = dispinterface;

// *********************************************************************//
// Declaration of CoClasses defined in Type Library                       
// (NOTE: Here we map each CoClass to its Default Interface)              
// *********************************************************************//
  CMach4Doc = IMach4;


// *********************************************************************//
// DispIntf:  IMach4
// Flags:     (4096) Dispatchable
// GUID:      {D5DC1674-0CB6-47D4-BD22-E6D60631C86D}
// *********************************************************************//
  IMach4 = dispinterface
    ['{D5DC1674-0CB6-47D4-BD22-E6D60631C86D}']
    procedure LoadGCodeFile(const FileName: WideString); dispid 1;
    procedure CloseFile; dispid 2;
    function GetScriptDispatch: IDispatch; dispid 3;
    procedure ShutDown; dispid 4;
  end;

// *********************************************************************//
// DispIntf:  IMyScriptObject
// Flags:     (4096) Dispatchable
// GUID:      {F1D3EE6C-AB32-4996-B270-F415613F5BA3}
// *********************************************************************//
  IMyScriptObject = dispinterface
    ['{F1D3EE6C-AB32-4996-B270-F415613F5BA3}']
    procedure StraightFeed(x: Double; y: Double; z: Double; a: Double; b: Double; c: Double); dispid 1;
    procedure HelpAbout; dispid 2;
    function GetSafeZ: Double; dispid 3;
    procedure SetSafeZ(SafeZ: Double); dispid 4;
    procedure SetCurrentTool(Tool: Smallint); dispid 5;
    function GetSelectedTool: Smallint; dispid 6;
    function GetToolChangeStart(Axis: Smallint): Double; dispid 7;
    procedure StraightTraverse(x: Double; y: Double; z: Double; a: Double; b: Double; c: Double); dispid 8;
    function ToolLengthOffset: Double; dispid 9;
    function CommandedFeed: Double; dispid 10;
    procedure SetFeedRate(Rate: Double); dispid 11;
    procedure ActivateSignal(Signal: Smallint); dispid 12;
    function IsActive(Signal: Smallint): {??Shortint}OleVariant; dispid 13;
    procedure DeActivateSignal(Signal: Smallint); dispid 14;
    procedure SystemWaitFor(Signal: Smallint); dispid 15;
    function Param1: Double; dispid 16;
    function Param2: Double; dispid 17;
    function Param3: Double; dispid 18;
    procedure VerifyAxis(Silent: Integer); dispid 19;
    function GetVar(var_: Smallint): Double; dispid 20;
    procedure SetVar(var_: Smallint; value: Double); dispid 21;
    procedure OpenDigFile; dispid 24;
    procedure CloseDigFile; dispid 25;
    procedure THCOn; dispid 26;
    procedure THCOff; dispid 27;
    procedure Code(const Command: WideString); dispid 28;
    function GetScale(Axis: Smallint): Double; dispid 29;
    procedure SetScale(Axis: Smallint; Scale: Double); dispid 30;
    procedure SendSerial(const String_: WideString); dispid 31;
    function GetPortByte(PortAddress: {??Word}OleVariant): Byte; dispid 32;
    function PutPortByte(PortAddress: {??Word}OleVariant; data: Byte): Smallint; dispid 33;
    function IsMoving: {??Word}OleVariant; dispid 34;
    procedure ResetTHC; dispid 35;
    function GetParam(const Param: WideString): Double; dispid 36;
    procedure SetParam(const Param: WideString; value: Double); dispid 37;
    procedure setobj(const thevar: WideString; thevalue: Double); dispid 38;
    function GetCurrentTol: Smallint; dispid 39;
    procedure DoOEMButton(Button: Smallint); dispid 40;
    procedure LoadRun(const FileName: WideString); dispid 41;
    procedure DoButton(function_: Smallint); dispid 42;
    function GetLED(Led: Smallint): WordBool; dispid 43;
    function GetOEMLed(Led: Smallint): WordBool; dispid 44;
    function GetOEMDRO(dro: Smallint): Double; dispid 45;
    function GetDRO(dro: Smallint): Double; dispid 46;
    procedure SetDRO(dro: Smallint; value: Double); dispid 47;
    procedure SetOEMDRO(dro: Smallint; value: Double); dispid 48;
    procedure GetCoord(const Question: WideString); dispid 49;
    function GetXCoor: Double; dispid 50;
    function GetYCoor: Double; dispid 51;
    function GetZCoor: Double; dispid 52;
    function GetACoor: Double; dispid 53;
    function IsFirst: WordBool; dispid 54;
    procedure SetMachZero(Axis: Smallint); dispid 55;
    procedure RunFile; dispid 56;
    procedure SetUserDRO(dro: Smallint; value: Double); dispid 57;
    procedure SetUserLED(Led: Smallint; state: Smallint); dispid 58;
    function GetUserDRO(dro: Smallint): Double; dispid 59;
    function GetUserLED(Led: Smallint): Smallint; dispid 60;
    function tXStart: Double; dispid 61;
    function tZStart: Double; dispid 62;
    function tEndX: Double; dispid 63;
    function tEndZ: Double; dispid 64;
    function tClearX: Double; dispid 65;
    function tLead: Double; dispid 66;
    function tSpring: Smallint; dispid 67;
    function tPasses: Smallint; dispid 68;
    function tChamfer: Double; dispid 69;
    function tTaper: Double; dispid 70;
    function tInFeed: Double; dispid 71;
    function tDepthLastPass: Double; dispid 72;
    function IsLoading: Smallint; dispid 73;
    function GetABSPostion(Axis: Smallint): Double; dispid 74;
    function GetRPM: Double; dispid 75;
    procedure DoSpinCW; dispid 76;
    procedure DoSpinCCW; dispid 77;
    procedure DoSpinStop; dispid 78;
    procedure SetSpinSpeed(rpm: Double); dispid 79;
    function InFeeds(iteration: Smallint): Double; dispid 80;
    function ThreadDepth(iteration: Smallint): Double; dispid 81;
    function tTapers(iteration: Smallint): Double; dispid 82;
    procedure SetTicker(TickerNum: Smallint; const Message: WideString); dispid 83;
    procedure SetUserLabel(LabelNum: Smallint; const Label_: WideString); dispid 84;
    procedure RefCombination(combo: Smallint); dispid 85;
    function IsSuchSignal(Signal: Smallint): Smallint; dispid 86;
    function OpenTeachFile(const name: WideString): Smallint; dispid 87;
    procedure CloseTeachFile; dispid 88;
    procedure SetButtonText(const Text: WideString); dispid 89;
    procedure LoadStandardLayout; dispid 90;
    procedure LoadTeachFile; dispid 91;
    function IsOutputActive(Signal: Smallint): WordBool; dispid 92;
    procedure SingleVerify; dispid 93;
    function GetPage: Smallint; dispid 94;
    procedure SetPage(page: Smallint); dispid 95;
    procedure ToggleScreens; dispid 96;
    procedure PlayWave(const wavename: WideString); dispid 97;
    procedure Speak(const Text: WideString); dispid 98;
    procedure Message(const Text: WideString); dispid 99;
    function IsStopped: Smallint; dispid 100;
    procedure SaveWizard; dispid 101;
    procedure SingleVerifyReport(Axis: Smallint); dispid 102;
    procedure SetIJMode(mode: Smallint); dispid 103;
    function GetIJMode: Smallint; dispid 104;
    function GetMinPass: Double; dispid 105;
    function AppendTeachFile(const name: WideString): Smallint; dispid 106;
    function Random: Double; dispid 107;
    function IsDiameter: Smallint; dispid 108;
    function ModGetInputWord(bit: Smallint): Smallint; dispid 109;
    function FillFromCoil(slave: Smallint; startAddress: Smallint; nBytes: Smallint): Smallint; dispid 110;
    function FillFromStatus(slave: Smallint; startAddress: Smallint; nBytes: Smallint): Smallint; dispid 111;
    function FillFromHolding(slave: Smallint; startAddress: Smallint; nBytes: Smallint): Smallint; dispid 112;
    function FillFromInput(slave: Smallint; startAddress: Smallint; nBytes: Smallint): Smallint; dispid 113;
    function GetModWord(index: Smallint): Smallint; dispid 114;
    function tMinDepth: Double; dispid 115;
    function tGetCutType: Smallint; dispid 116;
    function tGetInfeedType: Smallint; dispid 117;
    procedure tSetCutType(type_: Smallint); dispid 118;
    procedure tSetInFeedType(type_: Smallint); dispid 119;
    function OpenSubroutineFile(const name: WideString): Smallint; dispid 120;
    function tZClear: Double; dispid 121;
    function FeedRate: Double; dispid 122;
    function tCutDepth: Double; dispid 123;
    function FileName: WideString; dispid 124;
    function MinX: Double; dispid 125;
    function MaxX: Double; dispid 126;
    function MinY: Double; dispid 127;
    function MaxY: Double; dispid 128;
    function RetractMode: Smallint; dispid 129;
    procedure GotoSafeZ; dispid 130;
    procedure SetPulley(pulley: Smallint); dispid 131;
    procedure LoadWizard(const name: WideString); dispid 132;
    procedure SetOutput(word: Smallint); dispid 133;
    function GetInput(word: Smallint): Smallint; dispid 134;
    procedure SetModOutput(reg: Smallint; value: Smallint); dispid 135;
    procedure LoadFile(const FileName: WideString); dispid 136;
    procedure SetTriggerMacro(macro: Smallint); dispid 137;
    procedure SetHomannString(x: Smallint; y: Smallint; const Text: WideString); dispid 138;
    procedure JogOn(Axis: Smallint; dir: Smallint); dispid 139;
    procedure JogOff(Axis: Smallint); dispid 140;
    procedure OpenSubFile(const FileName: WideString); dispid 141;
    procedure SetToolX(value: Double); dispid 142;
    procedure SetToolZ(value: Double); dispid 143;
    function GetTurretAng: Double; dispid 144;
    function GetFiFoEntry: WideString; dispid 145;
    procedure RunProgram(const Program_: WideString); dispid 146;
    procedure SendFIFO(const com: WideString); dispid 147;
    function Round(val: Double): Double; dispid 148;
    function roun(val: Double): Double; dispid 149;
    function nFmt(val: Double; DEC: Smallint): Double; dispid 150;
    procedure ZeroTHC; dispid 151;
    function IsWiz: Smallint; dispid 152;
    procedure WaitForPoll; dispid 153;
    procedure SetModIOString(slave: Smallint; x: Smallint; y: Smallint; const OutText: WideString); dispid 154;
    procedure Sleep(time: Smallint); dispid 155;
    procedure SendFIFOcr(const data: WideString); dispid 156;
    procedure SendFIFObyte(data: Smallint); dispid 157;
    procedure SendFIFOword(data: Smallint); dispid 158;
    procedure SetTimer(timer: Smallint); dispid 159;
    function GetTimer(timer: Smallint): Double; dispid 160;
    function AskTextQuestion(const Question: WideString): WideString; dispid 161;
    function GetDROString(nDRO: Smallint): WideString; dispid 162;
    procedure LoadLinTable; dispid 163;
    procedure SwapAxis(Primary: Smallint; Secondary: Smallint); dispid 164;
    procedure ResetAxisSwap; dispid 165;
    procedure SetFormula(const Formula: WideString; Axis: Smallint); dispid 166;
    function IsProbing: Smallint; dispid 167;
    function GetInBit(index: Smallint; bit: Smallint): Smallint; dispid 168;
    procedure SetOutBit(index: Smallint; bit: Smallint); dispid 169;
    procedure ResetOutBit(index: Smallint; bit: Smallint); dispid 170;
    procedure SetProbeActive(level: Smallint); dispid 171;
    procedure StartVideo; dispid 172;
    procedure VBTest; dispid 173;
    procedure StartTHC; dispid 174;
    procedure EndTHC; dispid 175;
    procedure CoupleSlave(state: Smallint); dispid 176;
    function GetToolParam(toolnum: Smallint; Param: Smallint): Double; dispid 177;
    procedure SetToolParam(toolnum: Smallint; Param: Smallint; data: Double); dispid 178;
    procedure SetProbeState(state: Smallint); dispid 179;
    function GetMainFolder: WideString; dispid 180;
    procedure DoMenu(sub: Smallint; pos: Smallint); dispid 181;
    function GetMasterInput(Param: Smallint): Smallint; dispid 182;
    function GetMasterOutput(Param: Smallint): Smallint; dispid 183;
    procedure SetMasterOutput(Param: Smallint; value: Smallint); dispid 184;
    procedure SetMasterInput(Param: Smallint; value: Smallint); dispid 185;
    function GetUserLabel(nLabel: Smallint): WideString; dispid 186;
    function GetToolDesc(Tool: Smallint): WideString; dispid 187;
    function IsSafeZ: Smallint; dispid 188;
    procedure MachMSG(const Mess: WideString; const Title: WideString; type_: Smallint); dispid 189;
  end;

// *********************************************************************//
// The Class CoCMach4Doc provides a Create and CreateRemote method to          
// create instances of the default interface IMach4 exposed by              
// the CoClass CMach4Doc. The functions are intended to be used by             
// clients wishing to automate the CoClass objects exposed by the         
// server of this typelibrary.                                            
// *********************************************************************//
  CoCMach4Doc = class
    class function Create: IMach4;
    class function CreateRemote(const MachineName: string): IMach4;
  end;

  TCMach4DocStraightFeed = procedure(ASender: TObject; x: Double; y: Double; z: Double; a: Double; 
                                                       b: Double; c: Double) of object;
  TCMach4DocSetSafeZ = procedure(ASender: TObject; SafeZ: Double) of object;
  TCMach4DocSetCurrentTool = procedure(ASender: TObject; Tool: Smallint) of object;
  TCMach4DocGetToolChangeStart = procedure(ASender: TObject; Axis: Smallint) of object;
  TCMach4DocStraightTraverse = procedure(ASender: TObject; x: Double; y: Double; z: Double; 
                                                           a: Double; b: Double; c: Double) of object;
  TCMach4DocSetFeedRate = procedure(ASender: TObject; Rate: Double) of object;
  TCMach4DocActivateSignal = procedure(ASender: TObject; Signal: Smallint) of object;
  TCMach4DocIsActive = procedure(ASender: TObject; Signal: Smallint) of object;
  TCMach4DocDeActivateSignal = procedure(ASender: TObject; Signal: Smallint) of object;
  TCMach4DocSystemWaitFor = procedure(ASender: TObject; Signal: Smallint) of object;
  TCMach4DocVerifyAxis = procedure(ASender: TObject; Silent: Integer) of object;
  TCMach4DocGetVar = procedure(ASender: TObject; var_: Smallint) of object;
  TCMach4DocSetVar = procedure(ASender: TObject; var_: Smallint; value: Double) of object;
  TCMach4DocCode = procedure(ASender: TObject; const Command: WideString) of object;
  TCMach4DocGetScale = procedure(ASender: TObject; Axis: Smallint) of object;
  TCMach4DocSetScale = procedure(ASender: TObject; Axis: Smallint; Scale: Double) of object;
  TCMach4DocSendSerial = procedure(ASender: TObject; const String_: WideString) of object;
  TCMach4DocGetPortByte = procedure(ASender: TObject; PortAddress: {??Word}OleVariant) of object;
  TCMach4DocPutPortByte = procedure(ASender: TObject; PortAddress: {??Word}OleVariant; data: Byte) of object;
  TCMach4DocGetParam = procedure(ASender: TObject; const Param: WideString) of object;
  TCMach4DocSetParam = procedure(ASender: TObject; const Param: WideString; value: Double) of object;
  TCMach4Docsetobj = procedure(ASender: TObject; const thevar: WideString; thevalue: Double) of object;
  TCMach4DocDoOEMButton = procedure(ASender: TObject; Button: Smallint) of object;
  TCMach4DocLoadRun = procedure(ASender: TObject; const FileName: WideString) of object;
  TCMach4DocDoButton = procedure(ASender: TObject; function_: Smallint) of object;
  TCMach4DocGetLED = procedure(ASender: TObject; Led: Smallint) of object;
  TCMach4DocGetOEMLed = procedure(ASender: TObject; Led: Smallint) of object;
  TCMach4DocGetOEMDRO = procedure(ASender: TObject; dro: Smallint) of object;
  TCMach4DocGetDRO = procedure(ASender: TObject; dro: Smallint) of object;
  TCMach4DocSetDRO = procedure(ASender: TObject; dro: Smallint; value: Double) of object;
  TCMach4DocSetOEMDRO = procedure(ASender: TObject; dro: Smallint; value: Double) of object;
  TCMach4DocGetCoord = procedure(ASender: TObject; const Question: WideString) of object;
  TCMach4DocSetMachZero = procedure(ASender: TObject; Axis: Smallint) of object;
  TCMach4DocSetUserDRO = procedure(ASender: TObject; dro: Smallint; value: Double) of object;
  TCMach4DocSetUserLED = procedure(ASender: TObject; Led: Smallint; state: Smallint) of object;
  TCMach4DocGetUserDRO = procedure(ASender: TObject; dro: Smallint) of object;
  TCMach4DocGetUserLED = procedure(ASender: TObject; Led: Smallint) of object;
  TCMach4DocGetABSPostion = procedure(ASender: TObject; Axis: Smallint) of object;
  TCMach4DocSetSpinSpeed = procedure(ASender: TObject; rpm: Double) of object;
  TCMach4DocInFeeds = procedure(ASender: TObject; iteration: Smallint) of object;
  TCMach4DocThreadDepth = procedure(ASender: TObject; iteration: Smallint) of object;
  TCMach4DoctTapers = procedure(ASender: TObject; iteration: Smallint) of object;
  TCMach4DocSetTicker = procedure(ASender: TObject; TickerNum: Smallint; const Message: WideString) of object;
  TCMach4DocSetUserLabel = procedure(ASender: TObject; LabelNum: Smallint; const Label_: WideString) of object;
  TCMach4DocRefCombination = procedure(ASender: TObject; combo: Smallint) of object;
  TCMach4DocIsSuchSignal = procedure(ASender: TObject; Signal: Smallint) of object;
  TCMach4DocOpenTeachFile = procedure(ASender: TObject; const name: WideString) of object;
  TCMach4DocSetButtonText = procedure(ASender: TObject; const Text: WideString) of object;
  TCMach4DocIsOutputActive = procedure(ASender: TObject; Signal: Smallint) of object;
  TCMach4DocSetPage = procedure(ASender: TObject; page: Smallint) of object;
  TCMach4DocPlayWave = procedure(ASender: TObject; const wavename: WideString) of object;
  TCMach4DocSpeak = procedure(ASender: TObject; const Text: WideString) of object;
  TCMach4DocMessage = procedure(ASender: TObject; const Text: WideString) of object;
  TCMach4DocSingleVerifyReport = procedure(ASender: TObject; Axis: Smallint) of object;
  TCMach4DocSetIJMode = procedure(ASender: TObject; mode: Smallint) of object;
  TCMach4DocAppendTeachFile = procedure(ASender: TObject; const name: WideString) of object;
  TCMach4DocModGetInputWord = procedure(ASender: TObject; bit: Smallint) of object;
  TCMach4DocFillFromCoil = procedure(ASender: TObject; slave: Smallint; startAddress: Smallint; 
                                                       nBytes: Smallint) of object;
  TCMach4DocFillFromStatus = procedure(ASender: TObject; slave: Smallint; startAddress: Smallint; 
                                                         nBytes: Smallint) of object;
  TCMach4DocFillFromHolding = procedure(ASender: TObject; slave: Smallint; startAddress: Smallint; 
                                                          nBytes: Smallint) of object;
  TCMach4DocFillFromInput = procedure(ASender: TObject; slave: Smallint; startAddress: Smallint; 
                                                        nBytes: Smallint) of object;
  TCMach4DocGetModWord = procedure(ASender: TObject; index: Smallint) of object;
  TCMach4DoctSetCutType = procedure(ASender: TObject; type_: Smallint) of object;
  TCMach4DoctSetInFeedType = procedure(ASender: TObject; type_: Smallint) of object;
  TCMach4DocOpenSubroutineFile = procedure(ASender: TObject; const name: WideString) of object;
  TCMach4DocSetPulley = procedure(ASender: TObject; pulley: Smallint) of object;
  TCMach4DocLoadWizard = procedure(ASender: TObject; const name: WideString) of object;
  TCMach4DocSetOutput = procedure(ASender: TObject; word: Smallint) of object;
  TCMach4DocGetInput = procedure(ASender: TObject; word: Smallint) of object;
  TCMach4DocSetModOutput = procedure(ASender: TObject; reg: Smallint; value: Smallint) of object;
  TCMach4DocLoadFile = procedure(ASender: TObject; const FileName: WideString) of object;
  TCMach4DocSetTriggerMacro = procedure(ASender: TObject; macro: Smallint) of object;
  TCMach4DocSetHomannString = procedure(ASender: TObject; x: Smallint; y: Smallint; 
                                                          const Text: WideString) of object;
  TCMach4DocJogOn = procedure(ASender: TObject; Axis: Smallint; dir: Smallint) of object;
  TCMach4DocJogOff = procedure(ASender: TObject; Axis: Smallint) of object;
  TCMach4DocOpenSubFile = procedure(ASender: TObject; const FileName: WideString) of object;
  TCMach4DocSetToolX = procedure(ASender: TObject; value: Double) of object;
  TCMach4DocSetToolZ = procedure(ASender: TObject; value: Double) of object;
  TCMach4DocRunProgram = procedure(ASender: TObject; const Program_: WideString) of object;
  TCMach4DocSendFIFO = procedure(ASender: TObject; const com: WideString) of object;
  TCMach4DocRound = procedure(ASender: TObject; val: Double) of object;
  TCMach4Docroun = procedure(ASender: TObject; val: Double) of object;
  TCMach4DocnFmt = procedure(ASender: TObject; val: Double; DEC: Smallint) of object;
  TCMach4DocSetModIOString = procedure(ASender: TObject; slave: Smallint; x: Smallint; y: Smallint; 
                                                         const OutText: WideString) of object;
  TCMach4DocSleep = procedure(ASender: TObject; time: Smallint) of object;
  TCMach4DocSendFIFOcr = procedure(ASender: TObject; const data: WideString) of object;
  TCMach4DocSendFIFObyte = procedure(ASender: TObject; data: Smallint) of object;
  TCMach4DocSendFIFOword = procedure(ASender: TObject; data: Smallint) of object;
  TCMach4DocSetTimer = procedure(ASender: TObject; timer: Smallint) of object;
  TCMach4DocGetTimer = procedure(ASender: TObject; timer: Smallint) of object;
  TCMach4DocAskTextQuestion = procedure(ASender: TObject; const Question: WideString) of object;
  TCMach4DocGetDROString = procedure(ASender: TObject; nDRO: Smallint) of object;
  TCMach4DocSwapAxis = procedure(ASender: TObject; Primary: Smallint; Secondary: Smallint) of object;
  TCMach4DocSetFormula = procedure(ASender: TObject; const Formula: WideString; Axis: Smallint) of object;
  TCMach4DocGetInBit = procedure(ASender: TObject; index: Smallint; bit: Smallint) of object;
  TCMach4DocSetOutBit = procedure(ASender: TObject; index: Smallint; bit: Smallint) of object;
  TCMach4DocResetOutBit = procedure(ASender: TObject; index: Smallint; bit: Smallint) of object;
  TCMach4DocSetProbeActive = procedure(ASender: TObject; level: Smallint) of object;
  TCMach4DocCoupleSlave = procedure(ASender: TObject; state: Smallint) of object;
  TCMach4DocGetToolParam = procedure(ASender: TObject; toolnum: Smallint; Param: Smallint) of object;
  TCMach4DocSetToolParam = procedure(ASender: TObject; toolnum: Smallint; Param: Smallint; 
                                                       data: Double) of object;
  TCMach4DocSetProbeState = procedure(ASender: TObject; state: Smallint) of object;
  TCMach4DocDoMenu = procedure(ASender: TObject; sub: Smallint; pos: Smallint) of object;
  TCMach4DocGetMasterInput = procedure(ASender: TObject; Param: Smallint) of object;
  TCMach4DocGetMasterOutput = procedure(ASender: TObject; Param: Smallint) of object;
  TCMach4DocSetMasterOutput = procedure(ASender: TObject; Param: Smallint; value: Smallint) of object;
  TCMach4DocSetMasterInput = procedure(ASender: TObject; Param: Smallint; value: Smallint) of object;
  TCMach4DocGetUserLabel = procedure(ASender: TObject; nLabel: Smallint) of object;
  TCMach4DocGetToolDesc = procedure(ASender: TObject; Tool: Smallint) of object;
  TCMach4DocMachMSG = procedure(ASender: TObject; const Mess: WideString; const Title: WideString; 
                                                  type_: Smallint) of object;


// *********************************************************************//
// OLE Server Proxy class declaration
// Server Object    : TCMach4Doc
// Help String      : 
// Default Interface: IMach4
// Def. Intf. DISP? : Yes
// Event   Interface: IMyScriptObject
// TypeFlags        : (2) CanCreate
// *********************************************************************//
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  TCMach4DocProperties= class;
{$ENDIF}
  TCMach4Doc = class(TOleServer)
  private
    FOnStraightFeed: TCMach4DocStraightFeed;
    FOnHelpAbout: TNotifyEvent;
    FOnGetSafeZ: TNotifyEvent;
    FOnSetSafeZ: TCMach4DocSetSafeZ;
    FOnSetCurrentTool: TCMach4DocSetCurrentTool;
    FOnGetSelectedTool: TNotifyEvent;
    FOnGetToolChangeStart: TCMach4DocGetToolChangeStart;
    FOnStraightTraverse: TCMach4DocStraightTraverse;
    FOnToolLengthOffset: TNotifyEvent;
    FOnCommandedFeed: TNotifyEvent;
    FOnSetFeedRate: TCMach4DocSetFeedRate;
    FOnActivateSignal: TCMach4DocActivateSignal;
    FOnIsActive: TCMach4DocIsActive;
    FOnDeActivateSignal: TCMach4DocDeActivateSignal;
    FOnSystemWaitFor: TCMach4DocSystemWaitFor;
    FOnParam1: TNotifyEvent;
    FOnParam2: TNotifyEvent;
    FOnParam3: TNotifyEvent;
    FOnVerifyAxis: TCMach4DocVerifyAxis;
    FOnGetVar: TCMach4DocGetVar;
    FOnSetVar: TCMach4DocSetVar;
    FOnOpenDigFile: TNotifyEvent;
    FOnCloseDigFile: TNotifyEvent;
    FOnTHCOn: TNotifyEvent;
    FOnTHCOff: TNotifyEvent;
    FOnCode: TCMach4DocCode;
    FOnGetScale: TCMach4DocGetScale;
    FOnSetScale: TCMach4DocSetScale;
    FOnSendSerial: TCMach4DocSendSerial;
    FOnGetPortByte: TCMach4DocGetPortByte;
    FOnPutPortByte: TCMach4DocPutPortByte;
    FOnIsMoving: TNotifyEvent;
    FOnResetTHC: TNotifyEvent;
    FOnGetParam: TCMach4DocGetParam;
    FOnSetParam: TCMach4DocSetParam;
    FOnsetobj: TCMach4Docsetobj;
    FOnGetCurrentTol: TNotifyEvent;
    FOnDoOEMButton: TCMach4DocDoOEMButton;
    FOnLoadRun: TCMach4DocLoadRun;
    FOnDoButton: TCMach4DocDoButton;
    FOnGetLED: TCMach4DocGetLED;
    FOnGetOEMLed: TCMach4DocGetOEMLed;
    FOnGetOEMDRO: TCMach4DocGetOEMDRO;
    FOnGetDRO: TCMach4DocGetDRO;
    FOnSetDRO: TCMach4DocSetDRO;
    FOnSetOEMDRO: TCMach4DocSetOEMDRO;
    FOnGetCoord: TCMach4DocGetCoord;
    FOnGetXCoor: TNotifyEvent;
    FOnGetYCoor: TNotifyEvent;
    FOnGetZCoor: TNotifyEvent;
    FOnGetACoor: TNotifyEvent;
    FOnIsFirst: TNotifyEvent;
    FOnSetMachZero: TCMach4DocSetMachZero;
    FOnRunFile: TNotifyEvent;
    FOnSetUserDRO: TCMach4DocSetUserDRO;
    FOnSetUserLED: TCMach4DocSetUserLED;
    FOnGetUserDRO: TCMach4DocGetUserDRO;
    FOnGetUserLED: TCMach4DocGetUserLED;
    FOntXStart: TNotifyEvent;
    FOntZStart: TNotifyEvent;
    FOntEndX: TNotifyEvent;
    FOntEndZ: TNotifyEvent;
    FOntClearX: TNotifyEvent;
    FOntLead: TNotifyEvent;
    FOntSpring: TNotifyEvent;
    FOntPasses: TNotifyEvent;
    FOntChamfer: TNotifyEvent;
    FOntTaper: TNotifyEvent;
    FOntInFeed: TNotifyEvent;
    FOntDepthLastPass: TNotifyEvent;
    FOnIsLoading: TNotifyEvent;
    FOnGetABSPostion: TCMach4DocGetABSPostion;
    FOnGetRPM: TNotifyEvent;
    FOnDoSpinCW: TNotifyEvent;
    FOnDoSpinCCW: TNotifyEvent;
    FOnDoSpinStop: TNotifyEvent;
    FOnSetSpinSpeed: TCMach4DocSetSpinSpeed;
    FOnInFeeds: TCMach4DocInFeeds;
    FOnThreadDepth: TCMach4DocThreadDepth;
    FOntTapers: TCMach4DoctTapers;
    FOnSetTicker: TCMach4DocSetTicker;
    FOnSetUserLabel: TCMach4DocSetUserLabel;
    FOnRefCombination: TCMach4DocRefCombination;
    FOnIsSuchSignal: TCMach4DocIsSuchSignal;
    FOnOpenTeachFile: TCMach4DocOpenTeachFile;
    FOnCloseTeachFile: TNotifyEvent;
    FOnSetButtonText: TCMach4DocSetButtonText;
    FOnLoadStandardLayout: TNotifyEvent;
    FOnLoadTeachFile: TNotifyEvent;
    FOnIsOutputActive: TCMach4DocIsOutputActive;
    FOnSingleVerify: TNotifyEvent;
    FOnGetPage: TNotifyEvent;
    FOnSetPage: TCMach4DocSetPage;
    FOnToggleScreens: TNotifyEvent;
    FOnPlayWave: TCMach4DocPlayWave;
    FOnSpeak: TCMach4DocSpeak;
    FOnMessage: TCMach4DocMessage;
    FOnIsStopped: TNotifyEvent;
    FOnSaveWizard: TNotifyEvent;
    FOnSingleVerifyReport: TCMach4DocSingleVerifyReport;
    FOnSetIJMode: TCMach4DocSetIJMode;
    FOnGetIJMode: TNotifyEvent;
    FOnGetMinPass: TNotifyEvent;
    FOnAppendTeachFile: TCMach4DocAppendTeachFile;
    FOnRandom: TNotifyEvent;
    FOnIsDiameter: TNotifyEvent;
    FOnModGetInputWord: TCMach4DocModGetInputWord;
    FOnFillFromCoil: TCMach4DocFillFromCoil;
    FOnFillFromStatus: TCMach4DocFillFromStatus;
    FOnFillFromHolding: TCMach4DocFillFromHolding;
    FOnFillFromInput: TCMach4DocFillFromInput;
    FOnGetModWord: TCMach4DocGetModWord;
    FOntMinDepth: TNotifyEvent;
    FOntGetCutType: TNotifyEvent;
    FOntGetInfeedType: TNotifyEvent;
    FOntSetCutType: TCMach4DoctSetCutType;
    FOntSetInFeedType: TCMach4DoctSetInFeedType;
    FOnOpenSubroutineFile: TCMach4DocOpenSubroutineFile;
    FOntZClear: TNotifyEvent;
    FOnFeedRate: TNotifyEvent;
    FOntCutDepth: TNotifyEvent;
    FOnFileName: TNotifyEvent;
    FOnMinX: TNotifyEvent;
    FOnMaxX: TNotifyEvent;
    FOnMinY: TNotifyEvent;
    FOnMaxY: TNotifyEvent;
    FOnRetractMode: TNotifyEvent;
    FOnGotoSafeZ: TNotifyEvent;
    FOnSetPulley: TCMach4DocSetPulley;
    FOnLoadWizard: TCMach4DocLoadWizard;
    FOnSetOutput: TCMach4DocSetOutput;
    FOnGetInput: TCMach4DocGetInput;
    FOnSetModOutput: TCMach4DocSetModOutput;
    FOnLoadFile: TCMach4DocLoadFile;
    FOnSetTriggerMacro: TCMach4DocSetTriggerMacro;
    FOnSetHomannString: TCMach4DocSetHomannString;
    FOnJogOn: TCMach4DocJogOn;
    FOnJogOff: TCMach4DocJogOff;
    FOnOpenSubFile: TCMach4DocOpenSubFile;
    FOnSetToolX: TCMach4DocSetToolX;
    FOnSetToolZ: TCMach4DocSetToolZ;
    FOnGetTurretAng: TNotifyEvent;
    FOnGetFiFoEntry: TNotifyEvent;
    FOnRunProgram: TCMach4DocRunProgram;
    FOnSendFIFO: TCMach4DocSendFIFO;
    FOnRound: TCMach4DocRound;
    FOnroun: TCMach4Docroun;
    FOnnFmt: TCMach4DocnFmt;
    FOnZeroTHC: TNotifyEvent;
    FOnIsWiz: TNotifyEvent;
    FOnWaitForPoll: TNotifyEvent;
    FOnSetModIOString: TCMach4DocSetModIOString;
    FOnSleep: TCMach4DocSleep;
    FOnSendFIFOcr: TCMach4DocSendFIFOcr;
    FOnSendFIFObyte: TCMach4DocSendFIFObyte;
    FOnSendFIFOword: TCMach4DocSendFIFOword;
    FOnSetTimer: TCMach4DocSetTimer;
    FOnGetTimer: TCMach4DocGetTimer;
    FOnAskTextQuestion: TCMach4DocAskTextQuestion;
    FOnGetDROString: TCMach4DocGetDROString;
    FOnLoadLinTable: TNotifyEvent;
    FOnSwapAxis: TCMach4DocSwapAxis;
    FOnResetAxisSwap: TNotifyEvent;
    FOnSetFormula: TCMach4DocSetFormula;
    FOnIsProbing: TNotifyEvent;
    FOnGetInBit: TCMach4DocGetInBit;
    FOnSetOutBit: TCMach4DocSetOutBit;
    FOnResetOutBit: TCMach4DocResetOutBit;
    FOnSetProbeActive: TCMach4DocSetProbeActive;
    FOnStartVideo: TNotifyEvent;
    FOnVBTest: TNotifyEvent;
    FOnStartTHC: TNotifyEvent;
    FOnEndTHC: TNotifyEvent;
    FOnCoupleSlave: TCMach4DocCoupleSlave;
    FOnGetToolParam: TCMach4DocGetToolParam;
    FOnSetToolParam: TCMach4DocSetToolParam;
    FOnSetProbeState: TCMach4DocSetProbeState;
    FOnGetMainFolder: TNotifyEvent;
    FOnDoMenu: TCMach4DocDoMenu;
    FOnGetMasterInput: TCMach4DocGetMasterInput;
    FOnGetMasterOutput: TCMach4DocGetMasterOutput;
    FOnSetMasterOutput: TCMach4DocSetMasterOutput;
    FOnSetMasterInput: TCMach4DocSetMasterInput;
    FOnGetUserLabel: TCMach4DocGetUserLabel;
    FOnGetToolDesc: TCMach4DocGetToolDesc;
    FOnIsSafeZ: TNotifyEvent;
    FOnMachMSG: TCMach4DocMachMSG;
    FIntf:        IMach4;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
    FProps:       TCMach4DocProperties;
    function      GetServerProperties: TCMach4DocProperties;
{$ENDIF}
    function      GetDefaultInterface: IMach4;
  protected
    procedure InitServerData; override;
    procedure InvokeEvent(DispID: TDispID; var Params: TVariantArray); override;
  public
    constructor Create(AOwner: TComponent); override;
    destructor  Destroy; override;
    procedure Connect; override;
    procedure ConnectTo(svrIntf: IMach4);
    procedure Disconnect; override;
    procedure LoadGCodeFile(const FileName: WideString);
    procedure CloseFile;
    function GetScriptDispatch: IDispatch;
    procedure ShutDown;
    property DefaultInterface: IMach4 read GetDefaultInterface;
  published
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
    property Server: TCMach4DocProperties read GetServerProperties;
{$ENDIF}
    property OnStraightFeed: TCMach4DocStraightFeed read FOnStraightFeed write FOnStraightFeed;
    property OnHelpAbout: TNotifyEvent read FOnHelpAbout write FOnHelpAbout;
    property OnGetSafeZ: TNotifyEvent read FOnGetSafeZ write FOnGetSafeZ;
    property OnSetSafeZ: TCMach4DocSetSafeZ read FOnSetSafeZ write FOnSetSafeZ;
    property OnSetCurrentTool: TCMach4DocSetCurrentTool read FOnSetCurrentTool write FOnSetCurrentTool;
    property OnGetSelectedTool: TNotifyEvent read FOnGetSelectedTool write FOnGetSelectedTool;
    property OnGetToolChangeStart: TCMach4DocGetToolChangeStart read FOnGetToolChangeStart write FOnGetToolChangeStart;
    property OnStraightTraverse: TCMach4DocStraightTraverse read FOnStraightTraverse write FOnStraightTraverse;
    property OnToolLengthOffset: TNotifyEvent read FOnToolLengthOffset write FOnToolLengthOffset;
    property OnCommandedFeed: TNotifyEvent read FOnCommandedFeed write FOnCommandedFeed;
    property OnSetFeedRate: TCMach4DocSetFeedRate read FOnSetFeedRate write FOnSetFeedRate;
    property OnActivateSignal: TCMach4DocActivateSignal read FOnActivateSignal write FOnActivateSignal;
    property OnIsActive: TCMach4DocIsActive read FOnIsActive write FOnIsActive;
    property OnDeActivateSignal: TCMach4DocDeActivateSignal read FOnDeActivateSignal write FOnDeActivateSignal;
    property OnSystemWaitFor: TCMach4DocSystemWaitFor read FOnSystemWaitFor write FOnSystemWaitFor;
    property OnParam1: TNotifyEvent read FOnParam1 write FOnParam1;
    property OnParam2: TNotifyEvent read FOnParam2 write FOnParam2;
    property OnParam3: TNotifyEvent read FOnParam3 write FOnParam3;
    property OnVerifyAxis: TCMach4DocVerifyAxis read FOnVerifyAxis write FOnVerifyAxis;
    property OnGetVar: TCMach4DocGetVar read FOnGetVar write FOnGetVar;
    property OnSetVar: TCMach4DocSetVar read FOnSetVar write FOnSetVar;
    property OnOpenDigFile: TNotifyEvent read FOnOpenDigFile write FOnOpenDigFile;
    property OnCloseDigFile: TNotifyEvent read FOnCloseDigFile write FOnCloseDigFile;
    property OnTHCOn: TNotifyEvent read FOnTHCOn write FOnTHCOn;
    property OnTHCOff: TNotifyEvent read FOnTHCOff write FOnTHCOff;
    property OnCode: TCMach4DocCode read FOnCode write FOnCode;
    property OnGetScale: TCMach4DocGetScale read FOnGetScale write FOnGetScale;
    property OnSetScale: TCMach4DocSetScale read FOnSetScale write FOnSetScale;
    property OnSendSerial: TCMach4DocSendSerial read FOnSendSerial write FOnSendSerial;
    property OnGetPortByte: TCMach4DocGetPortByte read FOnGetPortByte write FOnGetPortByte;
    property OnPutPortByte: TCMach4DocPutPortByte read FOnPutPortByte write FOnPutPortByte;
    property OnIsMoving: TNotifyEvent read FOnIsMoving write FOnIsMoving;
    property OnResetTHC: TNotifyEvent read FOnResetTHC write FOnResetTHC;
    property OnGetParam: TCMach4DocGetParam read FOnGetParam write FOnGetParam;
    property OnSetParam: TCMach4DocSetParam read FOnSetParam write FOnSetParam;
    property Onsetobj: TCMach4Docsetobj read FOnsetobj write FOnsetobj;
    property OnGetCurrentTol: TNotifyEvent read FOnGetCurrentTol write FOnGetCurrentTol;
    property OnDoOEMButton: TCMach4DocDoOEMButton read FOnDoOEMButton write FOnDoOEMButton;
    property OnLoadRun: TCMach4DocLoadRun read FOnLoadRun write FOnLoadRun;
    property OnDoButton: TCMach4DocDoButton read FOnDoButton write FOnDoButton;
    property OnGetLED: TCMach4DocGetLED read FOnGetLED write FOnGetLED;
    property OnGetOEMLed: TCMach4DocGetOEMLed read FOnGetOEMLed write FOnGetOEMLed;
    property OnGetOEMDRO: TCMach4DocGetOEMDRO read FOnGetOEMDRO write FOnGetOEMDRO;
    property OnGetDRO: TCMach4DocGetDRO read FOnGetDRO write FOnGetDRO;
    property OnSetDRO: TCMach4DocSetDRO read FOnSetDRO write FOnSetDRO;
    property OnSetOEMDRO: TCMach4DocSetOEMDRO read FOnSetOEMDRO write FOnSetOEMDRO;
    property OnGetCoord: TCMach4DocGetCoord read FOnGetCoord write FOnGetCoord;
    property OnGetXCoor: TNotifyEvent read FOnGetXCoor write FOnGetXCoor;
    property OnGetYCoor: TNotifyEvent read FOnGetYCoor write FOnGetYCoor;
    property OnGetZCoor: TNotifyEvent read FOnGetZCoor write FOnGetZCoor;
    property OnGetACoor: TNotifyEvent read FOnGetACoor write FOnGetACoor;
    property OnIsFirst: TNotifyEvent read FOnIsFirst write FOnIsFirst;
    property OnSetMachZero: TCMach4DocSetMachZero read FOnSetMachZero write FOnSetMachZero;
    property OnRunFile: TNotifyEvent read FOnRunFile write FOnRunFile;
    property OnSetUserDRO: TCMach4DocSetUserDRO read FOnSetUserDRO write FOnSetUserDRO;
    property OnSetUserLED: TCMach4DocSetUserLED read FOnSetUserLED write FOnSetUserLED;
    property OnGetUserDRO: TCMach4DocGetUserDRO read FOnGetUserDRO write FOnGetUserDRO;
    property OnGetUserLED: TCMach4DocGetUserLED read FOnGetUserLED write FOnGetUserLED;
    property OntXStart: TNotifyEvent read FOntXStart write FOntXStart;
    property OntZStart: TNotifyEvent read FOntZStart write FOntZStart;
    property OntEndX: TNotifyEvent read FOntEndX write FOntEndX;
    property OntEndZ: TNotifyEvent read FOntEndZ write FOntEndZ;
    property OntClearX: TNotifyEvent read FOntClearX write FOntClearX;
    property OntLead: TNotifyEvent read FOntLead write FOntLead;
    property OntSpring: TNotifyEvent read FOntSpring write FOntSpring;
    property OntPasses: TNotifyEvent read FOntPasses write FOntPasses;
    property OntChamfer: TNotifyEvent read FOntChamfer write FOntChamfer;
    property OntTaper: TNotifyEvent read FOntTaper write FOntTaper;
    property OntInFeed: TNotifyEvent read FOntInFeed write FOntInFeed;
    property OntDepthLastPass: TNotifyEvent read FOntDepthLastPass write FOntDepthLastPass;
    property OnIsLoading: TNotifyEvent read FOnIsLoading write FOnIsLoading;
    property OnGetABSPostion: TCMach4DocGetABSPostion read FOnGetABSPostion write FOnGetABSPostion;
    property OnGetRPM: TNotifyEvent read FOnGetRPM write FOnGetRPM;
    property OnDoSpinCW: TNotifyEvent read FOnDoSpinCW write FOnDoSpinCW;
    property OnDoSpinCCW: TNotifyEvent read FOnDoSpinCCW write FOnDoSpinCCW;
    property OnDoSpinStop: TNotifyEvent read FOnDoSpinStop write FOnDoSpinStop;
    property OnSetSpinSpeed: TCMach4DocSetSpinSpeed read FOnSetSpinSpeed write FOnSetSpinSpeed;
    property OnInFeeds: TCMach4DocInFeeds read FOnInFeeds write FOnInFeeds;
    property OnThreadDepth: TCMach4DocThreadDepth read FOnThreadDepth write FOnThreadDepth;
    property OntTapers: TCMach4DoctTapers read FOntTapers write FOntTapers;
    property OnSetTicker: TCMach4DocSetTicker read FOnSetTicker write FOnSetTicker;
    property OnSetUserLabel: TCMach4DocSetUserLabel read FOnSetUserLabel write FOnSetUserLabel;
    property OnRefCombination: TCMach4DocRefCombination read FOnRefCombination write FOnRefCombination;
    property OnIsSuchSignal: TCMach4DocIsSuchSignal read FOnIsSuchSignal write FOnIsSuchSignal;
    property OnOpenTeachFile: TCMach4DocOpenTeachFile read FOnOpenTeachFile write FOnOpenTeachFile;
    property OnCloseTeachFile: TNotifyEvent read FOnCloseTeachFile write FOnCloseTeachFile;
    property OnSetButtonText: TCMach4DocSetButtonText read FOnSetButtonText write FOnSetButtonText;
    property OnLoadStandardLayout: TNotifyEvent read FOnLoadStandardLayout write FOnLoadStandardLayout;
    property OnLoadTeachFile: TNotifyEvent read FOnLoadTeachFile write FOnLoadTeachFile;
    property OnIsOutputActive: TCMach4DocIsOutputActive read FOnIsOutputActive write FOnIsOutputActive;
    property OnSingleVerify: TNotifyEvent read FOnSingleVerify write FOnSingleVerify;
    property OnGetPage: TNotifyEvent read FOnGetPage write FOnGetPage;
    property OnSetPage: TCMach4DocSetPage read FOnSetPage write FOnSetPage;
    property OnToggleScreens: TNotifyEvent read FOnToggleScreens write FOnToggleScreens;
    property OnPlayWave: TCMach4DocPlayWave read FOnPlayWave write FOnPlayWave;
    property OnSpeak: TCMach4DocSpeak read FOnSpeak write FOnSpeak;
    property OnMessage: TCMach4DocMessage read FOnMessage write FOnMessage;
    property OnIsStopped: TNotifyEvent read FOnIsStopped write FOnIsStopped;
    property OnSaveWizard: TNotifyEvent read FOnSaveWizard write FOnSaveWizard;
    property OnSingleVerifyReport: TCMach4DocSingleVerifyReport read FOnSingleVerifyReport write FOnSingleVerifyReport;
    property OnSetIJMode: TCMach4DocSetIJMode read FOnSetIJMode write FOnSetIJMode;
    property OnGetIJMode: TNotifyEvent read FOnGetIJMode write FOnGetIJMode;
    property OnGetMinPass: TNotifyEvent read FOnGetMinPass write FOnGetMinPass;
    property OnAppendTeachFile: TCMach4DocAppendTeachFile read FOnAppendTeachFile write FOnAppendTeachFile;
    property OnRandom: TNotifyEvent read FOnRandom write FOnRandom;
    property OnIsDiameter: TNotifyEvent read FOnIsDiameter write FOnIsDiameter;
    property OnModGetInputWord: TCMach4DocModGetInputWord read FOnModGetInputWord write FOnModGetInputWord;
    property OnFillFromCoil: TCMach4DocFillFromCoil read FOnFillFromCoil write FOnFillFromCoil;
    property OnFillFromStatus: TCMach4DocFillFromStatus read FOnFillFromStatus write FOnFillFromStatus;
    property OnFillFromHolding: TCMach4DocFillFromHolding read FOnFillFromHolding write FOnFillFromHolding;
    property OnFillFromInput: TCMach4DocFillFromInput read FOnFillFromInput write FOnFillFromInput;
    property OnGetModWord: TCMach4DocGetModWord read FOnGetModWord write FOnGetModWord;
    property OntMinDepth: TNotifyEvent read FOntMinDepth write FOntMinDepth;
    property OntGetCutType: TNotifyEvent read FOntGetCutType write FOntGetCutType;
    property OntGetInfeedType: TNotifyEvent read FOntGetInfeedType write FOntGetInfeedType;
    property OntSetCutType: TCMach4DoctSetCutType read FOntSetCutType write FOntSetCutType;
    property OntSetInFeedType: TCMach4DoctSetInFeedType read FOntSetInFeedType write FOntSetInFeedType;
    property OnOpenSubroutineFile: TCMach4DocOpenSubroutineFile read FOnOpenSubroutineFile write FOnOpenSubroutineFile;
    property OntZClear: TNotifyEvent read FOntZClear write FOntZClear;
    property OnFeedRate: TNotifyEvent read FOnFeedRate write FOnFeedRate;
    property OntCutDepth: TNotifyEvent read FOntCutDepth write FOntCutDepth;
    property OnFileName: TNotifyEvent read FOnFileName write FOnFileName;
    property OnMinX: TNotifyEvent read FOnMinX write FOnMinX;
    property OnMaxX: TNotifyEvent read FOnMaxX write FOnMaxX;
    property OnMinY: TNotifyEvent read FOnMinY write FOnMinY;
    property OnMaxY: TNotifyEvent read FOnMaxY write FOnMaxY;
    property OnRetractMode: TNotifyEvent read FOnRetractMode write FOnRetractMode;
    property OnGotoSafeZ: TNotifyEvent read FOnGotoSafeZ write FOnGotoSafeZ;
    property OnSetPulley: TCMach4DocSetPulley read FOnSetPulley write FOnSetPulley;
    property OnLoadWizard: TCMach4DocLoadWizard read FOnLoadWizard write FOnLoadWizard;
    property OnSetOutput: TCMach4DocSetOutput read FOnSetOutput write FOnSetOutput;
    property OnGetInput: TCMach4DocGetInput read FOnGetInput write FOnGetInput;
    property OnSetModOutput: TCMach4DocSetModOutput read FOnSetModOutput write FOnSetModOutput;
    property OnLoadFile: TCMach4DocLoadFile read FOnLoadFile write FOnLoadFile;
    property OnSetTriggerMacro: TCMach4DocSetTriggerMacro read FOnSetTriggerMacro write FOnSetTriggerMacro;
    property OnSetHomannString: TCMach4DocSetHomannString read FOnSetHomannString write FOnSetHomannString;
    property OnJogOn: TCMach4DocJogOn read FOnJogOn write FOnJogOn;
    property OnJogOff: TCMach4DocJogOff read FOnJogOff write FOnJogOff;
    property OnOpenSubFile: TCMach4DocOpenSubFile read FOnOpenSubFile write FOnOpenSubFile;
    property OnSetToolX: TCMach4DocSetToolX read FOnSetToolX write FOnSetToolX;
    property OnSetToolZ: TCMach4DocSetToolZ read FOnSetToolZ write FOnSetToolZ;
    property OnGetTurretAng: TNotifyEvent read FOnGetTurretAng write FOnGetTurretAng;
    property OnGetFiFoEntry: TNotifyEvent read FOnGetFiFoEntry write FOnGetFiFoEntry;
    property OnRunProgram: TCMach4DocRunProgram read FOnRunProgram write FOnRunProgram;
    property OnSendFIFO: TCMach4DocSendFIFO read FOnSendFIFO write FOnSendFIFO;
    property OnRound: TCMach4DocRound read FOnRound write FOnRound;
    property Onroun: TCMach4Docroun read FOnroun write FOnroun;
    property OnnFmt: TCMach4DocnFmt read FOnnFmt write FOnnFmt;
    property OnZeroTHC: TNotifyEvent read FOnZeroTHC write FOnZeroTHC;
    property OnIsWiz: TNotifyEvent read FOnIsWiz write FOnIsWiz;
    property OnWaitForPoll: TNotifyEvent read FOnWaitForPoll write FOnWaitForPoll;
    property OnSetModIOString: TCMach4DocSetModIOString read FOnSetModIOString write FOnSetModIOString;
    property OnSleep: TCMach4DocSleep read FOnSleep write FOnSleep;
    property OnSendFIFOcr: TCMach4DocSendFIFOcr read FOnSendFIFOcr write FOnSendFIFOcr;
    property OnSendFIFObyte: TCMach4DocSendFIFObyte read FOnSendFIFObyte write FOnSendFIFObyte;
    property OnSendFIFOword: TCMach4DocSendFIFOword read FOnSendFIFOword write FOnSendFIFOword;
    property OnSetTimer: TCMach4DocSetTimer read FOnSetTimer write FOnSetTimer;
    property OnGetTimer: TCMach4DocGetTimer read FOnGetTimer write FOnGetTimer;
    property OnAskTextQuestion: TCMach4DocAskTextQuestion read FOnAskTextQuestion write FOnAskTextQuestion;
    property OnGetDROString: TCMach4DocGetDROString read FOnGetDROString write FOnGetDROString;
    property OnLoadLinTable: TNotifyEvent read FOnLoadLinTable write FOnLoadLinTable;
    property OnSwapAxis: TCMach4DocSwapAxis read FOnSwapAxis write FOnSwapAxis;
    property OnResetAxisSwap: TNotifyEvent read FOnResetAxisSwap write FOnResetAxisSwap;
    property OnSetFormula: TCMach4DocSetFormula read FOnSetFormula write FOnSetFormula;
    property OnIsProbing: TNotifyEvent read FOnIsProbing write FOnIsProbing;
    property OnGetInBit: TCMach4DocGetInBit read FOnGetInBit write FOnGetInBit;
    property OnSetOutBit: TCMach4DocSetOutBit read FOnSetOutBit write FOnSetOutBit;
    property OnResetOutBit: TCMach4DocResetOutBit read FOnResetOutBit write FOnResetOutBit;
    property OnSetProbeActive: TCMach4DocSetProbeActive read FOnSetProbeActive write FOnSetProbeActive;
    property OnStartVideo: TNotifyEvent read FOnStartVideo write FOnStartVideo;
    property OnVBTest: TNotifyEvent read FOnVBTest write FOnVBTest;
    property OnStartTHC: TNotifyEvent read FOnStartTHC write FOnStartTHC;
    property OnEndTHC: TNotifyEvent read FOnEndTHC write FOnEndTHC;
    property OnCoupleSlave: TCMach4DocCoupleSlave read FOnCoupleSlave write FOnCoupleSlave;
    property OnGetToolParam: TCMach4DocGetToolParam read FOnGetToolParam write FOnGetToolParam;
    property OnSetToolParam: TCMach4DocSetToolParam read FOnSetToolParam write FOnSetToolParam;
    property OnSetProbeState: TCMach4DocSetProbeState read FOnSetProbeState write FOnSetProbeState;
    property OnGetMainFolder: TNotifyEvent read FOnGetMainFolder write FOnGetMainFolder;
    property OnDoMenu: TCMach4DocDoMenu read FOnDoMenu write FOnDoMenu;
    property OnGetMasterInput: TCMach4DocGetMasterInput read FOnGetMasterInput write FOnGetMasterInput;
    property OnGetMasterOutput: TCMach4DocGetMasterOutput read FOnGetMasterOutput write FOnGetMasterOutput;
    property OnSetMasterOutput: TCMach4DocSetMasterOutput read FOnSetMasterOutput write FOnSetMasterOutput;
    property OnSetMasterInput: TCMach4DocSetMasterInput read FOnSetMasterInput write FOnSetMasterInput;
    property OnGetUserLabel: TCMach4DocGetUserLabel read FOnGetUserLabel write FOnGetUserLabel;
    property OnGetToolDesc: TCMach4DocGetToolDesc read FOnGetToolDesc write FOnGetToolDesc;
    property OnIsSafeZ: TNotifyEvent read FOnIsSafeZ write FOnIsSafeZ;
    property OnMachMSG: TCMach4DocMachMSG read FOnMachMSG write FOnMachMSG;
  end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
// *********************************************************************//
// OLE Server Properties Proxy Class
// Server Object    : TCMach4Doc
// (This object is used by the IDE's Property Inspector to allow editing
//  of the properties of this server)
// *********************************************************************//
 TCMach4DocProperties = class(TPersistent)
  private
    FServer:    TCMach4Doc;
    function    GetDefaultInterface: IMach4;
    constructor Create(AServer: TCMach4Doc);
  protected
  public
    property DefaultInterface: IMach4 read GetDefaultInterface;
  published
  end;
{$ENDIF}


procedure Register;

resourcestring
  dtlServerPage = 'Samples';

  dtlOcxPage = 'Samples';

implementation

uses ComObj;

class function CoCMach4Doc.Create: IMach4;
begin
  Result := CreateComObject(CLASS_CMach4Doc) as IMach4;
end;

class function CoCMach4Doc.CreateRemote(const MachineName: string): IMach4;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_CMach4Doc) as IMach4;
end;

procedure TCMach4Doc.InitServerData;
const
  CServerData: TServerData = (
    ClassID:   '{CA7992B2-2653-4342-8061-D7D385C07809}';
    IntfIID:   '{D5DC1674-0CB6-47D4-BD22-E6D60631C86D}';
    EventIID:  '{F1D3EE6C-AB32-4996-B270-F415613F5BA3}';
    LicenseKey: nil;
    Version: 500);
begin
  ServerData := @CServerData;
end;

procedure TCMach4Doc.Connect;
var
  punk: IUnknown;
begin
  if FIntf = nil then
  begin
    punk := GetServer;
    ConnectEvents(punk);
    Fintf:= punk as IMach4;
  end;
end;

procedure TCMach4Doc.ConnectTo(svrIntf: IMach4);
begin
  Disconnect;
  FIntf := svrIntf;
  ConnectEvents(FIntf);
end;

procedure TCMach4Doc.DisConnect;
begin
  if Fintf <> nil then
  begin
    DisconnectEvents(FIntf);
    FIntf := nil;
  end;
end;

function TCMach4Doc.GetDefaultInterface: IMach4;
begin
  if FIntf = nil then
    Connect;
  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
  Result := FIntf;
end;

constructor TCMach4Doc.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps := TCMach4DocProperties.Create(Self);
{$ENDIF}
end;

destructor TCMach4Doc.Destroy;
begin
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps.Free;
{$ENDIF}
  inherited Destroy;
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
function TCMach4Doc.GetServerProperties: TCMach4DocProperties;
begin
  Result := FProps;
end;
{$ENDIF}

procedure TCMach4Doc.InvokeEvent(DispID: TDispID; var Params: TVariantArray);
begin
  case DispID of
    -1: Exit;  // DISPID_UNKNOWN
    1: if Assigned(FOnStraightFeed) then
         FOnStraightFeed(Self,
                         Params[0] {Double},
                         Params[1] {Double},
                         Params[2] {Double},
                         Params[3] {Double},
                         Params[4] {Double},
                         Params[5] {Double});
    2: if Assigned(FOnHelpAbout) then
         FOnHelpAbout(Self);
    3: if Assigned(FOnGetSafeZ) then
         FOnGetSafeZ(Self);
    4: if Assigned(FOnSetSafeZ) then
         FOnSetSafeZ(Self, Params[0] {Double});
    5: if Assigned(FOnSetCurrentTool) then
         FOnSetCurrentTool(Self, Params[0] {Smallint});
    6: if Assigned(FOnGetSelectedTool) then
         FOnGetSelectedTool(Self);
    7: if Assigned(FOnGetToolChangeStart) then
         FOnGetToolChangeStart(Self, Params[0] {Smallint});
    8: if Assigned(FOnStraightTraverse) then
         FOnStraightTraverse(Self,
                             Params[0] {Double},
                             Params[1] {Double},
                             Params[2] {Double},
                             Params[3] {Double},
                             Params[4] {Double},
                             Params[5] {Double});
    9: if Assigned(FOnToolLengthOffset) then
         FOnToolLengthOffset(Self);
    10: if Assigned(FOnCommandedFeed) then
         FOnCommandedFeed(Self);
    11: if Assigned(FOnSetFeedRate) then
         FOnSetFeedRate(Self, Params[0] {Double});
    12: if Assigned(FOnActivateSignal) then
         FOnActivateSignal(Self, Params[0] {Smallint});
    13: if Assigned(FOnIsActive) then
         FOnIsActive(Self, Params[0] {Smallint});
    14: if Assigned(FOnDeActivateSignal) then
         FOnDeActivateSignal(Self, Params[0] {Smallint});
    15: if Assigned(FOnSystemWaitFor) then
         FOnSystemWaitFor(Self, Params[0] {Smallint});
    16: if Assigned(FOnParam1) then
         FOnParam1(Self);
    17: if Assigned(FOnParam2) then
         FOnParam2(Self);
    18: if Assigned(FOnParam3) then
         FOnParam3(Self);
    19: if Assigned(FOnVerifyAxis) then
         FOnVerifyAxis(Self, Params[0] {Integer});
    20: if Assigned(FOnGetVar) then
         FOnGetVar(Self, Params[0] {Smallint});
    21: if Assigned(FOnSetVar) then
         FOnSetVar(Self,
                   Params[0] {Smallint},
                   Params[1] {Double});
    24: if Assigned(FOnOpenDigFile) then
         FOnOpenDigFile(Self);
    25: if Assigned(FOnCloseDigFile) then
         FOnCloseDigFile(Self);
    26: if Assigned(FOnTHCOn) then
         FOnTHCOn(Self);
    27: if Assigned(FOnTHCOff) then
         FOnTHCOff(Self);
    28: if Assigned(FOnCode) then
         FOnCode(Self, Params[0] {const WideString});
    29: if Assigned(FOnGetScale) then
         FOnGetScale(Self, Params[0] {Smallint});
    30: if Assigned(FOnSetScale) then
         FOnSetScale(Self,
                     Params[0] {Smallint},
                     Params[1] {Double});
    31: if Assigned(FOnSendSerial) then
         FOnSendSerial(Self, Params[0] {const WideString});
    32: if Assigned(FOnGetPortByte) then
         FOnGetPortByte(Self, Params[0] { ??Word OleVariant});
    33: if Assigned(FOnPutPortByte) then
         FOnPutPortByte(Self,
                        Params[0] { ??Word OleVariant},
                        Params[1] {Byte});
    34: if Assigned(FOnIsMoving) then
         FOnIsMoving(Self);
    35: if Assigned(FOnResetTHC) then
         FOnResetTHC(Self);
    36: if Assigned(FOnGetParam) then
         FOnGetParam(Self, Params[0] {const WideString});
    37: if Assigned(FOnSetParam) then
         FOnSetParam(Self,
                     Params[0] {const WideString},
                     Params[1] {Double});
    38: if Assigned(FOnsetobj) then
         FOnsetobj(Self,
                   Params[0] {const WideString},
                   Params[1] {Double});
    39: if Assigned(FOnGetCurrentTol) then
         FOnGetCurrentTol(Self);
    40: if Assigned(FOnDoOEMButton) then
         FOnDoOEMButton(Self, Params[0] {Smallint});
    41: if Assigned(FOnLoadRun) then
         FOnLoadRun(Self, Params[0] {const WideString});
    42: if Assigned(FOnDoButton) then
         FOnDoButton(Self, Params[0] {Smallint});
    43: if Assigned(FOnGetLED) then
         FOnGetLED(Self, Params[0] {Smallint});
    44: if Assigned(FOnGetOEMLed) then
         FOnGetOEMLed(Self, Params[0] {Smallint});
    45: if Assigned(FOnGetOEMDRO) then
         FOnGetOEMDRO(Self, Params[0] {Smallint});
    46: if Assigned(FOnGetDRO) then
         FOnGetDRO(Self, Params[0] {Smallint});
    47: if Assigned(FOnSetDRO) then
         FOnSetDRO(Self,
                   Params[0] {Smallint},
                   Params[1] {Double});
    48: if Assigned(FOnSetOEMDRO) then
         FOnSetOEMDRO(Self,
                      Params[0] {Smallint},
                      Params[1] {Double});
    49: if Assigned(FOnGetCoord) then
         FOnGetCoord(Self, Params[0] {const WideString});
    50: if Assigned(FOnGetXCoor) then
         FOnGetXCoor(Self);
    51: if Assigned(FOnGetYCoor) then
         FOnGetYCoor(Self);
    52: if Assigned(FOnGetZCoor) then
         FOnGetZCoor(Self);
    53: if Assigned(FOnGetACoor) then
         FOnGetACoor(Self);
    54: if Assigned(FOnIsFirst) then
         FOnIsFirst(Self);
    55: if Assigned(FOnSetMachZero) then
         FOnSetMachZero(Self, Params[0] {Smallint});
    56: if Assigned(FOnRunFile) then
         FOnRunFile(Self);
    57: if Assigned(FOnSetUserDRO) then
         FOnSetUserDRO(Self,
                       Params[0] {Smallint},
                       Params[1] {Double});
    58: if Assigned(FOnSetUserLED) then
         FOnSetUserLED(Self,
                       Params[0] {Smallint},
                       Params[1] {Smallint});
    59: if Assigned(FOnGetUserDRO) then
         FOnGetUserDRO(Self, Params[0] {Smallint});
    60: if Assigned(FOnGetUserLED) then
         FOnGetUserLED(Self, Params[0] {Smallint});
    61: if Assigned(FOntXStart) then
         FOntXStart(Self);
    62: if Assigned(FOntZStart) then
         FOntZStart(Self);
    63: if Assigned(FOntEndX) then
         FOntEndX(Self);
    64: if Assigned(FOntEndZ) then
         FOntEndZ(Self);
    65: if Assigned(FOntClearX) then
         FOntClearX(Self);
    66: if Assigned(FOntLead) then
         FOntLead(Self);
    67: if Assigned(FOntSpring) then
         FOntSpring(Self);
    68: if Assigned(FOntPasses) then
         FOntPasses(Self);
    69: if Assigned(FOntChamfer) then
         FOntChamfer(Self);
    70: if Assigned(FOntTaper) then
         FOntTaper(Self);
    71: if Assigned(FOntInFeed) then
         FOntInFeed(Self);
    72: if Assigned(FOntDepthLastPass) then
         FOntDepthLastPass(Self);
    73: if Assigned(FOnIsLoading) then
         FOnIsLoading(Self);
    74: if Assigned(FOnGetABSPostion) then
         FOnGetABSPostion(Self, Params[0] {Smallint});
    75: if Assigned(FOnGetRPM) then
         FOnGetRPM(Self);
    76: if Assigned(FOnDoSpinCW) then
         FOnDoSpinCW(Self);
    77: if Assigned(FOnDoSpinCCW) then
         FOnDoSpinCCW(Self);
    78: if Assigned(FOnDoSpinStop) then
         FOnDoSpinStop(Self);
    79: if Assigned(FOnSetSpinSpeed) then
         FOnSetSpinSpeed(Self, Params[0] {Double});
    80: if Assigned(FOnInFeeds) then
         FOnInFeeds(Self, Params[0] {Smallint});
    81: if Assigned(FOnThreadDepth) then
         FOnThreadDepth(Self, Params[0] {Smallint});
    82: if Assigned(FOntTapers) then
         FOntTapers(Self, Params[0] {Smallint});
    83: if Assigned(FOnSetTicker) then
         FOnSetTicker(Self,
                      Params[0] {Smallint},
                      Params[1] {const WideString});
    84: if Assigned(FOnSetUserLabel) then
         FOnSetUserLabel(Self,
                         Params[0] {Smallint},
                         Params[1] {const WideString});
    85: if Assigned(FOnRefCombination) then
         FOnRefCombination(Self, Params[0] {Smallint});
    86: if Assigned(FOnIsSuchSignal) then
         FOnIsSuchSignal(Self, Params[0] {Smallint});
    87: if Assigned(FOnOpenTeachFile) then
         FOnOpenTeachFile(Self, Params[0] {const WideString});
    88: if Assigned(FOnCloseTeachFile) then
         FOnCloseTeachFile(Self);
    89: if Assigned(FOnSetButtonText) then
         FOnSetButtonText(Self, Params[0] {const WideString});
    90: if Assigned(FOnLoadStandardLayout) then
         FOnLoadStandardLayout(Self);
    91: if Assigned(FOnLoadTeachFile) then
         FOnLoadTeachFile(Self);
    92: if Assigned(FOnIsOutputActive) then
         FOnIsOutputActive(Self, Params[0] {Smallint});
    93: if Assigned(FOnSingleVerify) then
         FOnSingleVerify(Self);
    94: if Assigned(FOnGetPage) then
         FOnGetPage(Self);
    95: if Assigned(FOnSetPage) then
         FOnSetPage(Self, Params[0] {Smallint});
    96: if Assigned(FOnToggleScreens) then
         FOnToggleScreens(Self);
    97: if Assigned(FOnPlayWave) then
         FOnPlayWave(Self, Params[0] {const WideString});
    98: if Assigned(FOnSpeak) then
         FOnSpeak(Self, Params[0] {const WideString});
    99: if Assigned(FOnMessage) then
         FOnMessage(Self, Params[0] {const WideString});
    100: if Assigned(FOnIsStopped) then
         FOnIsStopped(Self);
    101: if Assigned(FOnSaveWizard) then
         FOnSaveWizard(Self);
    102: if Assigned(FOnSingleVerifyReport) then
         FOnSingleVerifyReport(Self, Params[0] {Smallint});
    103: if Assigned(FOnSetIJMode) then
         FOnSetIJMode(Self, Params[0] {Smallint});
    104: if Assigned(FOnGetIJMode) then
         FOnGetIJMode(Self);
    105: if Assigned(FOnGetMinPass) then
         FOnGetMinPass(Self);
    106: if Assigned(FOnAppendTeachFile) then
         FOnAppendTeachFile(Self, Params[0] {const WideString});
    107: if Assigned(FOnRandom) then
         FOnRandom(Self);
    108: if Assigned(FOnIsDiameter) then
         FOnIsDiameter(Self);
    109: if Assigned(FOnModGetInputWord) then
         FOnModGetInputWord(Self, Params[0] {Smallint});
    110: if Assigned(FOnFillFromCoil) then
         FOnFillFromCoil(Self,
                         Params[0] {Smallint},
                         Params[1] {Smallint},
                         Params[2] {Smallint});
    111: if Assigned(FOnFillFromStatus) then
         FOnFillFromStatus(Self,
                           Params[0] {Smallint},
                           Params[1] {Smallint},
                           Params[2] {Smallint});
    112: if Assigned(FOnFillFromHolding) then
         FOnFillFromHolding(Self,
                            Params[0] {Smallint},
                            Params[1] {Smallint},
                            Params[2] {Smallint});
    113: if Assigned(FOnFillFromInput) then
         FOnFillFromInput(Self,
                          Params[0] {Smallint},
                          Params[1] {Smallint},
                          Params[2] {Smallint});
    114: if Assigned(FOnGetModWord) then
         FOnGetModWord(Self, Params[0] {Smallint});
    115: if Assigned(FOntMinDepth) then
         FOntMinDepth(Self);
    116: if Assigned(FOntGetCutType) then
         FOntGetCutType(Self);
    117: if Assigned(FOntGetInfeedType) then
         FOntGetInfeedType(Self);
    118: if Assigned(FOntSetCutType) then
         FOntSetCutType(Self, Params[0] {Smallint});
    119: if Assigned(FOntSetInFeedType) then
         FOntSetInFeedType(Self, Params[0] {Smallint});
    120: if Assigned(FOnOpenSubroutineFile) then
         FOnOpenSubroutineFile(Self, Params[0] {const WideString});
    121: if Assigned(FOntZClear) then
         FOntZClear(Self);
    122: if Assigned(FOnFeedRate) then
         FOnFeedRate(Self);
    123: if Assigned(FOntCutDepth) then
         FOntCutDepth(Self);
    124: if Assigned(FOnFileName) then
         FOnFileName(Self);
    125: if Assigned(FOnMinX) then
         FOnMinX(Self);
    126: if Assigned(FOnMaxX) then
         FOnMaxX(Self);
    127: if Assigned(FOnMinY) then
         FOnMinY(Self);
    128: if Assigned(FOnMaxY) then
         FOnMaxY(Self);
    129: if Assigned(FOnRetractMode) then
         FOnRetractMode(Self);
    130: if Assigned(FOnGotoSafeZ) then
         FOnGotoSafeZ(Self);
    131: if Assigned(FOnSetPulley) then
         FOnSetPulley(Self, Params[0] {Smallint});
    132: if Assigned(FOnLoadWizard) then
         FOnLoadWizard(Self, Params[0] {const WideString});
    133: if Assigned(FOnSetOutput) then
         FOnSetOutput(Self, Params[0] {Smallint});
    134: if Assigned(FOnGetInput) then
         FOnGetInput(Self, Params[0] {Smallint});
    135: if Assigned(FOnSetModOutput) then
         FOnSetModOutput(Self,
                         Params[0] {Smallint},
                         Params[1] {Smallint});
    136: if Assigned(FOnLoadFile) then
         FOnLoadFile(Self, Params[0] {const WideString});
    137: if Assigned(FOnSetTriggerMacro) then
         FOnSetTriggerMacro(Self, Params[0] {Smallint});
    138: if Assigned(FOnSetHomannString) then
         FOnSetHomannString(Self,
                            Params[0] {Smallint},
                            Params[1] {Smallint},
                            Params[2] {const WideString});
    139: if Assigned(FOnJogOn) then
         FOnJogOn(Self,
                  Params[0] {Smallint},
                  Params[1] {Smallint});
    140: if Assigned(FOnJogOff) then
         FOnJogOff(Self, Params[0] {Smallint});
    141: if Assigned(FOnOpenSubFile) then
         FOnOpenSubFile(Self, Params[0] {const WideString});
    142: if Assigned(FOnSetToolX) then
         FOnSetToolX(Self, Params[0] {Double});
    143: if Assigned(FOnSetToolZ) then
         FOnSetToolZ(Self, Params[0] {Double});
    144: if Assigned(FOnGetTurretAng) then
         FOnGetTurretAng(Self);
    145: if Assigned(FOnGetFiFoEntry) then
         FOnGetFiFoEntry(Self);
    146: if Assigned(FOnRunProgram) then
         FOnRunProgram(Self, Params[0] {const WideString});
    147: if Assigned(FOnSendFIFO) then
         FOnSendFIFO(Self, Params[0] {const WideString});
    148: if Assigned(FOnRound) then
         FOnRound(Self, Params[0] {Double});
    149: if Assigned(FOnroun) then
         FOnroun(Self, Params[0] {Double});
    150: if Assigned(FOnnFmt) then
         FOnnFmt(Self,
                 Params[0] {Double},
                 Params[1] {Smallint});
    151: if Assigned(FOnZeroTHC) then
         FOnZeroTHC(Self);
    152: if Assigned(FOnIsWiz) then
         FOnIsWiz(Self);
    153: if Assigned(FOnWaitForPoll) then
         FOnWaitForPoll(Self);
    154: if Assigned(FOnSetModIOString) then
         FOnSetModIOString(Self,
                           Params[0] {Smallint},
                           Params[1] {Smallint},
                           Params[2] {Smallint},
                           Params[3] {const WideString});
    155: if Assigned(FOnSleep) then
         FOnSleep(Self, Params[0] {Smallint});
    156: if Assigned(FOnSendFIFOcr) then
         FOnSendFIFOcr(Self, Params[0] {const WideString});
    157: if Assigned(FOnSendFIFObyte) then
         FOnSendFIFObyte(Self, Params[0] {Smallint});
    158: if Assigned(FOnSendFIFOword) then
         FOnSendFIFOword(Self, Params[0] {Smallint});
    159: if Assigned(FOnSetTimer) then
         FOnSetTimer(Self, Params[0] {Smallint});
    160: if Assigned(FOnGetTimer) then
         FOnGetTimer(Self, Params[0] {Smallint});
    161: if Assigned(FOnAskTextQuestion) then
         FOnAskTextQuestion(Self, Params[0] {const WideString});
    162: if Assigned(FOnGetDROString) then
         FOnGetDROString(Self, Params[0] {Smallint});
    163: if Assigned(FOnLoadLinTable) then
         FOnLoadLinTable(Self);
    164: if Assigned(FOnSwapAxis) then
         FOnSwapAxis(Self,
                     Params[0] {Smallint},
                     Params[1] {Smallint});
    165: if Assigned(FOnResetAxisSwap) then
         FOnResetAxisSwap(Self);
    166: if Assigned(FOnSetFormula) then
         FOnSetFormula(Self,
                       Params[0] {const WideString},
                       Params[1] {Smallint});
    167: if Assigned(FOnIsProbing) then
         FOnIsProbing(Self);
    168: if Assigned(FOnGetInBit) then
         FOnGetInBit(Self,
                     Params[0] {Smallint},
                     Params[1] {Smallint});
    169: if Assigned(FOnSetOutBit) then
         FOnSetOutBit(Self,
                      Params[0] {Smallint},
                      Params[1] {Smallint});
    170: if Assigned(FOnResetOutBit) then
         FOnResetOutBit(Self,
                        Params[0] {Smallint},
                        Params[1] {Smallint});
    171: if Assigned(FOnSetProbeActive) then
         FOnSetProbeActive(Self, Params[0] {Smallint});
    172: if Assigned(FOnStartVideo) then
         FOnStartVideo(Self);
    173: if Assigned(FOnVBTest) then
         FOnVBTest(Self);
    174: if Assigned(FOnStartTHC) then
         FOnStartTHC(Self);
    175: if Assigned(FOnEndTHC) then
         FOnEndTHC(Self);
    176: if Assigned(FOnCoupleSlave) then
         FOnCoupleSlave(Self, Params[0] {Smallint});
    177: if Assigned(FOnGetToolParam) then
         FOnGetToolParam(Self,
                         Params[0] {Smallint},
                         Params[1] {Smallint});
    178: if Assigned(FOnSetToolParam) then
         FOnSetToolParam(Self,
                         Params[0] {Smallint},
                         Params[1] {Smallint},
                         Params[2] {Double});
    179: if Assigned(FOnSetProbeState) then
         FOnSetProbeState(Self, Params[0] {Smallint});
    180: if Assigned(FOnGetMainFolder) then
         FOnGetMainFolder(Self);
    181: if Assigned(FOnDoMenu) then
         FOnDoMenu(Self,
                   Params[0] {Smallint},
                   Params[1] {Smallint});
    182: if Assigned(FOnGetMasterInput) then
         FOnGetMasterInput(Self, Params[0] {Smallint});
    183: if Assigned(FOnGetMasterOutput) then
         FOnGetMasterOutput(Self, Params[0] {Smallint});
    184: if Assigned(FOnSetMasterOutput) then
         FOnSetMasterOutput(Self,
                            Params[0] {Smallint},
                            Params[1] {Smallint});
    185: if Assigned(FOnSetMasterInput) then
         FOnSetMasterInput(Self,
                           Params[0] {Smallint},
                           Params[1] {Smallint});
    186: if Assigned(FOnGetUserLabel) then
         FOnGetUserLabel(Self, Params[0] {Smallint});
    187: if Assigned(FOnGetToolDesc) then
         FOnGetToolDesc(Self, Params[0] {Smallint});
    188: if Assigned(FOnIsSafeZ) then
         FOnIsSafeZ(Self);
    189: if Assigned(FOnMachMSG) then
         FOnMachMSG(Self,
                    Params[0] {const WideString},
                    Params[1] {const WideString},
                    Params[2] {Smallint});
  end; {case DispID}
end;

procedure TCMach4Doc.LoadGCodeFile(const FileName: WideString);
begin
  DefaultInterface.LoadGCodeFile(FileName);
end;

procedure TCMach4Doc.CloseFile;
begin
  DefaultInterface.CloseFile;
end;

function TCMach4Doc.GetScriptDispatch: IDispatch;
begin
  Result := DefaultInterface.GetScriptDispatch;
end;

procedure TCMach4Doc.ShutDown;
begin
  DefaultInterface.ShutDown;
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
constructor TCMach4DocProperties.Create(AServer: TCMach4Doc);
begin
  inherited Create;
  FServer := AServer;
end;

function TCMach4DocProperties.GetDefaultInterface: IMach4;
begin
  Result := FServer.DefaultInterface;
end;

{$ENDIF}

procedure Register;
begin
  RegisterComponents(dtlServerPage, [TCMach4Doc]);
end;

end.
