Equipment & Systems Engineering

Electrical Harness Installation

Managing Protections on Bundle Segments

How to create and manage protections on bundle segments
Use Case

Abstract

This article discusses the CAAEhiCreateAndManageProtection use case. This use case explains how to create a protection on a bundle segment, and how to manage it.


What You Will Learn With This Use Case

This use case is intended to show you how to create protections on bundle segments, and how to manage them.

Following operations are detailed is this use case:

[Top]

The CAAEhiCreateAndManageProtection Use Case

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

[Top]

What Does CAAEhiCreateAndManageProtection Do

The goal of CAAEhiCreateAndManageProtection is to create a protection on a bundle segment, and to manage it.

[Top]

How to Launch CAAEhiCreateAndManageProtection?

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

The input documents can be found in:

InstallRootDirectory\OS\resources\graphic\CAA_EHIMultiBranchableSample 

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 CAAEhiCreateAndManageProtection Code?

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

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

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

[Top]

Step-by-Step

There are seven main logical steps in CAAEhiCreateAndManageProtection:

  1. Prolog
  2. Initializing Electrical Environment.
  3. Retrieving the Geometrical Bundle.
  4. Retrieving the bundle segments to protect.
  5. Adding a protection on the bundle segments.
  6. Managing the created protection
  7. Epilog.

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

[Top]

Prolog

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

After, the CATPart document containing the protection is loaded into the session. pProtDoc is a pointer to this document.

Then, the root product of the protection document is retrieved, piProtRootProduct is a pointer to this document.

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 .

 

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
   CATIEhiGeoBundle * piGeoBundle = NULL;
   if (NULL_var != (*pListGeoBundle)[1])
   {
       (*pListGeoBundle)[1]->QueryInterface(IID_CATIEhiGeoBundle,(void**) &piGeoBundle);
   }

...

piGeoBundle is the pointer on the geometrical bundle.

[Top]

Retrieving the bundle segments to protect.

 

First step consists in retrieving all the bundle segments under the geometrical bundle.

Seven bundle segments are retrieved under the geometrical bundle.

...

  CATListValCATBaseUnknown_var* pListBundleSegments=new CATLISTV(CATBaseUnknown_var);

  rc = piGeoBundle->ListBundleSegments(&pListBundleSegments);  
...

pListBundleSegments is a pointer on the list of bundle segments.

 

Second step consists in filling the list containing the bundle segments to protect.

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

...
  CATListValCATBaseUnknown_var* pListBnsToProtect = new CATLISTV(CATBaseUnknown_var);


  // we fill the stack
  pListBnsToProtect->Append((*pListBundleSegments)[1]);  
...

 

Adding a protection on the bundle segment.

To add a protection on the bundle segment, we use the method InstanciateProtection of CATIEhiGeoBundle interface :

...
   CATIEhiProtection * piProtection = NULL;
   double L1 = 0.1;
   double L2 = 0.8;
   rc = piGeoBundle->InstanciateProtection(piProtRootProduct,pListBnsToProtect,L1,L2,piProtection);
...

 

  in the sample, the protection reference is a CATPart and an instance of this CATPart is created every time the methode InstanciateProtection is used.

In fact, the reference of the protection  must be stored in a catalog and you have to instantiate a new part from this reference every time you want to create a protection from this reference . Methodology describing how to store CATParts in a catalog and how to retrieve them from it is documented in [3].

 

[Top]

Managing a protection on bundle segment.

To manage protections on bundle segment, you can use the methods of CATIEhiProtection interface . The code sample shows how to set the extremities of a protection :

...
   L1 = 0.1;
   L2 = 0.1;
   rc = piProtection->SetProtectionExtremities(L1,L2);  
...

 

Above is a CATIA image showing the protection (yellow) covering the bundle segment..

[Top]

Epilog

The main document  is saved at the end.

...
  CATUnicodeString oFileRoot(argv[3]);
  rc = CATDocumentServices::SaveAs (*pMainDoc , oFileRoot );

...

Document is removed and session is deleted before exit.

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

[Top]

 


In Short

This use case is has demonstrated how to create and manage protections 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
[3] Instantiating a component from a catalog
[Top]

History

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

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