hexagon logo

VB as it relates to PCDMIS

1. Ok, I have come across instances of people using VB in writing programs for PCDMIS.

2. Can any one point me in the direction of learning how to use Visual Basic as it relates to PCDMIS.

3. What does VB offer in relation to PCDMIS that PCDMIS without it can't?

4. What other application can be used in conjunction with PCDMIS?

5. Will the different varieties of VB work with PCDMIS? ( MS VB APPLICATIONS, VISUAL STUDIO, VB.NET, ETC...)


Sent from my iPad using Tapatalk - now Free
  • 2. Study the PC-DMIS BASIC help file and skim through the posts in the code samples section.

    3. Automation (controlled by you) or pretty much everything that PC-DMIS already does and don't do.

    4. Almost any application can, but it often needs a "man in the middle" application that talks to both applications.
    One that fetches the data from PC-DMIS and feeds it to the other application.

    5. I believe so, yes. Not only VB but any programming language that supports OLE/COM.
  • Hi Richard,
    Looks like you are rapidly expanding your knowledge at your new job - awesome!

    In a nutshell, we use VB in the form of text document scripts to automate actions in PC-DMIS and add additional capability.

    Example 1: Script call in a program to get operator input in a single dialog box
    At the beginning of the program, use the Insert - Basic Script command and navigate to a folder on the computer where OPERATOR_INPUTS.BAS is stored.
    Note that it comes in Unmarked, we always have to use F3 to Mark a script call.

    Our program looks like this:
    CS1        =SCRIPT/FILENAME= C:\YOUR_FOLDER_HERE\OPERATOR_INPUTS.BAS
                FUNCTION/Main,SHOW=YES,,
                STARTSCRIPT/
                ENDSCRIPT/
    


    If we were to open up Operator_input.BAS with Notepad or Wordpad or even Microsoft Word we would see this:

    Sub Main
    Begin Dialog DIALOG_1 50,10, 275, 300,      oOPERATORINPUT
      GroupBox 5,5,260,25
    Text 20,15,85,12, "Enter Operator:"
      TextBox 85,13,135,12, .EditBox_1
      GroupBox 5,35,260,25
    Text 25,45,85,12, "Enter Job Number:"
      TextBox 95,43,135,12, .EditBox_2
      GroupBox 5,65,260,25
    Text 32,75,85,12, "Enter Serial Number:"
      TextBox 105,73,135,12, .EditBox_3
      GroupBox 5,210,172,25
    Text 10,220,85,12, "Need Manual Alignment?"
      OptionGroup .GROUP_2
        OptionButton 105,220,25,12, "YES"
        OptionButton 145,220,25,12, "NO"
      OKButton 195,210,65,45
      CancelButton 120,275,48,16
    End Dialog
    Dim Dialg As DIALOG_1
    button1 = Dialog(Dialg)
    Dim Progtype As String
    Dim MANUALQ As String
    MANUALQ= "YES"
    If button1 = 0 Then
      Progtype= "END"
    Else
      Select Case Dialg.GROUP_2
        Case 0
          MANUALQ= "YES"
        Case 1
          MANUALQ= "NO"
      End Select
    Dim SerNum As String
     Oper = Dialg.EditBox_1
     Job = Dialg.EditBox_2
     SerNum = Dialg.EditBox_3
    End If
    Dim App As Object
    Set App = CreateObject("PCDLRN.Application")
    Dim Part As Object
    Set Part = App.ActivePartProgram
    Dim Cmds As Object
    Dim Cmd As Object
    Set Cmds = Part.Commands
    For Each Cmd In Cmds
      If Cmd.Type = ASSIGNMENT Then
        If Cmd.GetText(DEST_EXPR, 0) = "OPERATOR" Then
          bln = Cmd.PutText("""" + Oper + """", SRC_EXPR, 0)
          Cmd.ReDraw
        End If
        If Cmd.GetText(DEST_EXPR, 0) = "JOB" Then
          bln = Cmd.PutText("""" + Job + """", SRC_EXPR, 0)
          Cmd.ReDraw
        End If
        If Cmd.GetText(DEST_EXPR,0) = "SERNO" Then
          bln = Cmd.PutText("""" + SerNum + """", SRC_EXPR, 0)
          Cmd.ReDraw
        End If
        If Cmd.GetText(DEST_EXPR,0) = "MANUAL" Then
          bln = Cmd.PutText("""" + MANUALQ + """", SRC_EXPR, 0)
          Cmd.ReDraw
        End If
      End If
    Next Cmd
    End Sub
    

    Lots of gobbledeygook, right? I understand very little of it, because I openly admit to being a Copy-Paste-Tweak hack programmer, not a true VB coder.
    So, feel free to copy and paste this into a Text document and save it as OPERATOR_INPUTS.txt - but once it's saved, change the file extension from .txt to .BAS

    In the program, we're going to need to add four variable assignments after the script call:
    ASSIGN/OPERATOR=0
    ASSIGN/JOB=0
    ASSIGN/SERNO=0
    ASSIGN/MANUAL=0
    We'll see why once we run the program.
    What the script does is pop up a simple VB Dialog Box that looks like the picture attached.
    The operator fills in the fields, and clicks OK...
    ... and the script then takes their input and automatically pastes it into the variable assignments in PC-DMIS.

    Then our program looks like:
    ASSIGN/OPERATOR="JOSH"
    ASSIGN/JOB="99999"
    ASSIGN/SERNO="TESTSAMPLE31"
    ASSIGN/MANUAL="YES"
    because that's what was entered that run.

    Attached Files