'----------------------------------------------------------------------------
'  Abstract :
'  Conversion batch of V4 libraries in V5 catalogs.
'
' The generated report file (*.report) is located in the 
' same catalog directory with the same catalog name.
'   
'----------------------------------------------------------------------------

Language="VBSCRIPT"

Sub CATMain()

' The following valuated parameters (AS_SPEC = 0
' and AS_RESULT = 1) define the conversion format
' option of the space details in parts. DO NOT MODIFY
' these values; they are mandatory and reserved for
' the running application.

AS_SPEC   = 0
AS_RESULT = 1


' Choose a conversion format by specifying the value
' AS_SPEC or AS_RESULT 
' (e.g. CONVERSION_FORMAT = AS_SPEC).

CONVERSION_FORMAT = AS_SPEC


' The following valuated parameters (MIGRATION = 0 
' and SIMULATION = 1) define the batch mode option. 
' DO NOT MODIFY these values; they are mandatory
' and reserved for the running application.

MIGRATION  = 0
SIMULATION = 1


' Choose the desired batch mode by specifying 
' the value MIGRATION or SIMULATION 
' (e.g. BATCH_MODE = MIGRATION).

BATCH_MODE = MIGRATION  


' Specify the absolute UNIX directory of the V4 
' library. In Windows, use the http protocol and 
' take care of the / separator on UNIX 
' (e.g. libraryDirectory 
'          = "http://machine_name/../../FASTENERS").

libraryDirectory = "http://../../FASTENERS"


' Specify the absolute directory of the catalog. In 
' Windows, take care of the \ separator 
' (e.g.  catalogDirectory = "E:\..\..\catalog").

catalogDirectory = "E:\..\..\Catalog"


' Specify the absolute UNIX directory of the V4 project
' if the V4 library needs one
' (e.g. projectDirectory 
'          = "http://machine_name/../../project"),
' otherwise, you have to specify an empty one
' (e.g. projectDirectory = " ").

projectDirectory = "http://../../Interop"
'projectDirectory = " "


' Specify the absolute path of the character 
' conversion table to convert V4 file names of details 
' and families in V5 file names of parts and chapters
' (e.g.  tablePath = "E:\..\..\table.txt"), or indicate an
' empty one if you want to use the default installation
' (e.g.  tablePath = "").

tablePath = "E:\..\..\table.txt"


' Creates a CatalogDocument type document. DO 
' NOT MODIFY the following declaration and valuated
' parameters 
' (Dim Catalog As Document and 
'  Set Catalog = 
'         CATIA.Documents.Add("CatalogDocument")).

Dim Catalog As Document
Set Catalog = CATIA.Documents.Add("CatalogDocument")


' Calls CreateCatalogFromLibrary method on Catalog. 
' DO NOT MODIFY the following declaration related to 
' previous variables
' (Catalog.CreateCatalogFromLibrary 
'		libraryDirectory, 
'		projectDirectory,
'		catalogDirectory, 
'		tablePath, 
'		CONVERSION_FORMAT, 
'		BATCH_MODE).

Catalog.CreateCatalogFromLibrary libraryDirectory, projectDirectory, catalogDirectory, tablePath, CONVERSION_FORMAT, BATCH_MODE


' To perform automatically the close of the newly created 
' catalog, decomment the Catalog.close command,
' otherwise put the command in comments.

Catalog.Close

End Sub
