3D PLM Enterprise Architecture

V4 Access

Retrieving Data of an Element of a V4 Document

Get the information contained in a model
Use Case

Abstract

This article shows how to retrieves data of a V4 element. 

What You Will Learn With This Use Case

This use case is intended to show you how to retrieve data of an element of a model.
[Top]

The CAAV4iEduV4DataAccess Use Case

CAAV4iEduV4DataAccess is a use case of the CAACATIAV4Interfaces.edu framework that illustrates CATIAV4Interfaces framework capabilities.
[Top]

What Does CAAV4iEduV4DataAccess Do

CAAV4iEduV4DataAccess begins by opening the .model document.
Then, it scans the model using functions of CATIAV4Interfaces to get the element to be analyzed [1]. These elements are objects of the class CATV4iV4Element.
In this particular case, it retrieves the first element of the first set of the workspace MASTER.
Finally, data of the element are retrieved : the identificator, the primary and secondary types, the number of the layer of the element and some graphical information about the element.
The elements are removed.
[Top]

How to Launch CAAV4iEduV4DataAccess

To launch CAAV4iEduV4DataAccess , you will need to set up the build time environment, then compile CAAV4iEduV4DataAccess along with its prerequisites, set up the run time environment, and then execute the use case [2].
CAAV4iEduV4DataAccess takes two parameters.

mkrun -c CAAV4iEduV4DataAccess InputModel  OutputFile 

Where:

  InputModel : the full path of the model
  OutputFile : the full path of the output text file.

You can use the model CUBE.model located in CAADoc/CAACATIAV4Interfaces.edu/CNext/resources/graphic

[Top]

Where to Find the CAAV4iEduV4DataAccess Code

The CAAV4iEduV4DataAccess use case is made of a single file located in the CAAV4iEduV4DataAccess.m module of the CAACATIAV4Interfaces.edu framework:
 
Windows InstallRootDirectory\CAACATIAV4Interfaces.edu\CAAV4iEduV4DataAccess.m\
Unix InstallRootDirectory/CAACATIAV4Interfaces.edu/CAAV4iEduV4DataAccess.m/

where InstallRootDirectory is the directory where the CAA CD-ROM is installed.
 

[Top]

Step-by-Step

There are 3 logical steps in CAAV4iEduV4DataAccess :
  1. Opening the model
  2. Scaning the model
  3. Retrieving the data
[Top]

Opening the model

...
  char* pathname = argv[1];
  CATDocument * doc=NULL;
  CATUnicodeString filename( pathname );
  CATDocumentServices::OpenDocument( filename, doc, readOnlyFlag );
...

To access to the data of the model, a CATDocument is needed.
The path of the model passed in argument is converted to a CATString and is used to open the model in "read only" mode.
 

[Top]

Scaning the model

...
  CATV4iV4Element* masterElem=NULL;
  CATV4iV4Element* setElem=NULL;
  CATV4iV4Element* element=NULL;
  int end =0;
  if (! CATV4iGetMaster(doc, masterElem, ier) )
  {
    if (! CATV4iGisset(masterElem, setElem, end, ier) )
    {  
      if (! CATV4iGisels(setElem, NULL, element, end, ier) )
      {
...

CATV4iGetMaster is a functions that retrieves the first workspace of the model : the MASTER. If doc is not a V4 document, the function fails.
CATV4iGisset retrieves the first set of the workspace masterElem.
CATV4iGisels retrieves the first element of the set setElem.

[Top]

Retrieving the data

...
          CATString identificator=element->GetId();
...
          int itp, its;
          element->GetType(itp, its);
...
          int layer =-1;
          result = CATV4iGirlay(element, layer, ier);
...
          int oShow=-1, oPick=-1, oCol=-1, oBlink=-1, oThick=-1, oLine=-1;
          result = CATV4iGirvis( element, oShow, oPick, oCol, oBlink, oThick, oLine, ier);
...

If element has been correctly created by CATV4iGisels, the data can be retrieved.
element->Id() retrieves the identificator of the element,
element->GetType(...) retrieves the primary and the secondary types of element
...CATV4iGirlay(... retrieves the number of the layer
...CATV4iGirvis(... retrieves graphical data about the element : show, pickable, color, blink, steady, thickness, line type.

[Top]

In Short

This use case provides a way to retrieves information of  elements of a model.
[Top]

References

[1] Scanning the model
[2] Building and Launching a CAA V5 Use Case
[Top]

History

Version: 1 [Jul 2003] Document created
[Top]

Copyright © 1994-2003, Dassault Systèmes. All rights reserved.