Equipment & Systems |
Distributive Systems |
Accessing Light Part and Light Connector DataHow to query and modify light part and connector data |
Use Case |
AbstractThis article discusses the CAAPspLightPart use case. |
This use case is intended to show you how to query and set light part and light connector data.
[Top]
CAAPspLightPart is a use case of the CAAPlantShipInterfaces.edu framework that illustrates CATPlantShipInterfaces framework capabilities.
[Top]
The goal of CAAPspLightPart is to show you how to use the CATPlantShipInterfaces methods to set and query the definiton points of a light part, set and query the bend radii of a light bendable part, set and query light connector data.
[Top]
To launch CAAPspLightPart, you will need to set up the build time environment, then compile CAAPspLightPart 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]
CAAPspLightPart code is located in the CAAPspLightPart.m use case module of the CAAPlantShipInterfaces.edu framework:
Windows | InstallRootDirectory\CAAPlantShipInterfaces.edu\ CAAPspLightPart.m |
Unix | InstallRootDirectory/CAAPlantShipInterfaces.edu/ CAAPspLightPart.m |
where InstallRootDirectory
is the root directory of your CAA V5
installation. It is made of two unique source files named
CAAPspLightPartMain.cpp and CAAPspLightPart.cpp.
Additional prerequisite code is located in the CAAPspUtilities.m directory of the same framework.
[Top]
There are five logical steps in CAAPspLightPart:
[Top]
In this use case, we open an input document containing some Equipment and Piping Design objects.
[Top]
The CAAPspLightPart 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]
The CATIPspLightPart interface is used to retrieve a list of points defining a light part. It is also used to set the light part definition points. In this sample, the CATIPspLightPart interface pointer is obtained from a light part in the document.
CATListValCATMathPoint ListOfPoints; CATIPspLightPart *piLightPart = NULL; piLightPart = GetALightObject(); if ( NULL != piLightPart ) { //---------------------------------------------------------------------- // List the definition points for the light part //---------------------------------------------------------------------- if ( SUCCEEDED(piLightPart->GetDefinition(NULL,ListOfPoints)) ) { NumOfPts = ListOfPoints.Size(); cout << "Number of light part definition points: " << NumOfPts << endl; for ( int i = 1; i <= NumOfPts; i++ ) { mPt = ListOfPoints[i]; mPt.GetCoord(PtCoord); X = PtCoord[0]; Y = PtCoord[1]; Z = PtCoord[2]; } //------------------------------------------------------------------- // Set the definition points for the light part //------------------------------------------------------------------- if ( SUCCEEDED(piLightPart->SetDefinition(NULL,ListOfPoints)) ) { cout << "Succeeded in setting the light part definition points" << endl; } } piLightPart->Release(); piLightPart = NULL; } |
[Top]
The CATIPspLightBend interface is used to set and retrieve the bend radii of a bendable light part.
if ( NULL != piLightBend ) { //---------------------------------------------------------------------- // List the bend radii //---------------------------------------------------------------------- if ( SUCCEEDED(piLightBend->GetBendData(ListOfRadii)) ) { NumOfPts = ListOfRadii->Size(); cout << "Number of bend radii: " << NumOfPts << endl; //------------------------------------------------------------------- // Set the bend radii //------------------------------------------------------------------- if ( SUCCEEDED(piLightBend->SetBendData(ListOfRadii)) ) { cout << "Succeeded in setting the bend radii" << endl; } } piLightBend->Release(); piLightBend = NULL; } |
[Top]
The CATIPspLightConnector interface pointer is obtained from one of the technological connectors of the light part object. and is used to set and retrieve connector data.
if ( NULL != piLightCntr ) { //---------------------------------------------------------------------- // Get and set the origin point of a light connector //---------------------------------------------------------------------- if ( SUCCEEDED(piLightCntr->GetOrigin(NULL,mPt)) ) cout << "Succeeded in getting the origin of a light part connector" << endl; if ( SUCCEEDED(piLightCntr->SetOrigin(NULL,mPt)) ) cout << "Succeeded in setting the origin of a light part connector" << endl; //---------------------------------------------------------------------- // Get and set the alignment vector of a light connector //---------------------------------------------------------------------- if ( SUCCEEDED(piLightCntr->GetAlignmentVector(NULL,mDirection)) ) cout << "Succeeded in getting the alignment vector of a light part connector" << endl; if ( SUCCEEDED(piLightCntr->SetAlignmentVector(NULL,mDirection)) ) cout << "Succeeded in setting the alignment vector of a light part connector" << endl; //---------------------------------------------------------------------- // Get and set the orientation vector of a light connector //---------------------------------------------------------------------- if ( SUCCEEDED(piLightCntr->GetOrientationVector(NULL,mDirection)) ) cout << "Succeeded in getting the orientation vector of a light part connector" << endl; if ( SUCCEEDED(piLightCntr->SetOrientationVector(NULL,mDirection)) ) cout << "Succeeded in setting the orientation vector of a light part connector" << endl; piLightCntr->Release(); piLightCntr = NULL; } |
[Top]
This use case has demonstrated how to use the Psp interfaces to query and modify a light parts and light connector data. Specifically, it has illustrated:
[Top]
[1] | Building and Launching a CAA V5 Use Case |
Version: 1 [April 2004] | Document created |
[Top] |
Copyright © 2004, Dassault Systèmes. All rights reserved.