Equipment & Systems Engineering

Electrical Harness Installation

Analyzing a Harness Branch

How to get geometrical definition of a harness branch
Use Case

Abstract

This article discusses the CAAEhiGeoBundle use case. This use case explains how to navigate within an existing product structure, searching geometrical bundles and bundle segments, and how to get geometrical definition of 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 geometrical definition of bundle segments.

Following operations are detailed is this use case:

[Top]

The CAAEhiGeoBundle Use Case

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

[Top]

What Does CAAEhiGeoBundle Do

The goal of CAAEhiGeoBundle is to navigate within an product structure and to retrieve and analyze geometrical bundle 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 CAAEhiGeoBundle?

To launch CAAEhiGeoBundle, you will need to set up the build time environment, then compile CAAEhiGeoBundle.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 "CAAEhiGeoBundle input.CATProduct"

[Top]

Where to Find the CAAEhiGeoBundle Code?

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

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

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

[Top]

Step-by-Step

There are six logical steps in CAAEhiGeoBundle:

  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 and Selecting one to Analyze
  5. Retrieving Electrical Curve ( Bundle Segment Route )
  6. Retrieving all Supports Linked to Bundle Segment
  7. Retrieving Electrical Attributes of Bundle Segment
  8. 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 and Selecting one to Analyze

...
  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 rank = 1;
  rc = (*pListBundleSegment)[rank]->QueryInterface(IID_CATIEhiBundleSegment,(void**) &piBundleSegment);

...

We select first element in list of bundle segments.

[Top]

Retrieving Electrical Curve ( Bundle Segment Route )

...
  CATIGSMSpline * piSpline = NULL;
  //
  rc = piBundleSegment->GetElecCurve(&piSpline);

...

We get flexible curve linked to bundle segment . This curve may be manipulated using CATIGSMSpline interface.

[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.

...
  CATListValCATBaseUnknown_var* pListReferenceSupport = new CATLISTV(CATBaseUnknown_var);
  
  ...
  
  // --- compute list of support references 
  cout << "   get list of reference  "<< endl << flush;
  int numberOfReference = 0;
  for ( i=1; i<=numberOfSupport; i++ )
  {
    (*pListInstanceSupport)[i]->QueryInterface(IID_CATIProduct,(void**) &piInstanceProduct);
    if ( NULL !=  piInstanceProduct )
    {
      CATIProduct_var spReferenceProduct = piInstanceProduct->GetReferenceProduct();
      if ( NULL_var !=  spReferenceProduct ) pListReferenceSupport->Append(spReferenceProduct);

...

Second part illustrates the way to retrieve support references from list of support instances.

[Top]

Retrieving Electrical Attributes of Bundle Segment

...
  CATIElecAttrAccess * piElecAttribute = NULL;
  piBundleSegment->QueryInterface(IID_CATIElecAttrAccess,(void**) &piElecAttribute);
   
  ...
  // -- list attributes on object
  cout << "   get list of attributes of bundle segment "<< endl << flush;
  CATListValCATUnicodeString* pAttNameList = NULL; 
  //
  rc = piElecAttribute->ListAttributeNames ( pAttNameList );

...

We use CATIElecAttrAccess to get electrical attributes of bundle segment. Using method ListAttributeNames , we first get all attributes of bundle segment .

...
CATUnicodeString AttributeToRead = "Elec_LengthOUT";
  double  bns_length = 0.;
  CATICkeInst_var spCKEvalue ;
  cout << "   get length of bundle segment ( MKSA unit system ) "<<endl << flush;
  cout << "       . get value (MKSA) of attribute "<< AttributeToRead.ConvertToChar() <<endl << flush;
  rc = piElecAttribute->Get(AttributeToRead,spCKEvalue);
  if ( SUCCEEDED(rc) )
  {
    if ( NULL_var != spCKEvalue ) bns_length = spCKEvalue->AsReal();

...

Second part illustrates method to get attribute values using CATIElecAttrAccess::GetValue . Each attribute value is returned as a CATICkeInst interface smart pointer.[3]

Real attribute values may be read using AsType method of CATICkeInst interface where Type may be Integer,Real,Boolean,String depending of type of attribute. All values are given in MKSA unit system [4] .

[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
[3] Using Persistent Parameters
[4] About Units
[Top]

History

Version: 1 [Jul 2001] Document created
[Top]

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