3D PLM PPR Hub Open Gateway |
Knowledge Modeler |
Accessing the Design Table ValuesHow to read values in the design table cells |
Use Case |
AbstractThis article discusses the CAALifDesignTableAccess use case which illustrates how to access the values in a design table. |
In this use case, you will learn how to retrieve the values of a design table.
[Top]
CAALifDesignTableAccess is a use case of the CAALiteralFeatures.edu framework that illustrates KnowledgeInterfaces framework capabilities.
[Top]
The main operations performed in this use case are
[Top]
To launch CAALifDesignTableAccess, you will need to set up the build time environment, then compile CALifDesignTableMain along with its prerequisites, set up the run time environment, and then execute the use case which main program is CALifDesignTableMain [1] with a string argument containing the path of the graphic directory in the runtimeview where the text file of the design table can be found (" ...../intel_a(or solaris_a)/resources/graphic").
[Top]
The CAALifDesignTableAccess use case is made of single source file named CAALifDesignTableAccess.cpp which is called by its CAALifDesignTableMain.cpp main program. Both files are located in the CAALifDesignTable.m module of the CAALiteralFeatures.edu framework:
Windows | InstallRootDirectory\CAALiteralFeatures.edu\CAALifDesignTable.m\ |
Unix | InstallRootDirectory/CAALiteralFeatures.edu/CAALifDesignTable.m/ |
where InstallRootDirectory
is the directory where the CAA
CD-ROM is installed.
[Top]
Here is the step-by-step description of the program:
[Top]
This step creates a session, a Part document, and retrieves from the document's root container a pointer to the factory to be used to create the parameters as well as the formula [2].
[Top]
Six parameters are created [2] [3].
Note that in a usual application, these parameters are retrieved from a
document by using the VisibleParms
method of CATParmDictionary.
For the purpose of the example, the parameter names are identical to the design
table column names. That way all the parameters can be automatically associated
with the design table columns.
[Top]
See [4].
[Top]
const CATListOfCATUnicodeString* pLass = spDesign->Associations(); cout << "List of associations" << endl; for (int i=1 ; i <= pLass->Size() ; i++) { cout << ((*pLass)[i]).CastToCharPtr() << endl; } |
You can check that all the parameters have been associated with all the columns. Here is the list of associations which is displayed at run-time:
List of associations Column1 Column2 Column3 Column4 Column5 Column6 |
[Top]
The column p2 is associated with, is retrieved by using the ParameterColumn method of CATIDesignTable interface. The column number is returned.
cout << (spPp2->Name()).CastToCharPtr() << " is on column" ; // 2 is expected cout << spDesign->ParameterColumn(spPp2) << endl; |
This method returns 0 when the parameter is not associated with any column.
[Top]
Configuration2 is declared as active by using the SetCurrentConfiguration method of the CATIDesignTable interface.
[Top]
The parameter associated with Column4 is retrieved and displayed. Before retrieving the parameter associated with a column, you must specify a current configuration. Otherwise, the ColumnParameter method may return unpredictable result.
... CATUnicodeString col4 = "Column4"; CATICkeParm_var spPar0 = spDesign->ColumnParameter(0,&col4); cout << "The value of the parameter in Column4 is: " ; cout << (spPar0->Show()).CastToCharPtr() << endl; |
The ColumnParameter method returns the parameter which is found in the column whose index is specified as the first argument. If the first argument value is 0, the method returns the parameter which is found in the column whose name is specified in the second argument.
[Top]
... cout << "The parameter value(CellWithColumnType) in Column5 Row2 is: " ; cout << (spDesign->CellWithColumnType(2,5)).CastToCharPtr() << endl; // Display the value in Col5/Row2 as a double in MKS unit cout << "The parameter value(CellAsDouble) in Column5 Row2 is: " ; cout << spDesign->CellAsDouble(2,5) << endl; |
The value located in column5 row5 is displayed. The CellWithColumnType method of CATIDesignTable returns either the value with unit if the unit is specified in the cell or the raw value concatenated with the unit specified with the column name, if any. The value located in column5 row5 is displayed. CATIDesignTable::CellAsDouble returns the value read in a cell in SI units.
Compare the string returned by CATIDesignTable::CellWithColumnType (15mm) with the value returned by CATIDesignTable::CellAsDouble (0.015).
[Top]
To access a design table, you are provided with methods to:
[Top]
[1] | Building and Launching a CAA V5 Use Case |
[2] | Getting Started with Literal Feature Programming |
[3] | Using Persistent Parameters |
[4] | Programming with Design Tables |
[Top] |
Version: 1 [Jan 2000] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.