Bu CATIA API fonksiyonu ne işe yarar?
Fonksiyon: importMaterialLibrary.CATScript
Cevap:
COPYRIGTH DASSAULT SYSTEMES 2003
 ***********************************************************************
   Purpose:		Import a material library from a text file

   Version:		1.0
   Author:			BMB
   Languages:		CATScript
   Locales:		English
   CATIA Level:	V5R12
 ***********************************************************************
 Main
 Get the file system object
 Get the documents collection
 test if no document is open
 Get material library
 test if the active document is a material library (CATMaterial)
 Get name of the material library text file
 Determine the file separator
 Create the material library text file
 Get the icon folder path
 Declarations and initializations
 counter of line
 current param level
 is TRUE if the file contains at least 1 LIBRARY and 1 FAMILY
 is TRUE until the NewFamily and the NewMaterial haven't been initialized
 Read the input file line by line
 Read the current line
 Test if the line is empty or a comment
 Parse the line, determine param and value
 test for syntax error
 special case for the first param (LIBRARY)
 test for semantic error
 case with no error
 Init families
 Init the new family
 Affect name
 Init materials
 Init the new material
 Affect name
 Affect icon
 & oMaterial.Name & ".jpg")
 Add rendering data on the new material
 Add Analysis data on the new material
 Add Analysis data on the new material
 AmbientCoefficient, DiffuseCoefficient, ... treatment
 one variable mode (format: var)
 Manual mapping
 4=CUSTOM
 array mode (format: var/var/var)
 index mode (format: :i:var/var/var:i:var/var/var... OU :i:var:i:var...)
 Analysis variable
 Isotropic properties
 Orthotropic properties
 update the level
 Save the new CATMaterial
oCat.SaveAs(Left(sAnswer, InStr(sAnswer, ".matlib")-1) & ".CATMaterial")
 End message
msgbox "Operation succeed." & Chr(10) & "The material library has been saved at this location :" & Chr(10) & Chr(10) & Left(sAnswer, InStr(sAnswer, ".matlib")-1) & ".CATMaterial", vbOKOnly, "Import Material Library"
************************************************************************************
	Subs and Functions code
************************************************************************************
------------------------------------------------------------------------------------
	ParseLine
	Parse a line with the format "PARAM=Value" and return the PARAM and the Value
	Return 0 if there is a syntax error on the line
	Return 1 either
------------------------------------------------------------------------------------
 Test the line format
------------------------------------------------------------------------------------
	FindChar
	Return the position of the first character which is not a space or a tab in a string
	Return 0 either
------------------------------------------------------------------------------------
 Avoid the space and tab characters
------------------------------------------------------------------------------------
	FindCharLeft
	Return the position of the first character which is not a space or a tab in a string
		starting at the left
	Return 0 either
------------------------------------------------------------------------------------
 Avoid the space and tab characters
------------------------------------------------------------------------------------
	LevelParam
	Return the level of a param
	0 -> LIBRARY
	1 -> FAMILY
	2 -> MATERIAL
	3 -> PROPERTY
	4 -> AmbientCoefficient, DiffuseCoefficient, ..., AnyWord
	-1 if the param is empty
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
	SYNTAX_ERROR
	Stop the program and indicate the line error
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
	SEMANTIC_ERROR
	Stop the program and indicate the word expected
------------------------------------------------------------------------------------