Equipment & Systems |
Distributive Systems |
Accessing User computed propertiesHow to access user computed attributes |
Use Case |
AbstractThis article discusses the CAAPspUserProperties use case. |
This use case is intended to show you how to access User computed properties defined in the use case CAAPspDefineUserProperties.
[Top]
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]
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]
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]
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]
There are five logical steps in CAAPspUserProperties:
[Top]
In this use case, we open an input Distributive System document containing some Equipment and Piping Design objects.
[Top]
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]
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]
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]
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]
This use case has demonstrated how to access User computed properties for PipingPart object.
[Top]
[1] | Building and Launching a CAA V5 Use Case |
[2] | Define User computed property |
Version: 1 [January 2005] | Document created |
[Top] |
Copyright © 2005, Dassault Systèmes. All rights reserved.