hexagon logo

PC-DMIS 2012 MR1 & Scripting

Is VB scripting the only form of code to use for pc-dmis 2012 mr1?
  • Set Part = Parts.Open(sFilePath, "CMM1")


    I think the "CMM1" is the culprit - at least in my installations, the machine name is a translated word, "Maskin1", not "CMM1".

    Edit: After checking a number of versions, the last one I see "CMM1" in is 3.7 MR3 - from 4.2 and onwards (I didn't try checking 4.0 and 4.1) it's definitely "Machine1/Maskin1".
  • I think the "CMM1" is the culprit - at least in my installations, the machine name is a translated word, "Maskin1", not "CMM1".


    That is definitely a good catch, but I suspect it is not the problem. In early version of PC-DMIS, the argument was "CMM1", and then later it was decided that since PC-DMIS could be interfaced to other machine types. The argument was modified to accept the more generic "Machine1", but in reality both arguments are acceptable. I just tested it here in 2012 MR1 and they both worked for that version. Here is the code I used -


    Private Sub Form_Load()
    Dim App As PCDLRN.Application
    Dim Parts As PCDLRN.PartPrograms
    Dim part As PCDLRN.PartProgram

    Set App = CreateObject("PCDLRN.Application")
    If Not App.WaitUntilReady(300) Then
    MsgBox "Machine Init taking too long"
    Exit Sub
    End If

    Set Parts = App.PartPrograms
    App.Visible = True

    Set part = Parts.Open("C:\Program Files\WAI\PartPrograms\Test.prg", "Machine1")

    part.EXECUTE
    part.Close
    Set part = Nothing
    Set Parts = Nothing
    App.Quit
    Set App = Nothing
    End

    End Sub
  • Dan & AndersI,

    Thanks for your reply but unfortunately My problem still not resolved .

    I tried with argument "CMM1", "Machine1" & "Maskin1"

    I have tried with adding delay of 10 Sec and also added msgbox as per Don suggestion.
    Also Tried with Don's above code with just changing program file path.

    But still behavior is same seems like offline run as I mentioned above.
  • Is the program "marked" or "un-marked"? If there are no features marked for execution, no execution will happen.
  • I didnt understand your question but If we run program directly from PC-DMIS application, it runs fine.
  • I didnt understand your question but If we run program directly from PC-DMIS application, it runs fine.


    If the features in the progran are NOT marked for execution, then they won't execute, you know, MARK-ALL.
  • Matthew,

    I really appreciate your quick reply.

    But if features are not marked then how the same program run fine when we open PCDMIS and run it. But It is having problem when we run it through vb code as mentioned above.
  • Was just a suggestion. Never hurts to throw ideas out there.

  • But still behavior is same seems like offline run as I mentioned above.


    Sorry, I did not catch that detail in the earlier post. Also, I just noticed, you are not the original poster, so we might be making some wrong assumptions here.

    Do you have multiple versions of PC-DMIS installed? I ask because you say it worked with the earlier version.

    In the respective installations, did you copy the correct interface dll so that it can go on-line?

    Is this a BASIC script or are you using VB6? or calling with VBA?

    If its not a script, did you link it with the correct object library?

    If you have VB6, can you try my code as a standalone project? Don't add any functions, just use it as the lone project, and hard code your own path for the program location.
  • Make sure that you don't have a partprogram loaded before running your code. If you do, the program you opened with your code will open in offline mode.