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
Parents
  • 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
Reply
  • 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
Children
No Data