hexagon logo

Autorun application/script in PC-DMIS?

Like the title says...

Does anyone know of a way to have an application or script to run upon open an existing partprogram or creating a new partprogram?

Also, can I create toggle icons in the custom toolbar? Like, on/off (ie. 'points only' or 'use theos from CAD')?
  • Set PCD_App = GetObject("", "PCDLRN.Application")
    Set PCD_pps = PCD_App.PartPrograms
    Set PCD_pp = PCD_pps.Open("path/name.prg", machine) where machine is "OFFLINE" or "CMM1" - not completely sure

    I think to create a new one:
    Set PCD_pp = PCD_pps.Add("path/name.prg", units, machine, probfile)

    units = 1 for MM else Inch
  • Thanks, but if I am not mistaken, this is for opening or creating a new partprogram in PC-DMIS?

    I was thinking more of a way to have PC-DMIS run an application each time I open (or create new) partprogram.

    * Start PC-DMIS
    * Load or create new partprogram
    * After you have entered the info for the new partprogram and clicked OK, or
    when the opened partprogram has loaded - the edit window, graphics window will be displayed along with your toolbars etc.

    At this certain point is where I want PC-DMIS to start my application (or whatever). It would be possible to catch the creation of the edit window globally, but that would mean that I'd had to run my 'watcher' as a service or on Windows startup. Think of the external application as the probe calibration dialog. You can have that to pop up on the creation of a new partprogram and this is what I want PC-DMIS to do on every program (opened or created) but running an external app instead.

    Is this doable?

    Also, is there a way to find out or know at what 'line' in the editwindow the cursor currently is located? I have successfully managed to enumerate all commands prior to the cursors position - so I don't retrieve the commands after the cursor position (since these are not 'available' for use). This does NOT work if the cursor is located at a line where ENDMEAS/ is located...

    So, is there a way for me to know at what line or at what commandindex I currently have the cursor?
  • Don't know alot about the automation side.
    There is an event generated when a part program is opened so an external program could wait for that to happen and do something. Never tried it so I do not know how to get the event.

    I do not know about the cursor position availability.
  • Check out Wilcox script repositry for

    programcreator.zip & start_pcdmis.zip

    which can be downloaded

    Regards

    Simon
  • SABarber,

    The 'Commands.CurrentCommand.ID' is returning 'nil' or '' if the cursor is located on a "ENDMEAS/" line in the editwindow. I have placed the cursor on all possible commands and the 'Commands.CurrentCommand.ID' is getting the ID of the current command (cursor location) but not if the cursor is located at an "ENDMEAS/" line.

    Is this a bug or is there another way for me to know which feature the "ENDMEAS/" belongs to?

    Unless there is another way for me to know my exact location in the editwindow?

    If you don't know the answer to my problem (which makes it hard to do some very useful stuff in automation) could you please forward it to the correct person (I assume you are in the software business at WAI)?

    I would appreciate it very much!


    No need for the above - tried a little bit harder and found out that I could limit the enumeration of the commands with the GetUniqueID property. However, I think that a property that would let the automation programmer know exactly where in the edit window the cursor is positioned would be a nice enhancement to the library (like EditWindow.CurrentPosition or Commands.CurrentPosition).