Bu CATIA API fonksiyonu ne işe yarar?
Fonksiyon: CAAKniParAndFormulas.CATScript
Cevap:
COPYRIGHT DASSAULT SYSTEMES 2001
 ***********************************************************************
   Purpose:      This macro:
                 1 - Checks whether the active document is a CATPart
                 2 - Retrieves the Relations collection. This is required
                     to create formulas
                 3 - Retrieves the Parameters collection. This is required
                     to create parameters
                 4 - Creates parameters
                 5 - Creates formulas
                 6 - Displays the list of relations
                 7 - Displays the list of parameters
                 Notes: a) The parameter list which is displayed contains
                           all the document parameters (i.e. the user parameters
                           and the others as well)
                        b) If you replay the macro - you create new parameters
                           and formulas, but parameter names are not those specified.

   Author:       Carole ROULLE, Pierre Grignon
   Languages:    VBScript
   Locales:      English (United States)
   CATIA Level:  V5R6
   revision V5R13
 ***********************************************************************
 Set the CATIA popup file alerts to False
 It prevents to stop the macro at each alert during its execution
 Retrieve your active document - CATIA is your application
 You get the active document by using the ActiveDocument property
 on your application object
 -----------------------------------------------------------
 Optional: allows to find the sample wherever it's installed
 -----------------------------------------------------------
 Open the Part document
 Set the CATIA popup file alerts to False
 It prevents to stop the macro at each alert during its execution
 Retrieve your active document - CATIA is your application
 You get the active document by using the ActiveDocument property
 on your application object
 Check whether the document is a CATPart
 Retrieve the collection object which contains
 all the document relations.
 The statements below are only valid when the active
 document is a CATPart
 Retrieve the collection object which contains
 all the document parameters
 Remove the SphereRadius parameter
 if it exists in the Parameters collection
 Create the ProjectId parameter
 This parameter is a string type parameter
 Its initial value is CATLifKnowledgeAdvisor
 Create the ProjectKey parameter
 This parameter is a string type parameter
 Its initial value is a blank string
 Create an integer type parameter
 Its name is Stringlength - its initial value is 0
 Create a Length type parameter
 Its initial name is blank
 Its initial value is 0
 Note that units are specified in internal units
 i.e the units used by the geometric modeler (mm for Length)
 Rename the created parameter and assigns a value to it
 Note: this cannot be done if a parameter
 already named SphereRadius exists in the document
 This is why a search for a SphereRadius parameter has
 been performed above.
 Display the minum tolerance for "SphereRadius"
 Create a Volume type parameter
 Its name is SphereVolume
 Its initial value is 0 m3
 Create a formula which specifies that the ProjectKey parameter value
 equals the three first characters of ProjectId
 To do so we use the CreateFormula method of the "Relations" collection
 object - the constrained parameter is passed as the third argument of the
 method - The formula expression is passed as the fourth argument.
 Note that the Extract function is provided by the Knowledge Advisor
 string function dictionary
 Create a formula which also applies to the ProjectKey parameter
 This formula will be created as inactive
 Create a formula which applies to the StringLength parameter
 The formula expression passed as the fourth argument
 uses the Length function which is provided with the string functions of the
 Knowledge Advisor dictionary
 Create a formula which applies to the SphereVolume parameter
 It just calculates the volume from the radius
 Display the list of relations
 The formula names and expressions are displayed in a message box
 Update the document