Equipment & Systems Engineering |
Electrical Harness Flattening |
Flattening a harnessHow to flatten a harness |
| Use Case | ||
AbstractThis article discusses the ElecFlatteningItf use case. This use case explains how to flatten a harness |
This use case is intended to help you make your first steps in programming with CATIA EHF Interfaces. Its main intent is to allow you to flatten a harness.
[Top]
CAAEhfFlattenManager.m is a use case of the CAAElecFlatteningItf.edu framework that illustrates the CATIA EHF Interfaces framework capabilities.
[Top]
The goal of CAAEhfFlattenManager use case is to show how to flatten a harness.
[Top]
To launch the use case, execute the following command:
mkrun -c "CAAEhfFlattenManager input.CATProduct"
Under Windows, the path would indicate:
'WS'\intel_a\resources\graphic\ModelFlattenManager directory.
[Top]
The CAAEhfFlattenManager sample is made of a single class named CAAEhfFlattenManager located in the CAAEhfFlattenManager.m module of the CAAElecFlatteningItf.edu framework:
| Windows | InstallRootDirectory\CAAElecFlatteningItf.edu\CAAEhfFlattenManager.m\ |
| Unix | InstallRootDirectory/CAAElecFlatteningItf.edu/CAAEhfFlattenManager.m/ |
where InstallRootDirectory is the directory where the CAA CD-ROM
is installed.
This sample deals with the following classes:
| CATSession | Class for the session base class |
| CATDocument | Class for the document base class |
| CATDocumentServices | Class for managing document in the session |
| CATIDocRoots | Class for browsing root object in document |
| CATIProduct | Interface dedicated to define product behaviour |
| CATIEleDocServices | Interface dedicated electrical environment initialization |
| CATIEhfEnvironment | Interfaces dedicated to retrieve the flattening parameter |
| CATIEhfFlatteningParameters | Interfaces dedicated to read attribute on flattening parameter |
| CATMathPlane | Class representing a mathematical plane in 3D |
[Top]
------------------------------------------
We will now first comment the Electrical environment and it’s components creation by looking at the code of the Main . There are 8 logical steps in Main :
[Top]
...
if ( 2 > argc )
{
retCode = 1;
goto EscapeWay;
}
...
|
[Top]
We need a CATSession pointer to create the Session.
... pSession = CATSession::Create_Session(sessionIdent); ... |
We need a CATDocument pointer to opening the document.
... CATDocumentServices::Open(argv[1], pDoc, cusInType); ... |
Once the current session has been created, the CATProduct document can be loaded into the session . pDoc is a pointer to this document.
We need a CATProduct pointer to retrieving the root product.
....
hr = pDoc->QueryInterface(IID_CATIDocRoots, (void**)(&pIDocRootsOnDoc));
if(FAILED(hr))
{
retCode = 4;
goto EscapeWay;
}
// Get the root product which is the first element of root elements
pListUnkRootProducts = pIDocRootsOnDoc->GiveDocRoots();
if(NULL == pListUnkRootProducts)
{
retCode = 5;
goto EscapeWay;
}
nProducts = pListUnkRootProducts->Size();
if( 0 == nProducts)
{
retCode = 6;
goto EscapeWay;
}
hUnkRootProd = (*pListUnkRootProducts)[1];
if(NULL_var == hUnkRootProd)
{
retCode = 7;
goto EscapeWay;
}
hr = hUnkRootProd->QueryInterface(IID_CATIProduct, (void**)(&pIRootProduct));
if(FAILED(hr))
{
retCode = 8;
goto EscapeWay;
}
.... |
[Top]
We initialize the Document by using CATIEleDocServices interface pointer and the method Initialize() on it.
....
// Initialise Electrical Environment
hr = pDoc->QueryInterface(IID_CATIEleDocServices,(void**)&pIEleDocServices );
if ( FAILED(hr) )
{
retCode = 9;
goto EscapeWay;
}
hr = pIEleDocServices->Initialize();
if ( FAILED(hr) )
{
retCode = 10;
goto EscapeWay;
}
.... |
Initializing the electrical environment is mandatory to enable access to electrical object or electrical attributes.
....
hr = pIRootProduct->QueryInterface(IID_CATIEhfEnvironment,(void**)&pIEhfEnvironment);
if ( FAILED(hr) )
{
retCode = 11;
goto EscapeWay;
}
hr = pIEhfEnvironment->GetFlatteningParameters(&phListFlatteningPara);
if ( ( FAILED(hr) ) || ( NULL == phListFlatteningPara ) )
{
retCode = 12;
goto EscapeWay;
}
nbFlatteningPara = phListFlatteningPara->Size();
if (0 >= nbFlatteningPara)
{
retCode = 13;
goto EscapeWay;
}
hUnkFlatteningPara = (*phListFlatteningPara)[1];
if (NULL_var == hUnkFlatteningPara)
{
retCode = 14;
goto EscapeWay;
}
hr = hUnkFlatteningPara->QueryInterface(IID_CATIEhfFlatteningParameters, (void **)&pIFlatteningPara);
if ( FAILED(hr) )
{
retCode = 15;
goto EscapeWay;
} .... |
....
phUnkListChildren = pIRootProduct->GetAllChildren("CATIEhiGeoBundle");
if( NULL == phUnkListChildren )
{
retCode = 16;
goto EscapeWay;
}
numGBN = phUnkListChildren->Size();
if( 0 >= numGBN )
{
retCode = 17;
goto EscapeWay;
}
hUnkListElem = (*phUnkListChildren)[1] ;
if( NULL_var == hUnkListElem )
{
retCode = 18;
goto EscapeWay;
}
hr = hUnkListElem->QueryInterface(IID_CATBaseUnknown, (void**)&pIUnkGBN) ;
if( FAILED(hr) )
{
retCode = 19;
goto EscapeWay;
}
ListOfGBNs.Append(pIUnkGBN) ;
.... |
[Top]
... hr = pIRootProduct->QueryInterface(IID_CATIEhfFlattenManager,(void**)&pIFlatten);
if ( FAILED(hr) )
{
retCode = 20;
goto EscapeWay;
}
hr = pIFlatten->FlattenHarness( &ListOfGBNs );
if (FAILED( hr))
{
retCode = 21;
goto EscapeWay;
}
...
|
[Top]
Removing document from session and closing the session.
... CATDocumentServices::Remove (*pDoc) ;
if ( NULL != pSession )
{
pSession->Delete_Session(sessionIdent);
}
|
This use case has demonstrated the way to flatten a harness.
[Top]
| [Top] |
| Version: 2 [January 2007] | Document updated |
| [Top] | |
Copyright © 2007, Dassault Systèmes. All rights reserved.