Equipment & Systems Engineering

Electrical Harness Installation

Managing Supports on Bundle Segments

How to create and manage supports on bundle segments
Use Case

Abstract

This article discusses the CAAEhiCreateAndManageSupport use case. This use case explains how to link a support with a bundle segment.


What You Will Learn With This Use Case

This use case is intended to show you how to link a support with a bundle segment.

Following operations are detailed is this use case:

[Top]

The CAAEhiCreateAndManageSupport Use Case

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

[Top]

What Does CAAEhiCreateAndManageSupport Do

The goal of CAAEhiCreateAndManageSupport is to link a support with a bundle segment.

[Top]

How to Launch CAAEhiCreateAndManageSupport?

To launch CAAEhiCreateAndManageSupport, you will need to set up the build time environment, then compile CAAEhiCreateAndManageSupport.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 "CAAEhiCreateAndManageSupport InPathDir OutPathDir Main"

The input documents can be found in:

InstallRootDirectory\OS\resources\graphic

where InstallRootDirectory is the root directory of your CAA V5 installation, and OS is a directory the name of which depends on the operating system. Refer to [2] to get the list of the currently supported operating systems and their associated directory names.

[Top]

Where to Find the CAAEhiCreateAndManageSupport Code?

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

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

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

[Top]

Step-by-Step

There are seven main logical steps in CAAEhiCreateAndManageSupport:

  1. Prolog
  2. Initializing Electrical Environment.
  3. Retrieving the geometrical bundle.
  4. Retrieving the bundle segment to link with the support.
  5. Retrieving the support to link with the bundle segment .
  6. Linking the support with the bundle segment.
  7. Epilog.

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

[Top]

Prolog

Once the current session has been created, the main CATProduct document is loaded into the session . pMainDoc is a pointer to this document.

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

Methodology describing how to create 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 objects or electrical attributes .

[Top]

Retrieving the Geometrical Bundle

Geometrical Bundle is retrieved using a query interface on CATIEhiGeoBundle on all the products. Only one geometrical bundle is retrieved in the document.

...
   CATListValCATBaseUnknown_var* pListProduct = NULL;
   pListProduct = piRootProduct->GetAllChildren(CATIProduct::ClassName());

   int NumberOfProduct = pListProduct?pListProduct->Size():0;
   CATListValCATBaseUnknown_var* pListGeoBundle=new CATLISTV(CATBaseUnknown_var);


   CATIEhiGeoBundle* piEhiGbn=NULL;

   for ( i =1; i<=NumberOfProduct; i++ )
   { 
     if (NULL_var != (*pListProduct)[i])
     {
        (*pListProduct)[i]->QueryInterface(IID_CATIEhiGeoBundle,(void**) &piEhiGbn);
        if ( NULL != piEhiGbn) 
        {
           CATBaseUnknown_var hUnk=piEhiGbn;

           if (NULL_var != hUnk) pListGeoBundle->Append(hUnk);
        }

     }

   }


   // we keep the geometrical bundle
   if (NULL_var != (*pListGeoBundle)[1])
   {
       (*pListGeoBundle)[1]->QueryInterface(IID_CATIEhiGeoBundle,(void**) &piEhiGbn);
   }

...

piEhiGbn is a pointer on the geometrical bundle.

[Top]

Retrieving the Bundle Segment to link with the support.

 

First step consists in retrieving all the multi branchable bundle segments  among all the products.

Seven bundle segments are retrieved under the geometrical bundle.

...

   CATListValCATBaseUnknown_var* pListMultiBns = new CATLISTV(CATBaseUnknown_var);

   CATIEhiMultiBranchable* pMultiBns=NULL;

   for ( i =1; i<=NumberOfProduct; i++ )
   { 
       if (NULL_var != (*pListProduct)[i])
       {
           (*pListProduct)[i]->QueryInterface(IID_CATIEhiMultiBranchable,(void**) &pMultiBns);
           if ( NULL != pMultiBns) 
           {
              CATBaseUnknown_var hUnk=pMultiBns;
              pListMultiBns->Append(hUnk);
           }
           if ( NULL != pMultiBns ) pMultiBns->Release(); 
           pMultiBns = NULL;

       }

   }
...

pListMultiBns is a pointer on the list of multi branchable bundle segments.

 

Second step consists in choosing the multi branchable bundle segment

We choose the fourth multi branchable bundle segment found in the previous list.

...
 
  CATIEhiMultiBranchable * piMultiBranchable4 = NULL; 


  if (NULL_var != (*pListMultiBns)[4]) 
  {
     (*pListMultiBns)[4]->QueryInterface(IID_CATIEhiMultiBranchable,(void**) &piMultiBranchable4); 
  }
...

 

Third step consists in listing the bundle segments of the multi branchable

We choose to protect only the first bundle segment found in the previous list.

...
 
   // --- Retrieving all bns under the multi branchable

   CATListValCATBaseUnknown_var* pListBns= NULL; 
   rc = piMultiBranchable4->ListBundleSegments(&pListBns);

   
   CATIEhiBundleSegment * piEhiBns = NULL; // the bundle segment chosen 

   if (NULL_var != (*pListBns)[1]) 
   {
     (*pListBns)[1]->QueryInterface(IID_CATIEhiBundleSegment,(void**) &piEhiBns); 
   }
...

 

piEhiBns is a pointer on the bundle segment to link with the support.

 

Above is a CATIA image showing the bundle segment to link with the support.

[Top]

Retrieving the support to link with the bundle segment

The support is the product which instance name is "Support-3"  :

...
   CATIProduct* piSupport = NULL;

   for ( i =1; i<=NumberOfProduct; i++ )
   { 
      if (NULL_var != (*pListProduct)[i])
      {
         (*pListProduct)[i]->QueryInterface(IID_CATIProduct,(void**) &piInstanceProduct);
          if ( NULL != piInstanceProduct ) 
          {
             piInstanceProduct->GetPrdInstanceName(InstanceName); 

             if (2 == InstanceName.Compare("Support-3"))
             {
                piSupport = piInstanceProduct; 
                piSupport->AddRef();
             }
          }
          if ( NULL != piInstanceProduct ) piInstanceProduct->Release(); 
          piInstanceProduct = NULL;

      }

   }

...

 

piSupport is a pointer on the support to link with the bundle segment.

 

 

Above is a CATIA image showing the support to link with the bundle segment.

.

[Top]

Linking the support with the bundle segment

First step consists in linking the support with the bundle segment .

We use the method AddSupport of CATIEhiBundleSegment interface :

...
   int num=1;

   rc = piEhiBns->AddSupport(piSupport,catEhiInvertMode,&num,catEhiInsertAfter);

...

Second step consists in computing the shape of the bundle segment .

...
    rc = piEhiGbn->ComputeMultiBranchable(piMultiBranchable4);
...

 

Above is a CATIA image showing the support linked to the bundle segment.

[Top]

Epilog

The four created documents are saved into directory defined as input. Name of file is the part number.

...
  // first bundle segment
  CATIProduct_var spMultiBranchableI = piMultiBranchable1;

  CATIProduct_var spMultiBranchableR = spMultiBranchableI->GetReferenceProduct();

  CATILinkableObject_var spLinkable=spMultiBranchableR;

  CATDocument * pMultiBns1PartDoc = spLinkable->GetDocument(); 
  rc = CATDocumentServices::SaveAs (*pMultiBns1PartDoc , PathOutput+MultiBns1File );
 
  // second bundle segment
  spMultiBranchableI = piMultiBranchable2;

  spMultiBranchableR = spMultiBranchableI->GetReferenceProduct();

  spLinkable=spMultiBranchableR;

  CATDocument * pMultiBns2PartDoc = spLinkable->GetDocument(); 

  rc = CATDocumentServices::SaveAs (*pMultiBns2PartDoc , PathOutput+MultiBns2File );
 
  // third bundle segment
  spMultiBranchableI = piMultiBranchable3;

  spMultiBranchableR = spMultiBranchableI->GetReferenceProduct();

  spLinkable=spMultiBranchableR;

  CATDocument * pMultiBns3PartDoc = spLinkable->GetDocument(); 

  rc = CATDocumentServices::SaveAs (*pMultiBns3PartDoc , PathOutput+MultiBns3File );
 
  // fourth bundle segment
  spMultiBranchableI = piMultiBranchable4;

  spMultiBranchableR = spMultiBranchableI->GetReferenceProduct();

  spLinkable=spMultiBranchableR;

  CATDocument * pMultiBns4PartDoc = spLinkable->GetDocument(); 

  rc = CATDocumentServices::SaveAs (*pMultiBns4PartDoc , PathOutput+MultiBns4File );
 
...

Geometrical bundle and main document are saved at the end.

...
 rc = CATDocumentServices::SaveAs (*pGbnDoc , PathOutput+GbnFile );
 rc = CATDocumentServices::SaveAs (*pMainDoc , PathOutput+MainFile );

...

Main document is removed and session is deleted before exit.

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

[Top]

 


In Short

This use case is has demonstrated how to add supports on bundle segments.

Following operations have been detailed is this use case :

[Top]


References

[1] Adding Components to a Product Structure
[2] Building and Launching a CAA V5 Use Case
[Top]

History

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

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