3D PLM PPR Hub Open Gateway

Knowledge Modeler

Accessing the Design Table Values

How to read values in the design table cells

Use Case

Abstract

This article discusses the CAALifDesignTableAccess use case which illustrates how to access the values in a design table.


What You Will Learn With This Use Case

In this use case, you will learn how to retrieve the values of a design table.

[Top]

The CAALifDesignTableAccess Use Case

CAALifDesignTableAccess is a use case of the CAALiteralFeatures.edu framework that illustrates KnowledgeInterfaces framework capabilities.

[Top]

What Does the CAALifDesignTableAccess Do

The main operations performed in this use case are

[Top]

How to Launch CAALifDesignTableAccess

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]

Where to Find the CAALifDesignTableAccess Code

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]

Step-by-Step

Here is the step-by-step description of the program:

  1. Prolog
  2. Creating Parameters
  3. Creating the Design Table
  4. Displaying the List of Associations
  5. Retrieving the Column Associated With a Parameter
  6. Setting the Active Configuration
  7. Retrieving the Parameter Associated With a Column
  8. Retrieving the Value Located in a Given Row and a Given Column

[Top]

Prolog

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]

Creating Parameters

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]

Creating the Design Table

See [4].

[Top]

Displaying the List of Associations

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]

Retrieving the Column Associated With a Parameter

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]

Setting the Active Configuration

Configuration2 is declared as active by using the SetCurrentConfiguration method of the CATIDesignTable interface.

[Top]

Retrieving the Parameter Associated With a Column

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]

Retrieving the Value Located in a Given Row and a Given Column

...
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]


In Short

To access a design table, you are provided with methods to:

[Top]


References

[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]

History

Version: 1 [Jan 2000] Document created
[Top]

Copyright © 2000, Dassault Systèmes. All rights reserved.