Equipment & Systems Engineering

Electrical Harness Installation

Analyzing a Protection

How to get geometrical definition of a protection
Use Case

Abstract

This article discusses the CAAEhiProtection use case. This use case explains how to navigate within an existing product structure, searching geometrical bundles, bundle segments, finding location of support linked on  bundle segment and how to get geometrical definition or location of protection linked a bundle segment.


What You Will Learn With This Use Case

This use case is intended to show you how to browse the content of a harness branch (geometrical bundles) and to get all bundle segment. For each bundle segment you can retrieve all linked support and for each support his distance with extremity of bundle segment. You can also retrieve all protection linked with bundle segment and for each protection his distance the distance of his extremity with extremity of bundle segment and you can so retrieve geometrical definition of protection.

Following operations are detailed is this use case:

[Top]

The CAAEhiProtection Use Case

CAAEhiProtection  is a use case of the CAAElecHarnessItf.edu framework that illustrates the ElecHarnessItf framework capabilities.

[Top]

What Does CAAEhiProtection Do

The goal of CAAEhiProtection  is to navigate within an product structure and to retrieve and analyze electrical content. The existing product structure is found under the pathname of the document passed as an argument to this program.

Above is a CATIA image of a product structure we will use as an example to browse electrical harness components.

[Top]

How to Launch CAAEhiProtection?

To launch CAAEhiProtection, you will need to set up the build time environment, then compile CAAEhiProtection.cpp along with its prerequisites, set up the run time environment, and then execute the sample. This is fully described in the referenced article [2].

To launch the use case, execute the following command:

mkrun -c "CAAEhiProtection input.CATProduct"

[Top]

Where to Find the CAAEhiProtection Code?

CAAEhiProtection code is located in the CAAEhiProtection.m use case module of the CAAElecHarnessItf.edu framework:

Windows InstallRootDirectory/CAAElecHarnessItf.edu/CAAEhiProtection.m
Unix InstallRootDirectory\CAAElecHarnessItf.edu\CAAEhiProtection.m

where InstallRootDirectory is the root directory of your CAA V5 installation. It is made of a unique source file named CAAEhiProtection.cpp.

[Top]

Step-by-Step

There are six logical steps in CAAEhiProtection:

  1. Prolog
  2. Initializing Electrical Environment
  3. Retrieving all Geometrical Bundle under Root Product and Selecting one to Analyze
  4. Retrieving all Bundle Segments under Selected Geometrical Bundle
  5. Retrieving extremities of each bundle segment.
  6. Retrieving the parent of bundle segment extremities
  7. Retrieving all Supports Linked to Bundle Segment
  8. Retrieving distance between  support and bundle segment extremity.
  9. Retrieving list of protection linked with bundle segment
  10. Retrieving distance between protection  extremity and  bundle segment extremity.
  11. Retrieving the Length of protection.
  12. Retrieving the geometric representation of the protection

  13. Retrieving the curve of protection

  14. Retrieving the list of bundle segment linked on protection

  15. Epilog.

We will now comment each of those sections by looking at the code.

[Top]

Prolog

Once the current session has been created, the CATProduct document can be loaded into the session . pDoc is a pointer to this document.

The root product of the document is retrieved . pRootProduct is a CATIProduct handle to the root product .

Methodology describing how to load a CATProduct document and how to retrieve the root product is described in [1].

[Top]

Initialize Electrical Environment

...
CATIEleDocServices * piElecDocServices = NULL;
  
  rc = pDoc->QueryInterface(IID_CATIEleDocServices,(void**) &piElecDocServices );
  if ( SUCCEEDED(rc) && piElecDocServices )
  {
    rc = piElecDocServices->Initialize();
  }

...

Initializing the electrical environment is mandatory to enable access to electrical object or electrical attributes.

[Top]

Retrieving all Geometrical Bundle under Root Product and Selecting one to Analyze

...
  CATListValCATBaseUnknown_var* pListGeoBundle = NULL;
  pListGeoBundle = piRootProduct->GetAllChildren(CATIEhiGeoBundle::ClassName());
  piRootProduct -> Release();
  piRootProduct = NULL ;
  
  int NumberOfGeoBundle = 0;
  if ( (NULL!=pListGeoBundle) && pListGeoBundle->Size() ) 
  {
    NumberOfGeoBundle = pListGeoBundle->Size();	

...

We use generic method CATIProduct::GetAllChildren to retrieve all geometric bundles under root product.

...
  CATIEhiGeoBundle * piGeoBundle = NULL;
  rc = (*pListGeoBundle)[NumberOfGeoBundle]->QueryInterface(IID_CATIEhiGeoBundle,(void**) &piGeoBundle);

...

Last element in list of geometric bundle is selected.

[Top]

Retrieving all Bundle Segments under Selected Geometrical Bundle.

...
  CATListValCATBaseUnknown_var* pListBundleSegment = NULL;
  rc = piGeoBundle->ListBundleSegments(&pListBundleSegment);

...

We use CATIEhiBundleSegment::ListBundleSegments to retrieve list of bundle segments under selected geometric bundle.

...
  CATIEhiBundleSegment * piBundleSegment = NULL;
  int TailleListBundleSegment = pListBundleSegment->Size() ;
  for(int rank =1 ; rank<=TailleListBundleSegment; rank++)
  {
    rc = (*pListBundleSegment)[rank]->QueryInterface(IID_CATIEhiBundleSegment,(void**) &piBundleSegment);
  ...

...

We selecting each bundle segment in list of bundle segments.

[Top]

Retrieving extremities of each bundle segment.

...
   CATIEhiBnlSegmentExtremity * pEhiFirstBnsExtremity = NULL;
   CATIEhiBnlSegmentExtremity * pEhiSecondBnsExtremity = NULL;

   rc = piBundleSegment -> GetExtremities ( &pEhiFirstBnsExtremity, &pEhiSecondBnsExtremity);

...

We get two extremities of bundle segment. This extremity adhere on CATIEhiBnlSegmentExtremity interface.

Retrieving the parent of bundle segment extremities

...
    CATIEhiBundleSegment * pEhiBundleSegment = NULL;
    rc = pEhiFirstBnsExtremity -> GetBundleSegment (pEhiBundleSegment);

...

We get the bundle segment of extremity.

[Top]

Retrieving all Supports Linked to Bundle Segment

...
CATListValCATBaseUnknown_var* pListInstanceSupport = NULL;
int numberOfSupport = 0;

rc = piBundleSegment->ListLinkedSupports(&pListInstanceSupport);

...

Method ListLinkedSupports is used to retrieve all support instances linked to bundle segment.

Retrieving distance between  support and bundle segment extremity.

...
CATIProduct* piInstanceProduct = NULL;
CATUnicodeString InstanceName = "unknown";
int i ;
for ( i =1; i<=numberOfSupport; i++ )
{
  (*pListInstanceSupport)[i]->QueryInterface(IID_CATIProduct,(void**) &piInstanceProduct);
  ...
  double LocationSupport_FirstExt = 0.0;
  rc = piBundleSegment->GetLocationSupport(pEhiFirstBnsExtremity, piInstanceProduct,LocationSupport_FirstExt);

...

For each support we find his distance with each bundle segment extremity of his linked bundle segment.

[Top]

Retrieving list of protection linked with bundle segment

...
   CATListValCATBaseUnknown_var * pListOfLinked_PROTECTION = NULL;
   int NumberOfProtection = 0;

   rc = piBundleSegment->ListLinkedProtections( & pListOfLinked_PROTECTION ) ;


...

We use ListLinkedProtection method of CATIEhiBundleSegement to get allm protection linked with bundle segment.

 

Retrieving distance between protection  extremity and  bundle segment extremity.

...
int j = 0;
CATIEhiProtection * pEhiProtection = NULL;

for(j = 1 ; j<=NumberOfProtection ; j++ )
{
  if(NULL_var != (*pListOfLinked_PROTECTION)[j]) 
  {
    rc = (*pListOfLinked_PROTECTION)[j] ->QueryInterface(IID_CATIEhiProtection,(void**) & pEhiProtection);
...
    if(pEhiProtection)
    {
       double LocationFirstExtremityOfProtection = 0.0;
       double LocationSecondExtremityOfProtection = 0.0;

      rc = pEhiProtection->GetLocationExtremities( pEhiFirstBnsExtremity ,
                                                   LocationFirstExtremityOfProtection ,
                                                   LocationSecondExtremityOfProtection);

...

For each protection linked with bundle segment we retrieve his distance between his extremities ant extremities of bundle segment.

 

[Top]

Retrieving the Length of protection.

...
 double Length_Protection = 0.0 ;

rc = pEhiProtection ->ComputeLength(Length_Protection);
...

We use ComputeLength() method of CATIEhiProtection interface to find the length of protection.

 

Retrieving the geometric representation of the protection

...
CATListValCATBaseUnknown_var * pListRepresentation = NULL;

rc = pEhiProtection -> GetRepresentation (&pListRepresentation );

...

We use GetRepresentation() method to find the geometrical representation of  a protection.

Retrieving the curve of protection

...
CATBaseUnknown * pCurve = NULL;

rc = pEhiProtection -> GetCurve (&pCurve );

...

We use GetCurve() method to find the curve of a protection.

 

[Top]

Retrieving the list of bundle segment linked on protection

...
CATListValCATBaseUnknown_var * pListLinkedBundleSegment = NULL;
int NumberOfLinkedBns = 0;

rc = pEhiProtection-> ListBundleSegments (pListLinkedBundleSegment);


...

We use ListBundleSegment() method to find the list of bundle segment linked on a protection.

[Top]

Epilog

...
rc = CATDocumentServices::Remove(*pDoc);
...
rc = ::Delete_Session(sessionName);
.

Opened documents are removed and session is deleted before exit.

[Top]

 


In Short

This use case is has demonstrated how to browse the content of a harness branch and to get geometrical definition of bundle segments contained in a geometrical bundle.

Following operations have been detailed is this use case :

[Top]


References

[1] Browsing a Product Structure
[2] Building and Launching a CAA V5 Use Case
[Top]

History

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

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