3D IGES: VBScript macros

You can automate Data exchanges with IGES using VBScript macros, either at import or at export

Import

  1. Create a RunTime window (window in which all runtime variables a set)

  2. Type the command:cnext -macro MyMacro.CATScript
    where MyMacro.CATScript is the VBScript macro you want to execute.

  • The input files must be writable (not read only). Otherwise the system will display an information box and wait for an acknowledge.
  • The output file must not exist in the output directory otherwise the system will ask for a confirmation to overwrite the file and wait for an acknowledge.

You can transfer several files within the same VBScript macro, but it is recommended to do only one transfer per VBScript macro.

Example

VBScript macro for implementing a IGES file

Language="VBScript"

Sub CATMain()

Dim Document0 As Document

' Reading an IGES file

Set Document0 = CATIA.Documents.Open( "E:\tmp\Box.igs" )

' Saving the corresponding CATPart

CATIA.ActiveDocument.SaveAs "E:\tmp\Box"

CATIA.Quit

End Sub

 

Export

  1. Create a RunTime window (window in which all runtime variables are set):

  2. Type the command:cnext -macro MyMacro.CATScript
    where MyMacro. CATScript is the VBScript macro you want to execute.

  • The input files must be writable (not read only). Otherwise the system will display an information box and wait for an acknowledge.
  • The output file must not exist in the output directory otherwise the system will ask for a confirmation to overwrite the file and wait for an acknowledge.
You can transfer several files within the same VBScript macro, but it is recommended to do only one transfer per VBScript macro

Example

VBScript macro for exporting a file to IGES

 

Language="VBScript"
Sub CATMain()
Dim PartDocument0 As Document
' Reading a CATPart file
Set PartDocument0 = CATIA.Documents.Open  ( "E:\tmp\Box.CATPart" ) 
' Saving the part in a IGES file
PartDocument0.ExportData "E:\tmp\Box2", "igs"
CATIA.Quit
End Sub