Equipment & Systems

Distributive Systems

Accessing Share Data Catalog and Logical Line From/To Objects

How to access logical line catalog and from/to objects
Use Case

Abstract

This article discusses the CAAPspLogicalLine use case.


What You Will Learn With This Use Case

This use case is intended to show you how to obtain a list of logical line ids from the catalog and the objects at the start and end of a logical line.

[Top]

The CAAPspLogicalLine Use Case

CAAPspLogicalLine is a use case of the CAAPlantShipInterfaces.edu framework that illustrates CATPlantShipInterfaces framework capabilities.

[Top]

What Does CAAPspLogicalLine Do

The goal of  CAAPspLogicalLine is to show you how to use the CATPlantShipInterfaces methods to get a list of logical lines from a catalog and to query the from/to objects of the logical line. 

 [Top]

How to Launch CAAPspLogicalLine

To launch CAAPspLogicalLine, you will need to set up the build time environment, then compile CAAPspLogicalLine along with its prerequisites, set up the run time environment, and then execute the sample. This is fully described in the referenced article [1]. When launching the use case, you must pass the following arguments:

[Top]

Where to Find the CAAPspLogicalLine Code

CAAPspLogicalLine code is located in the CAAPspLogicalLine.m use case module of the CAAPlantShipInterfaces.edu framework:

Windows InstallRootDirectory\CAAPlantShipInterfaces.edu\CAAPspLogicalLine.m
Unix InstallRootDirectory/CAAPlantShipInterfaces.edu/CAAPspLogicalLine.m

where InstallRootDirectory is the root directory of your CAA V5 installation. It is made of  two unique source files named CAAPspLogicalLineMain.cpp and CAAPspLogicalLine.cpp.

Additional prerequisite code is located in the CAAPspUtilities.m directory of the same framework.

[Top]

Step-by-Step

There are four logical steps in CAAPspLogicalLine:

  1. Prolog
  2. Initializing the Environment
  3. Retrieving a List of Logical Line IDs from the Logical Line Share Data Catalog
  4. Retrieving Logical Line From/To Objects 

[Top]

Prolog

In this use case, we open an input document containing some Equipment and Piping Design objects. 

[Top]

Initializing the Environment

The CAAPspLogicalLine code is derived from the CAAPspBaseEnv base class. The base class contains functionality common to the other CAAPsp samples.   Initializing the environment involves the following methods:

CAAPspBaseEnv::CreateCATProductEnv
CAAPspBaseEnv::ApplicationInit

These methods perform the following functions:

[Top]

Retrieving a List of Logical Line IDs from the Logical Line Share Data Catalog

The CATIPspShareData interface is used to get a list of logical line IDs from the share data catalog.  In this sample, the CATIPspShareData interface pointer is obtained from the root container of the document.  The resource name for the Piping Line Catalog is obtained by calling CATIPspResource interface method GetLineCatalogPath (refer to use case CAAPspApplication).

    //  Find CATIPspShareData interface
    rc = piRootCont->QueryInterface(IID_CATIPspShareData,(void **)&piShareData);
    
    CATObject *piApplObj = new CATObject("CATPiping");
    if ( NULL != piApplObj )
    {
       //  Find CATIPspResource interface from application object
       rc = piApplObj->QueryInterface(IID_CATIPspResource,(void **)&piResource);
       piApplObj->Release();
       piApplObj = NULL;
    }

    //-------------------------------------------------------------------------
    //  CATIPspShareData methods
    //-------------------------------------------------------------------------
    if ( NULL != piShareData )
    {
       CATUnicodeString ResourceName;
       CATUnicodeString ClassType = "CATPspPipingLine";

       if ( NULL != piResource )
       {
          CATUnicodeString Path;
          rc = piResource->GetLineCatalogPath(ClassType,Path,ResourceName);
          piResource->Release();
          piResource = NULL;
       }

       //----------------------------------------------------------------------
       //  Get a list of logical line IDs from the share data catalog.
       //---------------------------------------------------------------------- 
       if ( ResourceName.GetLengthInChar() > 0 )
       {
          cout << "CAAPspLogicalLine: "
               << "Succeeded in getting resource name for the PipingLine catalog" << endl;
          CATUnicodeString ShareDataType;
          if ( SUCCEEDED(piShareData->List(ResourceName,ShareDataType,&pShareDataList)) )
             cout << "CAAPspLogicalLine: "
                  << "Succeeded in getting a list of Piping Line IDs from the PipingLine catalog" << endl;     
       }
       

       if ( NULL != pShareDataList )
       {
          delete pShareDataList;  pShareDataList = NULL;
       }

       piShareData->Release();
       piShareData = NULL;
    }

[Top]

Retrieving Logical Line From/To Objects

A logical line is a logical grouping of components (parts and strings) that share common attributes.  The members of a logical line could be connected to equipment or nozzle objects.  These equipments and nozzles are not included in the logical line membership.  To retrieve these connected equipment and nozzles, the CATIPspLogicalLine interface method GetFromTo is used.  In this sample, the CATIPspLogicalLine interface pointer is obtained from a Piping Line (logical line) in the input document.

The GetFromTo method of the CATIPspLogicalLine interface returns six output lists.  The first output argument is a list of 'From' equipments (Major objects) and the second output argument is a list of 'From' nozzles (Minor objects).  The third and fourth output arguments are lists of 'To' equipments and 'To' nozzles respectively.  The fifth and sixth output arguments are list of 'From' and 'To' connection pointers (connection between the equipment or nozzle and a member of the logical line).  These 'From' and 'To' lists are based on the flow direction of the logical line members. If the logical line member is connected directly to an equipment object then the Major and Minor lists will contain the equipment object.

    //  Find a logical line in the document;
    piLogLine = GetALogicalLine();
    if ( NULL != piLogLine )
    {
       //----------------------------------------------------------------------
       //  Get a logical line 'from-to' information.
       //----------------------------------------------------------------------    
       if ( SUCCEEDED(piLogLine->GetFromTo(&piFromMajorsList,&piFromMinorsList,
                              &piToMajorsList,&piToMinorsList,
                              &piFromConnectionsList,&piToConnectionsList)) )
          cout << "CAAPspLogicalLine: "
               << "GetFromTo Succeeded" << endl;

For example, using this use case input document, the flow direction of the logical line goes from EQ-111_ to EQ-112_.  The following will be the output of GetFromTo:

[Top]


In Short

This use case has demonstrated how to use the Psp interfaces to obtain information related to logical lines.  Specifically, it has illustrated:

[Top]


References

[1] Building and Launching a CAA V5 Use Case

History

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

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