Equipment & Systems

Distributive Systems

Accessing Part Connector Data

How to access part connector data
Use Case

Abstract

This article discusses the CAAPspPart use case.


What You Will Learn With This Use Case

This use case is intended to show you how to obtain a physical part's connectors, add and remove a part connector to a physical part, and query the connectors.

[Top]

The CAAPspPart Use Case

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

[Top]

What Does CAAPspPart Do

The goal of  CAAPspPart is to show you how to use the CATPlantShipInterfaces methods to query and obtain part connector information. 

 [Top]

How to Launch CAAPspPart

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

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

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

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

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

[Top]

Step-by-Step

There are six logical steps in CAAPspPart:

  1. Prolog
  2. Initializing the Environment
  3. Retrieving a List of Part Connectors
  4. Retrieving Part Connector Data
  5. Removing and Adding a Part Connector
  6. Modifying Part Connector Data

[Top]

Prolog

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

[Top]

Initializing the Environment

The CAAPspPart 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 a List of Part Connectors

The CATIPspPhysicalProduct interface is used to get the number of technological connectors belonging to a physical part and to retrieve a list of its connectors.   In this sample, the CATIPspPhysicalProduct interface pointer is obtained from a physical part in the document. 

if ( SUCCEEDED(piPhysProd->GetNumberOfConnectors(NumOfCtrs)) )
          cout << "Number of connectors on part: " << NumOfCtrs << endl;
if ( SUCCEEDED(piPhysProd->ListConnectors(NULL,&piUnkList))
            && NULL != piUnkList )
....

[Top]

Retrieving Part Connector Data

The  CATIPspPartConnector interface pointer is obtained from one of the technological connectors and used to get the following information:

       //----------------------------------------------------------------------
       //  Get face connector pointer
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piPartCntr->GetFaceConnector(&piUKFaceCtr)) )
          cout << "Get face connector succeeded" << endl;

       //----------------------------------------------------------------------
       //  Get alignment connector pointer
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piPartCntr->GetAlignmentConnector(&piUKAlignCtr)) )
          cout << "Get alignment connector succeeded" << endl;

       //----------------------------------------------------------------------
       //  Get orientation connector pointer
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piPartCntr->GetOrientationConnector(&piUKOrientCtr)) )
          cout << "Get orientation connector succeeded" << endl;

       //----------------------------------------------------------------------
       //  Get datum connector pointer
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piPartCntr->GetDatumConnector(&piUKDatumCtr)) )
          cout << "Get datum connector succeeded" << endl;

       //----------------------------------------------------------------------
       //  Get connector number
       //----------------------------------------------------------------------
       if ( SUCCEEDED(piPartCntr->GetConnectorNumber(CtrNum)) )
          cout << "Connector number: " << CtrNum << endl;

       //----------------------------------------------------------------------
       //  Get connector position
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piPartCntr->GetPosition(NULL,Position)) )
          cout << "Get connector position succeeded" << endl;

       //----------------------------------------------------------------------
       //  Get connector alignment direction
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piPartCntr->GetAlignmentDirection(NULL,Direction)) )
          cout << "Get connector alignment direction succeeded" << endl;

       //----------------------------------------------------------------------
       //  Get connector up direction
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piPartCntr->GetUpDirection(NULL,Direction)) )
          cout << "Get connector up direction succeeded" << endl;

       //----------------------------------------------------------------------
       //  Get connector math plane
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piPartCntr->GetConnectorMathPlane(NULL,MathPlane)) )
          cout << "Get connector math plane succeeded" << endl;

       //----------------------------------------------------------------------
       //  Get connector face type
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piPartCntr->GetFaceType(FaceCntrType)) )
          cout << "Get connector face type succeeded" << endl;

       //----------------------------------------------------------------------
       //  Get connector alignment type
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piPartCntr->GetAlignType(AlignCntrType)) )
          cout << "Get connector alignment type succeeded" << endl;

       //----------------------------------------------------------------------
       //  Get connector clocking type
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piPartCntr->GetClockType(ClockCntrType)) )
          cout << "Get connector clocking type succeeded" << endl;

       //----------------------------------------------------------------------
       //  Get connector attribute names
       //---------------------------------------------------------------------- 
       if ( SUCCEEDED(piPartCntr->ListAttrNames(pAttrNameList))
            && NULL != pAttrNameList )
       {
          int iNum = pAttrNameList->Size();
          cout << "Number of connector attributes: " << iNum << endl;
          for ( int i = 1; i <= iNum; i++ )
          {
             CATUnicodeString AttrName = (*pAttrNameList)[i];
             cout << AttrName.ConvertToChar() << endl;
          }
       }

[Top]

Removing and Adding a Part Connector

The CATIPspPhysicalProduct interface is also used to remove a technological connector from a physical part and to add a technological connector to a part.

       //----------------------------------------------------------------------
       //  Remove part connector on physical object
       //----------------------------------------------------------------------   
       if ( SUCCEEDED(piPhysProd->RemoveConnector(CtrNum)) )
          cout << "Removed connector on part" << endl;

       //----------------------------------------------------------------------
       //  Add a new part connector to physical object
       //----------------------------------------------------------------------   
       if ( SUCCEEDED(piPhysProd->AddConnector(PartCtrType,
            CtrNum, piUKFaceCtr, FaceCntrType, piUKAlignCtr,
            AlignCntrType, piUKOrientCtr, ClockCntrType, &piPartCntr)) )
          cout << "Added a connector to part" << endl;

[Top]

Modifying Part Connector Data

The  CATIPspPartConnector interface pointer is used to modify the part connector data:

     //-------------------------------------------------------------------
     //  Set face connector pointer
     //------------------------------------------------------------------- 
     if ( SUCCEEDED(piPartCntr->SetFaceConnector(piUKFaceCtr,FaceCntrType)) )
          cout << "Set face connector succeeded" << endl;

     //-------------------------------------------------------------------
     //  Set alignment connector pointer
     //-------------------------------------------------------------------
     if ( SUCCEEDED(piPartCntr->SetAlignmentConnector(piUKAlignCtr,AlignCntrType)) )
          cout << "Set alignment connector succeeded" << endl;

     //-------------------------------------------------------------------
     //  Set orientation connector pointer
     //-------------------------------------------------------------------
     if ( SUCCEEDED(piPartCntr->SetOrientationConnector(piUKOrientCtr,ClockCntrType)) )
        cout << "Set orientation connector succeeded" << endl;

     //-------------------------------------------------------------------
     //  Set datum connector pointer
     //-------------------------------------------------------------------
     if ( (NULL != piUKDatumCtr) &&
	   SUCCEEDED(piPartCntr->SetDatumConnector(piUKDatumCtr)) )
        cout << "Set datum connector succeeded" << endl;

     //-------------------------------------------------------------------
     //  Set connector attribute names
     //-------------------------------------------------------------------
     if ( SUCCEEDED(piPartCntr->SetAttrNames(pAttrNameList)) )
        cout << "Set connector attribute names succeeded" << endl;

[Top]


In Short

This use case has demonstrated how to use the Psp interfaces to obtain and modify part technological connector information.  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.