hexagon logo

Automate export?

Seeking a way to automate the export process, specifically to IGES.

Ideal would be code that happens at finish of program run.

Next best thing would be a button to click.

Any ideas as to where to start?

Thanks in advance!

- Josh
  • That would be much appreciated Josh. Our customer is requesting IGES output for every part as well. Looking forward to seeing what you come up with.
  • Maybe a combination of the current script and AutoIt - http://www.autoitscript.com/site/autoit/ - could be a working start? I mean: use the current script to get the dialog showing, execute an external AutoIt-script to do the button-pushing (it's mostly quite easy with AutoIt taking care of most of the drudgery).
  • ...one way would be to utilize the sendkeys procedure which should be available in Cypress Enable.

    That way you send keystrokes to the active dialog. Much like the AutoIt (some antivirus programs flags AutoIt scripts as bad...).
  • I don't know anything about either of these methods but at a glance the autoit route looks a bit more promising. That dialogue really has no explicit keystroke entries. Everything is either from a drop down list or a button click. Perhaps this can be done thorough sendkeys but it doesn't really seem to be the intended function.
  • That dialogue really has no explicit keystroke entries.


    <TAB><TAB> to get to the alignment combobox, <first letter of alignment name> (make a unique name) to select that, <TAB><TAB><TAB><space> to get to the "Export" button and click it (file is generated at this moment), ...

    ... but after that it seems the dialog is out in no-KEY limbo, I can't find any key that works at this point. So close, and still so far...

    (2013 R SP1)
  • Oh, ok, I understand now. That actually gets you pretty far. That will prevent the selection of an incorrect alignment, the biggest risk here. After that the operator just needs to click "ok".
  • <TAB><TAB> to get to the alignment combobox, <first letter of alignment name> (make a unique name) to select that, <TAB><TAB><TAB><space> to get to the "Export" button and click it (file is generated at this moment), ...

    ... but after that it seems the dialog is out in no-KEY limbo, I can't find any key that works at this point. So close, and still so far...

    (2013 R SP1)


    Well... Get the (PC-DMIS) coders to switch focus to the dialog again after exporting, that way it will not end up in no-KEY limbo... Smiley
  • I'm not sure they are focused enough on the user experience to manage that, judging by the number of dialogs that are more or less impossible to navigate without a mouse (I'm a keyboard man myself, don't want to lift my hand to the mouse more than necessary).
  • I'm not sure they are focused enough on the user experience to manage that, judging by the number of dialogs that are more or less impossible to navigate without a mouse (I'm a keyboard man myself, don't want to lift my hand to the mouse more than necessary).


    +1
  • I've been playing around with this a bit today. I can't get the sendkeys approach to work. It seems that once you make the call to run the export command the script pauses until the command has completed. It is only after the command is complete that it sends any key strokes, which is too late. Is there another way to approach this?

    'This script will export the features In the active program To a file of the Type specified by the extension value
    'In the Part.Export Function Line. The export path And file Name are defined by concatenating the values of 
    'several variables defined In the PC-DMIS program.
    
    Sub Main(PN1 As String, OP1 As String, SN1 As String, RPTTIME1 As String, RPTDATE1 As String, IGS1 As String, PRG_TYPE1 As String)
    
    Dim App As Object
    Set App = CreateObject("PCDLRN.Application")
    
    Dim Part As Object
    Set Part = App.ActivePartProgram
    
    Dim CADFullPath As String
    
    'Add back the leading zero To the time If truncated
    If len(RPTTIME1) = 5 Then
    RPTTIME1 = "0" & RPTTIME1
    End If
    
    'Concatenate variable values passed from PCD To create full path For new CAD file
    CADFullPath=IGS1 & PN1 & "\RESULTS\" & OP1 & "\" & PN1 & "_" & OP1 & "_" & PRG_TYPE1 & "_" & SN1 & "_" & RPTDATE1 & "_" & RPTTIME1
    
    'Call export Function. Change the value of the extension below To change the file Type exported.
    Part.Export CADFullPath + ".igs"
    
    Appactivate "Execution Mode Options"
    
    Sendkeys "{TAB}"
    Sendkeys "{TAB}"
    Sendkeys "3"
    Sendkeys "{TAB}"
    Sendkeys "{TAB}"
    Sendkeys "{TAB}"
    Sendkeys "{SPACE}"
    
    End Sub