Equipment & Systems Engineering |
Electrical Harness Installation |
Analyzing a ProtectionHow to get geometrical definition of a protection |
Use Case |
AbstractThis 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. |
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]
CAAEhiProtection is a use case of the CAAElecHarnessItf.edu framework that illustrates the ElecHarnessItf framework capabilities.
[Top]
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]
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"
InstallRootDirectory\OS\resources\graphic\CAAEhiProtectionSample
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]
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]
There are six logical steps in CAAEhiProtection:
We will now comment each of those sections by looking at the code.
[Top]
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]
... 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]
... 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]
... 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]
... CATIEhiBnlSegmentExtremity * pEhiFirstBnsExtremity = NULL; CATIEhiBnlSegmentExtremity * pEhiSecondBnsExtremity = NULL; rc = piBundleSegment -> GetExtremities ( &pEhiFirstBnsExtremity, &pEhiSecondBnsExtremity); ... |
We get two extremities of bundle segment. This extremity adhere on CATIEhiBnlSegmentExtremity interface.
... CATIEhiBundleSegment * pEhiBundleSegment = NULL; rc = pEhiFirstBnsExtremity -> GetBundleSegment (pEhiBundleSegment); ... |
We get the bundle segment of extremity.
[Top]
... CATListValCATBaseUnknown_var* pListInstanceSupport = NULL; int numberOfSupport = 0; rc = piBundleSegment->ListLinkedSupports(&pListInstanceSupport); ... |
Method ListLinkedSupports is used to retrieve all support instances linked to bundle segment.
... 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]
... 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.
... 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]
... double Length_Protection = 0.0 ; rc = pEhiProtection ->ComputeLength(Length_Protection); ... |
We use ComputeLength() method of CATIEhiProtection interface to find the length of protection.
... CATListValCATBaseUnknown_var * pListRepresentation = NULL; rc = pEhiProtection -> GetRepresentation (&pListRepresentation ); ... |
We use GetRepresentation() method to find the geometrical representation of a protection.
... CATBaseUnknown * pCurve = NULL; rc = pEhiProtection -> GetCurve (&pCurve ); ... |
We use GetCurve() method to find the curve of a protection.
[Top]
... 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]
... rc = CATDocumentServices::Remove(*pDoc); ... rc = ::Delete_Session(sessionName); . |
Opened documents are removed and session is deleted before exit.
[Top]
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 :
Initialize
method
of CATIEleDocServices.GetAllChildren
method of CATIProductListBundleSegments
of CATIEhiBundleSegmentListLinkedSupports
of CATIEhiBundleSegment.[Top]
[1] | Browsing a Product Structure |
[2] | Building and Launching a CAA V5 Use Case |
[Top] |
Version: 1 [Feb 2004] | Document created |
[Top] |
Copyright © 2001, Dassault Systèmes. All rights reserved.