hexagon logo

Display edit dialog with script

I received this request via PM. Since it makes no sense to hide the answer in a PM reply, I am posting it here.
By the way, would you please help me to one question? How to declare the object of DmisDialog? How to use the Dialog2? Your quick reply will be appreciated. Thanks


This code shows how to use the object / function in question to display the Edit Dialog for a command using script.

Sub Main
'
'Display the edit Dialog box For feature CIR1
'===================================
  Dim pcd As Object   'PCDLRN.Application
  Dim cmd As Object   'PCDLRN.Command
  Dim dlg As Object   'PCDLRN.DmisDialog
  Dim b As Boolean
  Set pcd = CreateObject("PCDLRN.Application", "")
  Set cmd=pcd.ActivePartProgram.Commands("CIR1")
  b=cmd.Dialog2(dlg)
End Sub
Parents
  • Hah, I need to work on commenting code better.

    Since I couldn't seem to find any documentation related to DmisDialog, I just circumvented PC-DMIS altogether and used a Python library for GUI automation.
    http://pywinauto.readthedocs.io/en/latest/index.html
    It takes a lot of the lower level tedium out of using the win32 API for automation. The first line connects to the currently running instance of PC-DMIS by looking for any running processes from PCDLRN.EXE and assigns it to the app variable. The next two lines are calls to the pywinauto library which find the best matching button in that application (in this case, the "Create" button in a window that's titled 'Position') and then clicks it/closes the dialog.

    I'm cleaning it up a bit and trying to figure out a good way to keep the operator from changing anything accidentally, but here's a gif of it in action:
Reply
  • Hah, I need to work on commenting code better.

    Since I couldn't seem to find any documentation related to DmisDialog, I just circumvented PC-DMIS altogether and used a Python library for GUI automation.
    http://pywinauto.readthedocs.io/en/latest/index.html
    It takes a lot of the lower level tedium out of using the win32 API for automation. The first line connects to the currently running instance of PC-DMIS by looking for any running processes from PCDLRN.EXE and assigns it to the app variable. The next two lines are calls to the pywinauto library which find the best matching button in that application (in this case, the "Create" button in a window that's titled 'Position') and then clicks it/closes the dialog.

    I'm cleaning it up a bit and trying to figure out a good way to keep the operator from changing anything accidentally, but here's a gif of it in action:
Children