Move Clear Point.bas

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Move Clear Point.bas

    Move Clear Point.bas

    I use this Basic Cypress Enable Script example to add, execute and remove the Move Clear Point using a created icon place in the drop down Menu Bar list.

    Code:
    Dim DmisApp As Object
    Dim DmisPart As Object
    Dim DmisCommands As Object
    Dim DmisCommand As Object
    Dim Msg, Style, myTitle, Help, Ctxt, Response, MyString
    
    Sub ClearPoint
    
           Msg = "Executing Move Clear Point? "& chr(10) & chr(10) & "Validate Probe path is clear" ' Define message.
           Style = vbYes + vbCritical '+ vbDefaultButton1 'Define buttons.
           Style = 1 + 16 + 0 ' Define buttons.
           myTitle = "Add Move Clear Point" 'Define Title
           Help = "DEMO.HLP" ' Define Help file.
           Ctxt = 1000 ' Define topic context.
    
           'Display message.
           Response = MsgBox(Msg, Style, myTitle, Help, Ctxt)
    
           'MsgBox Response
        If Response = 1 Then 'vbNo Then 'User chose Yes.
           MyString = 1 ' Perform some action.
    
           Set DmisCommand = DmisCommands.CurrentCommand
           Set DmisCommand = DmisCommands.Add(163, True) 'MOVE_CLEARPOINT
           DmisCommand.ReDraw
    
           Set DmisCommand = DmisCommands.CurrentCommand
           retval = dmiscommand.execute
    
           Set DmisCommand = DmisCommands.CurrentCommand
           retval = dmiscommand.remove
           MsgBox "Executing Move Clear Point Complete"
           DmisCommand.ReDraw
    
       Else ' User chose No.
          MyString = 2 ' Perform some action.
          MsgBox "Executing Move Clear Point has been Canceled"
       End If
    
    End Sub
    
    
    Sub Main
    
           Set DmisApp = CreateObject("PCDLRN.Application")
           Set DmisPart = DmisApp.ActivePartProgram
           Set DmisCommands = DmisPart.Commands
           CommandCount = DmisCommands.Count
           Set DmisCommand = DmisCommands.Item(CommandCount)
           DmisCommands.InsertionPointAfter DmisCommand
    
           Msg = "Do you want to continue Executing Move Clear Point? " ' Define message.
           Style = vbYes + vbCritical '+ vbDefaultButton1 ' Define buttons.
           Style = 4 + 32 + 0 ' Define buttons.
           myTitle = "Execute Added Move Clear Point" ' Define Title
           Help = "DEMO.HLP" ' Define Help file.
           Ctxt = 1000 ' Define topic context.
    
           'Display message.
           Response = MsgBox(Msg, Style, myTitle, Help, Ctxt)
    
          'MsgBox Response
       If Response = 6 Then 'vbNo Then ' User chose Yes.
          MyString = 6 ' Perform some action.
    
          ClearPoint
    
      Else  'User chose No.
          MyString = 7 ' Perform some action.
          MsgBox "Executing Move Clear Point has been Canceled"
      End If
    
    
         Set DmisApp = Nothing
         Set DmisPart = Nothing
         Set DmisCommand = Nothing
         Set DmisCommands = Nothing
    
    End Sub
    Last edited by davehocum; 04-02-2020, 09:16 AM.

Related Topics

Collapse

Working...
X