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
  • Here is a script based on the one above. This one takes some variable values that are passed from PC-DMIS and concatenates them into a full path that defines both the destination directory and the name of the exported CAD file. As always, the file extension determines the actual format of the file. This still isn't fully automated in that you still need to select the alignment that you want to use, click "process", and then click "OK". I'm not sure how to get around 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)
    
    Dim App As Object
    Set App = CreateObject("PCDLRN.Application")
    
    Dim Part As Object
    Set Part = App.ActivePartProgram
    
    Dim CADFullPath As String
    
    'Concatenate variable values passed from PCD To create full path for new CAD file
    CADFullPath=IGS1 & PN1 & "\Results\IGES\" & PN1 & "_" & OP1 & "_" & SN1 & "_" & RPTTIME1 & "_" & RPTDATE1
    
    'Call export Function. Change the value of the extension below To change the file Type exported.
    Part.Export CADFullPath + ".igs"
    
    End Sub




    P.S. The path MUST already exist. If it doesn't you will get a "Method Exception : Internal Application Error"
Reply
  • Here is a script based on the one above. This one takes some variable values that are passed from PC-DMIS and concatenates them into a full path that defines both the destination directory and the name of the exported CAD file. As always, the file extension determines the actual format of the file. This still isn't fully automated in that you still need to select the alignment that you want to use, click "process", and then click "OK". I'm not sure how to get around 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)
    
    Dim App As Object
    Set App = CreateObject("PCDLRN.Application")
    
    Dim Part As Object
    Set Part = App.ActivePartProgram
    
    Dim CADFullPath As String
    
    'Concatenate variable values passed from PCD To create full path for new CAD file
    CADFullPath=IGS1 & PN1 & "\Results\IGES\" & PN1 & "_" & OP1 & "_" & SN1 & "_" & RPTTIME1 & "_" & RPTDATE1
    
    'Call export Function. Change the value of the extension below To change the file Type exported.
    Part.Export CADFullPath + ".igs"
    
    End Sub




    P.S. The path MUST already exist. If it doesn't you will get a "Method Exception : Internal Application Error"
Children
No Data