'// COPYRIGHT DASSAULT SYSTEMES  1999
'//============================================================================
'//
'// Language="VBSCRIPT"
'// To build catalog
'//
'//============================================================================
'// Major CATIA interface used:
'//
'// interface               VB Name         Remarks
'// -----------            ------------    --------------
'// CATIACatalogDocument   CatalogDocument create catalog
'//
'//============================================================================
Option Explicit
'******************************************************************************
'  GLOBAL variable declarations section
'******************************************************************************
Dim strGInputPath
Dim strGOutputPath
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
'//                       User customizable sections              
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Const NBGCSVFile = 1
Dim strArrayGCSVFile (1)
'------------------------------------------------------------------------------
Sub InitCSVFileArray ()
'------------------------------------------------------------------------------
strArrayGCSVFile(1) = "USER"
End Sub '/////////////////////////////////////////////// InitCSVFileArray
'------------------------------------------------------------------------------
Sub GetPath ()
'------------------------------------------------------------------------------
  strGInputPath = InputBox("Path of the catalog input directory:", _
      "Input path for CSV files", _
      "e:\users\jcm\USER\CsvFiles\")
  strGOutputPath = InputBox("Path of the catalog output directory:", _
      "Output path for Catalogs", _
      "e:\users\jcm\USER\")
End Sub '/////////////////////////////////////////////// GetPath
'------------------------------------------------------------------------------
Sub CATMain ()
'------------------------------------------------------------------------------
  Dim objCatalogDoc As Document
  Dim intK As Integer
  Dim strCSVFile
  Dim strCatalogFile
  InitCSVFileArray
  GetPath
  On Error Resume Next
  For intK = 1 to NBGCSVFile
     strCSVFile = strGInputPath & strArrayGCSVFile (intK) & ".csv"
     strCatalogFile = strGOutputPath & strArrayGCSVFile (intK) & ".catalog"
     Set objCatalogDoc = CATIA.Documents.Add("CatalogDocument")
     '---------- Generate catalog
     objCatalogDoc.CreateCatalogFromcsv strCSVFile,strCatalogFile
  Next  'For intK
  MsgBox "Press OK to quit", 0, "CATALOG CREATION COMPLETED"
End Sub '/////////////////////////////////////////////// CATMain
