Equipment & Systems |
Distributive Systems |
Building a Reference Physical PartHow to build and modify a reference part |
Use Case |
AbstractThis article discusses the CAAPspBuildPart use case. |
This use case is intended to show you how to create a new physical part.
[Top]
CAAPspBuildPart is a use case of the CAAPlantShipInterfaces.edu framework that illustrates CATPlantShipInterfaces framework capabilities.
[Top]
The goal of CAAPspBuildPart is to show you how to use the CATPlantShipInterfaces methods to create a new reference physical part, set and query its parametric attribute names and change the physical part type.
[Top]
To launch CAAPspBuildPart, you will need to set up the build time environment, then compile CAAPspBuildPart 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]
CAAPspBuildPart code is located in the CAAPspBuildPart.m use case module of the CAAPlantShipInterfaces.edu framework:
Windows | InstallRootDirectory\CAAPlantShipInterfaces.edu\ CAAPspBuildPart.m |
Unix | InstallRootDirectory/CAAPlantShipInterfaces.edu/ CAAPspBuildPart.m |
where InstallRootDirectory
is the root directory of your CAA V5
installation. It is made of two unique source files named
CAAPspBuildPartMain.cpp and CAAPspBuildPart.cpp.
Additional prerequisite code is located in the CAAPspUtilities.m directory of the same framework.
[Top]
There are four logical steps in CAAPspBuildPart:
[Top]
In this use case, we open an input document containing some Equipment and Piping Design objects.
[Top]
The CAAPspBuildPart 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 CATIPspBuildPart interface is used to create a new reference physical part in a new CATPart document. In this sample, the CATIPspBuildPart interface pointer is obtained from the Piping Design application (CATPiping) late type object.
CATUnicodeString PartType = "CATPipGateValve"; CATUnicodeString NewPartType = "CATPipGlobeValve"; CATUnicodeString PartNumber = "GateValve"; CATUnicodeString NewPartNumber = "GlobeValve"; CATUnicodeString LightPartType = "CATPipStraightPipe"; if ( NULL != piBuildPart ) { // Create a new Piping part reference document if ( SUCCEEDED(piBuildPart->NewPart(PartType,PartNumber,&piPartPrdRef)) && NULL != piPartPrdRef ) { cout << "CAAPspBuildPart: " << "A new part reference was created" << endl; .... .... |
[Top]
The CATIPspBuildPart interface is also used to set and query the reference part parametric attribute names and to change the part class type.
// Set the part parametric attribute names CATListValCATUnicodeString *pListAttrNames = new CATListValCATUnicodeString; if ( pListAttrNames ) { pListAttrNames->Append("Nominal size"); pListAttrNames->Append("Standard"); if ( SUCCEEDED(piBuildPart->SetPartParametricAttributes(piPartPrdRef, pListAttrNames)) ) cout << "Saved the part parametric attribute names" << endl; delete pListAttrNames; pListAttrNames = NULL; } // List the part parametric attributes if ( SUCCEEDED(piBuildPart->ListPartParametricAttributes(piPartPrdRef, pListAttrNames)) ) { delete pListAttrNames; pListAttrNames = NULL; } // Change the part type if ( SUCCEEDED(piBuildPart->ChangePartType(piPartPrdRef, NewPartType,NewPartNumber,&piPartPrdNewRef)) ) { cout << "The class type of the part was changed" << endl; piPartPrdNewRef->Release(); piPartPrdNewRef = NULL; } piPartPrdRef->Release(); piPartPrdRef = NULL; |
[Top]
This use case has demonstrated how to use the Psp interfaces to create and modify a reference physical part. 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.