Equipment & Systems

Distributive Systems

Accessing Function/Physical/Spatial Integration Data

How to access integration data
Use Case

Abstract

This article discusses the CAAPspFunctionPhysical use case.


What You Will Learn With This Use Case

This use case is intended to show you how to obtain integration data from function, physical and spatial objects.

[Top]

The CAAPspFunctionPhysical Use Case

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

[Top]

What Does CAAPspFunctionPhysical Do

The goal of  CAAPspFunctionPhysical is to show you how to use the CATPlantShipInterfaces methods to query and obtain part integration data from function, physical, and spatial objects.

[Top]

How to Launch CAAPspFunctionPhysical

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

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

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

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

Additional prerequisite code is located in the CAAPspUtilities.m directory of the same framework.

[Top]

Step-by-Step

There are five logical steps in CAAPspFunctionPhysical:

  1. Prolog
  2. Initializing the Environment
  3. Retrieving Objects Associated to a Physical Part
  4. Retrieving Physical Objects Associated to a Spatial Object
  5. Retrieving a Physical Object Associated to a Function Object

[Top]

Prolog

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

[Top]

Initializing the Environment

The CAAPspFunctionPhysical 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]

Retrieving Objects Associated to the Physical Part

The CATIPspPhysical interface is used to check if this physical part has an associated function and to retrieve pointers to this function and associated spatial object.   In this sample, the CATIPspPhysical interface pointer is obtained from a physical part in the document. 

       //----------------------------------------------------------------------
       //  Query if physical object has a function associated with it
       //----------------------------------------------------------------------    
       rc = piPhysical->HasFunction(Found);
       if ( Found )
          cout << "CAAPspFunctionPhysical: "
               << "Physical object was created with a function" << endl;
 
       //----------------------------------------------------------------------
       //  Get the function associated to the physical object
       //----------------------------------------------------------------------    
       if ( SUCCEEDED(piPhysical->GetFunctional(piUnknown)) && NULL != piUnknown )
       {
          //  Find CATIPspFunctional interface
          rc = piUnknown->QueryInterface(IID_CATIPspFunctional,(void**)&piFunction);
          piUnknown->Release();
          piUnknown = NULL;
       }
 
       //----------------------------------------------------------------------
       //  Get the spatial object associated to the physical object
       //----------------------------------------------------------------------    
       if ( SUCCEEDED(piPhysical->GetSpatial(piUnknown)) && NULL != piUnknown )
       {
          //  Find CATIPspSpatial interface
          rc = piUnknown->QueryInterface(IID_CATIPspSpatial,(void**)&piSpatial);
          piUnknown->Release();
          piUnknown = NULL;
       }

[Top]

Retrieving Physical Objects Associated to a Spatial Object

Using the spatial object associated to the previous physical object, we find its CATIPspSpatial interface.   A spatial object can be associated to multiple physical objects and the CATIPspSpatial interface is used to retrieve the list of associated physicals. 

   //----------------------------------------------------------------------
   //  Get a list of physical objects 
   //---------------------------------------------------------------------- 
   if ( SUCCEEDED(piSpatial->ListPhysicals(piUnkList))
            && NULL != piUnkList )
   {
       unsigned int ListSize = 0;
       piUnkList->Count(&ListSize);
       piUnkList->Release();  piUnkList = NULL;
       cout << "Number of physical objects associated to the spatial object: "
            << (int)ListSize << endl;
   }

[Top]

Retrieving a Physical Object Associated to a Function Object

The CATIPspFunctional interface is used to retrieve the following information from a function object:

       //-------------------------------------------------------------------
       //  Is function specification driven?
       //-------------------------------------------------------------------
       rc = piFunction->IsSpecDriven(Found);
       ....
       ....

       //-------------------------------------------------------------------
       //  List compatible part types
       //-------------------------------------------------------------------
       if ( SUCCEEDED(piFunction->ListCompatiblePartTypes(Standard,pPartTypeList))
            && NULL != pPartTypeList )
       ....
       ....
       //-------------------------------------------------------------------
       //  List compatible part numbers
       //-------------------------------------------------------------------
       if ( NULL != piResource )
       {
	  CATUnicodeString Path;
	  rc = piResource->GetPartCatalogPath(Path,CatalogName);
          piResource->Release();
	  piResource = NULL;
       }
       if ( SUCCEEDED(piFunction->ListCompatiblePartNumbers(PartType,Standard,
	          CatalogName,pCatPartNameList,pPartNumberList)) )
       ....
       ....
 
       //-------------------------------------------------------------------
       //  Is function realized by a placed part?
       //-------------------------------------------------------------------
       rc = piFunction->IsRealized(Found);
       ....
       ....

       //----------------------------------------------------------------------
       //  Get a list of physical objects associated to this function
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piFunction->ListPhysicals(piUnkList))
            &&  NULL != piUnkList )
       ....
       ....
       //----------------------------------------------------------------------
       //  Check if this function can be realized by the input list of 
       //  physical objects
       //----------------------------------------------------------------------
       CATPspListServices::CreateCATIUnknownList(&piUnkList); // Create a list of unknowns
       if ( NULL != piPhysical )
          rc = piPhysical->QueryInterface (IID_IUnknown, (void **)&piUnknown);

       if (SUCCEEDED(rc) && (NULL != piUnknown) && (NULL != piUnkList))
       {
          rc = piUnkList->Add(0,piUnknown);
          piUnknown->Release(); piUnknown = NULL;
       }

       if ( SUCCEEDED(piFunction->CanBeRealizedBy(piUnkList,pStatusList)) )
       .... 
       ....  
       //----------------------------------------------------------------------
       //  Get the part type of physical object that realizes this function
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piFunction->GetPartType(PartType)) )
          cout << "Part type of physical object that realizes the function: "
               << PartType.ConvertToChar() << endl;

       //----------------------------------------------------------------------
       //  Get the part number of physical object that realizes this function
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piFunction->GetPartNumber(PartNumber)) )
          cout << "Part number of physical object that realizes the function: "
               << PartNumber.ConvertToChar() << endl;

       //----------------------------------------------------------------------
       //  Get the part name of physical object that realizes this function
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piFunction->GetCatalogPartName(CatPartName)) )
          cout << "Part name of physical object that realizes the function: "
               << CatPartName.ConvertToChar() << endl;

       //----------------------------------------------------------------------
       //  Get the standard name
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piFunction->GetStandard(Standard)) )
          cout << "Standard name: " << Standard.ConvertToChar() << endl;

       //----------------------------------------------------------------------
       //  Is it OK to integrate (realize) this function with a physical part?
       //----------------------------------------------------------------------
       CATBoolean IsOK;
       rc = piFunction->IsOKToIntegrate(IsOK);
       ....
       ....

       //----------------------------------------------------------------------
       //  Get the part catalog name
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piFunction->GetPartCatalogName(CatalogName)) )
          cout << "Catalog name: " << CatalogName.ConvertToChar() << endl;

       //----------------------------------------------------------------------
       //  Get the function status
       //---------------------------------------------------------------------- 
       CATPspFunctionStatus Status;
       if ( SUCCEEDED(piFunction->GetFunctionStatus(Status)) )
          cout << "Get function status succeeded" << endl;

[Top]


In Short

This use case has demonstrated how to use the Psp interfaces to obtain object integration data.  Specifically, it has illustrated:

[Top]


References

[1] Building and Launching a CAA V5 Use Case

History

Version: 1 [March 2003] Document created
[Top]

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