3D PLM Enterprise Architecture

V4 Access

Retrieving Tubing Data From a V4 Document

Get the information contained in a model
Use Case

Abstract

This article shows how to retrieve tubing data from a V4 document. 

What You Will Learn With This Use Case

This use case is intended to show you how to retrieve tubing data from a V4 model.
[Top]

The CAAV4iEduGetTubingData Use Case

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

What Does CAAV4iEduGetTubingData Do

CAAV4iEduGetTubingData 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, tubing data of the element are retrieved : the tubing line name, the diameter, the bend radius, and the extremity coordinates.
The elements are removed.
[Top]

How to Launch CAAV4iEduGetTubingData

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

mkrun -c CAAV4iEduGetTubingData InputModel  OutputFile 

Where:

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

You can use the model TUBING.model and TUBING2.model located in CAADoc/CAACATIAV4Interfaces.edu/CNext/resources/graphic

[Top]

Where to Find the CAAV4iEduGetTubingData Code

The CAAV4iEduGetTubingData use case is made of a single file located in the CAAV4iEduGetTubingData.m module of the CAACATIAV4Interfaces.edu framework:
 
Windows InstallRootDirectory\CAACATIAV4Interfaces.edu\CAAV4iEduGetTubingData.m\
Unix InstallRootDirectory/CAACATIAV4Interfaces.edu/CAAV4iEduGetTubingData.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. Scanning 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

// Get the tubing line Outside Diameter

double Diameter = 0.0;

double BendRadius = 0.0;

double Angle = 0.0;

double Extremity1[3];

double Extremity2[3];

double Center[3];

double Udir[3];

double Vdir[3];

int iReturnElbowTubeData = CATV4iGetElbowTubeData (element, Diameter, BendRadius, Angle, Extremity1,

Extremity2, Center, Udir, Vdir);

if (iReturnElbowTubeData == -1)

outputFile << "CATV4iGetElbowTubeData failed" << endl;

else if (iReturnElbowTubeData == 0)

{

outputFile << "CATV4iGetElbowTubeData succeeded" << endl;

outputFile << "Elbow tube Diameter = " << Diameter << endl;

outputFile << "Elbow tube BendRadius = " << BendRadius << endl;

outputFile << "Elbow tube Angle = " << Angle << endl;

 

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 retrieve tubing information from elements in a V4 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.