Equipment & Systems

Distributive Systems

Building a Reference Physical Part

How to build and modify a reference part
Use Case

Abstract

This article discusses the CAAPspBuildPart use case.


What You Will Learn With This Use Case

This use case is intended to show you how to create a new physical part.

[Top]

The CAAPspBuildPart Use Case

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

[Top]

What Does CAAPspBuildPart Do

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]

How to Launch CAAPspBuildPart

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]

Where to Find the CAAPspBuildPart Code

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]

Step-by-Step

There are four logical steps in CAAPspBuildPart:

  1. Prolog
  2. Initializing the Environment
  3. Creating a Reference Part
  4. Modifying a Reference Part

[Top]

Prolog

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

[Top]

Initializing the Environment

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]

Creating a Reference Part

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]

Modifying a Reference Part

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]


In Short

This use case has demonstrated how to use the Psp interfaces to create and modify a reference physical part.  Specifically, it has illustrated:

[Top]


References

[1] Building and Launching a CAA V5 Use Case

History

Version: 1 [April 2004] Document created
[Top]

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