Equipment & Systems |
Systems Layout |
Part SelectionHow to customize part selection |
Use Case |
AbstractThis article discusses the CAAECloPartSelection use case. |
This use case is intended to show you how to customize the part selection during part placement using the interface CATICloPartSelection. During part placement, one or more parts that can be placed are located in the part or the specification catalog. This list of the parts found are displayed on the part selection panel to allow designer to select one of the part to be placed. This interface can be implemented to provide additional processing to further select the suitable parts.
CAAECloPartSelection is a use case of the CAACommonLayoutItf.edu framework that illustrates the capabilities to provide custom code to select the desired parts to be available for user selection during part placement.
[Top]
The goal of CAAECloPartSelection is to show you how to use the interfaces CATICloPartSelection from CATCommonLayoutInterfaces framework.
To use CAAECloPartSelection , you will need to set up the build time environment, then compile CAAECloPartSelection along with its prerequisites, set up the run time environment, and then place a part.
[Top]
CAAECloPartSelection code is located in the CAACloPartSelection.m use case module of the CAACommonLayoutItf.edu framework:
Windows | InstallRootDirectory\CAACommonLayoutItf.edu\CAACloPartSelection.m\src\CAAECloPartSelection.cpp |
Unix | InstallRootDirectory/CAACommonLayoutItf.edu/CAACloPartSelection.m/src/CAAECloPartSelection.cpp |
The following contains the dictionary file that references the implementation:
Windows | InstallRootDirectory\CAACommonLayoutItf.edu\CNext\code\dictionary\CAACommonLayoutItf.edu.dico |
Unix | InstallRootDirectory/CAACommonLayoutItf.edu/CNext/code/dictionary/CAACommonLayoutItf.edu.dico |
where InstallRootDirectory
is the root directory of your CAA V5
installation.
[Top]
[Top]
The user will have to provide Implementation for CATICloPartSelection. The interface is called directly by the commands that create the part during part placement.
[Top]
Prints out the filtering parameter for information and allocates the output oListDescription.
//dump out all the filtering parameters unsigned int nFilterParameters = 0; if ( iLFilterParameters ) ((CATIUnknownList*)iLFilterParameters)->Count(&nFilterParameters); cout << "list of filter parameters:" << endl; for ( unsigned int n = 0; n < nFilterParameters; n++ ) { IUnknown* piUnknown = NULL; ((CATIUnknownList*)iLFilterParameters)->Item( n, &piUnknown ); if ( piUnknown ) { CATUnicodeString parmValue; CATICkeParm* piCkeParm = NULL; piUnknown->QueryInterface(IID_CATICkeParm,(void**)&piCkeParm); if ( piCkeParm ) { cout << (piCkeParm->Name()).ConvertToChar() << "=" << (piCkeParm->Show()).ConvertToChar() << endl; piCkeParm->Release(); piCkeParm = NULL; } piUnknown->Release(); piUnknown = NULL; } } |
Prints out the sorting parameters for information.
//dump out all the parameters used for sorting the order of the descriptions unsigned int nSortParameters = 0; if ( iLSortParameters ) ((CATIUnknownList*)iLSortParameters)->Count(&nSortParameters); cout << "list of sort parameters:" << endl; for ( n = 0; n < nSortParameters; n++ ) { IUnknown* piUnknown = NULL; ((CATIUnknownList*)iLSortParameters)->Item( n, &piUnknown ); if ( piUnknown ) { CATUnicodeString parmValue; CATICkeParm* piCkeParm = NULL; piUnknown->QueryInterface(IID_CATICkeParm,(void**)&piCkeParm); if ( piCkeParm ) { cout << (piCkeParm->Name()).ConvertToChar() << "=" << (piCkeParm->Show()).ConvertToChar() << endl; piCkeParm->Release(); piCkeParm = NULL; } piUnknown->Release(); piUnknown = NULL; } } |
For this example, if the description has a keyword "CenterToFace", select it only if the keyword has a value equal or greater than 3in (0.076meter.) All other cases, all descriptions in iListDescription are stored in oListDescription and returned to allow for user selection.
//checking the description selected unsigned int nDescriptions = 0; if ( iListDescription ) ((CATIUnknownList*)iListDescription)->Count(&nDescriptions); int selected = 0; cout << "list of descriptions:" << endl; for ( n = 0; n < nDescriptions; n++ ) { IUnknown* piUnknown = NULL; ((CATIUnknownList*)iListDescription)->Item( n, &piUnknown ); if ( piUnknown ) { CATUnicodeString parmValue; CATICatalogDescription* piDescription = NULL; piUnknown->QueryInterface(IID_CATICatalogDescription,(void**)&piDescription); if ( piDescription ) { CATUnicodeString descName; piDescription->GetName(descName); cout << descName.ConvertToChar() << endl; if ( iuPartType == "PipingNonReduceElbow" ) { //add code for filtering...use CenterToFace >= 3in only for example double oValue = 0.0; HRESULT rcode = piDescription->GetDouble ("CenterToFace", oValue); if ( SUCCEEDED(rcode) ) { if ( oValue >= 0.076 ) oListDescription->Add(selected++, piUnknown); } else //keyword "CenterToFace" not found, skip filtering oListDescription->Add(selected++, piUnknown); } else { oListDescription->Add(selected++, piUnknown); } piDescription->Release(); piDescription=NULL; } piUnknown->Release(); piUnknown = NULL; } } if ( selected > 0 ) RC = S_OK; else RC = E_FAIL; return RC; |
[Top]
[Top]
This use case has demonstrated how to the interfaces CATICloPartSelection from CATCommonLayoutInterfaces framework to perform part selection.
[Top]
Version: 1 [May 2004] | Document created |
[Top] |
Copyright © 2003, Dassault Systèmes. All rights reserved.