hexagon logo

PC-DMIS 2012 MR1 & Scripting

Is VB scripting the only form of code to use for pc-dmis 2012 mr1?
  • Weird issue.

    Seems everything works as expected as PC-DMIS starts and opens the partprogram, but in offline mode.
    This should tell us that the code is working, but opens it in offline mode.
  • Yes very much weird but true. I am facing this problem from last 1 week but didn't get solution yet.
  • Try this, see if it makes any difference:

    Dim App As Object
    Dim Parts As Object
    Dim Part As Object
    
    Set App = CreateObject("PCDLRN.Application")
    
    Set Parts = App.PartPrograms
    
    Parts.Open(sFilePath, "CMM1")
    
    [b]Set Part = App.ActivePartProgram[/b]
    
    Part.Execute
    
    Part.Close
    
    App.Quit
    Set App = Nothing


    Other test is to use the code by me here:

    http://www.pcdmisforum.com/showthread.php?24239-To-Open-Execute-Several-Programs-Sequentially-Using-Basic-Script

    ...and see if that snippet can open your partprogram in online mode.
  • I have already tried this but the same behavior.

    Here is my code.
    Dim App As Object
    Dim Parts As Object
    Dim Part As Object

    Set App = CreateObject("PCDLRN.Application")

    Set Parts = App.PartPrograms

    App.Visible = True

    Parts.Open "D:\PrbCal.PRG", "CMM1" '"Machine1/Maskin1".

    DoEvents
    Set Part = App.ActivePartProgram
    DoEvents
    MsgBox "Pause for 10 seconds here then click OK"

    Part.Execute
    DoEvents

    Part.Close

    Set Part = Nothing
    Set Parts = Nothing
    App.Quit
    Set App = Nothing
  • More clarification '"Machine1/Maskin1" is commented not part of running code.
  • I have already tried this but the same behavior.

    Here is my code.
    Dim App As Object
    Dim Parts As Object
    Dim Part As Object

    Set App = CreateObject("PCDLRN.Application")

    Set Parts = App.PartPrograms

    App.Visible = True

    Parts.Open "D:\PrbCal.PRG", "CMM1" '"Machine1/Maskin1".

    DoEvents
    Set Part = App.ActivePartProgram
    DoEvents
    MsgBox "Pause for 10 seconds here then click OK"

    Part.Execute
    DoEvents

    Part.Close

    Set Part = Nothing
    Set Parts = Nothing
    App.Quit
    Set App = Nothing



    Try this instead, Start PC-DMIS on-line, then open the program you are trying to work with, and execute it to make sure its on-line. Then leave it open, and try this sort of code -

    Dim Parts As Object
    Dim Part As Object

    Set App = CreateObject("PCDLRN.Application")

    Set Parts = App.PartPrograms

    App.Visible = True

    ' Parts.Open "D:\PrbCal.PRG", "CMM1" '"Machine1/Maskin1". *** NOTICE THAT THIS LINE IS COMMENTED OUT

    DoEvents
    Set Part = App.ActivePartProgram
    DoEvents


    Part.Execute
    DoEvents

    Part.Close

    Set Part = Nothing
    Set Parts = Nothing
    App.Quit
    Set App = Nothing


    Instead of trying to open the program, let it use the current program and see if that tells us anything.
  • Don,
    I have tried doing as per your instruction in above thread.
    Open program through PC-DMIS application and run the code for execution. This way it is working fine in online mode. But its just work around not the solution.
    I hope now you may find some solution.