Equipment & Systems

Distributive Systems

Accessing User computed properties

How to access user computed attributes
Use Case

Abstract

This article discusses the CAAPspUserProperties use case.


What You Will Learn With This Use Case

This use case is intended to show you how to access User computed properties defined in the use case CAAPspDefineUserProperties.

[Top]

The CAAPspUserProperties Use Case

CAAPspUserProperties is a use case of the CAAPlantShipInterfaces.edu framework that illustrates how to access user computed attribute value defined via use case CAAPspDefineUserProperties.

[Top]

What Does CAAPspUserProperties Do

The goal of  CAAPspUserProperties  is to show you how to use the CATPlantShipInterfaces methods to query and obtain data about the user computed attributes.

 [Top]

How to Launch CAAPspUserProperties

To launch CAAPspUserProperties, you will need to set up the build time environment, then compile CAAPspUserProperties 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 CAAPspUserProperties Code

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

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

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

Additional prerequisite code is located in the CAAPspUtilities.m directory of the same framework. Also see referenced article [2]

 

[Top]

Step-by-Step

There are five logical steps in CAAPspUserProperties:

  1. Prolog
  2. Initializing the Environment
  3. Loading PipingLayout Knowledgeware package
  4. Retrieving PipingPart exposed instance
  5. Retrieving computed attribute value 

[Top]

Prolog

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

[Top]

Initializing the Environment

The CAAPspUserProperties 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

This method performs the following functions:

[Top]

Loading PipingLayout knowledgeware package

In this sample, the CATIPspPhysicalProduct interface pointer (piPhysical ) is obtained from a physical part (piping part) in the document. 

Then get a  Type dictionary handler spDico  by calling CATGlobalFunctions::GetTypeDictionary().  To make sure "PipingLayout" knowledgeware package is loaded call function LoadPackage() of spDico

    //  Get a physical object from the input document
    piPhysical = GetAPhysicalObject();   
     CATITypeDictionary_var spDico = CATGlobalFunctions::GetTypeDictionary();

    if(!!spDico )
    {
      spDico->LoadPackage( "PipingLayout" );
    }
....

[Top]

Retrieving Piping Part exposed instance

To obtain expose type for a physical Piping part  get   CATIInstance interface pointer (piInstance) from the piPhysical interface pointer.

 

    if ( NULL != piPhysical )
    {
      rc = piPhysical->QueryInterface (IID_CATIInstance,(void **)&piInstance);
    ...
		 

[Top]

Retrieving computed attribute value

To get CATIValue interface pointer  for computed attribute (say "TotalWallThickness" ) call GetValue method on the CATIInstance pointer piInstance.  Then use the CATIValue::Show() method  to get value corresponding for computed attribute.

       piVal = piInstance->GetValue("TotalWallThickness");
        if( NULL != piVal )
        {
           CATUnicodeString uAttrVal = piVal->Show();
           cout << "TotalWallThickness value is:" << uAttrVal.ConvertToChar() << endl;
        }
       ...

[Top]


In Short

This use case has demonstrated how to  access User computed properties for PipingPart object.

[Top]


References

[1] Building and Launching a CAA V5 Use Case
[2] Define User computed property

History

Version: 1 [January 2005] Document created
[Top]

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