Machining |
NC Review |
Changing Command Headers in the Tool Path EditorCreate your own menu of tool path in the tool path editor |
Use Case |
AbstractThis article discusses the CAAMfgTPEUserCommandHeaders use case. |
This use case is intended to help you create your own contextual menu for tool path.
[Top]
CAAMfgTPEUserCommandHeaders is a use case of the CAAToolPathEditorItf.edu framework that illustrates ToolPathEditorInterfaces framework capabilities.
[Top]
CAAMfgTPEUserCommandHeaders builds and customize the contextual menu of tool path as shown on Fig.1.
![]() |
[Top]
To launch CAAMfgTPEUserCommandHeaders, you will need to:
# Decomment this line into file ToolPathEditor.edu.dico to run CAAMfgTPEAddToolBar Sample # CAAMfgTPEM3xAddin CATISmgProgramAddin libCAAMfgTPEAddToolBar # Decomment these lines into file ToolPathEditor.edu.dico to run CAAMfgTPEUserCommandHeaders Sample # MfgCompoundTraject CATIMfgToolPathEditorUserHeader libCAAMfgTPEUserCommandHeaders # MfgTPMultipleMotion CATIMfgToolPathEditorUserHeader libCAAMfgTPEUserCommandHeaders |
Set up the run time environment:
Windows | InstallRootDirectory\CAADoc\CAAToolPathEditorItf.edu\CNext\resources\graphic |
Unix | InstallRootDirectory/CAADoc/CAAToolPathEditorItf.edu/CNext/resources/graphic |
This displays the PPR document:
[Top]
The CAAMfgTPEUserCommandHeaders use case is made of a class named CAAMfgTPEUserCommandHeaders located in the CAAMfgTPEUserCommandHeaders.m module of the CAAToolPathEditorItf.edu framework:
Windows | InstallRootDirectory\CAADoc\CAAToolPathEditorItf.edu\CAAMfgTPEUserCommandHeaders.m |
Unix | InstallRootDirectory/CAADoc/CAAToolPathEditorItf.edu/CAAMfgTPEUserCommandHeaders.m |
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
[Top]
There is one logical steps in CAAMfgTPEDisplayToolPathCommand:
We now comment these section by looking at the code.
[Top]
The class that will implement the command is named CAAMfgTPEUserCommandHeaders. Create the CAAMfgTPEUserCommandHeaders class header file:
class ExportedByCAAMfgTPEUserCommandHeadersEnv CAAMfgTPEUserCommandHeaders : public CATBaseUnknown { CATDeclareClass; public: CAAMfgTPEUserCommandHeaders(); virtual ~CAAMfgTPEUserCommandHeaders(); //Give the list of headers of command in the tool path editor. virtual HRESULT GetHeaders( CATListValCATString &ioHeadersList ); //Say if the header of command is available for a given set of object virtual HRESULT IsHeadersAvailable( CATListValCATString& ioHeadersList , CATCSO* iCSO ); private : // The copy constructor and the equal operator must not be implemented // ------------------------------------------------------------------- CAAMfgTPEUserCommandHeaders (CAAMfgTPEUserCommandHeaders &); CAAMfgTPEUserCommandHeaders& operator=(CAAMfgTPEUserCommandHeaders&); // ------------------ // HeaderAvailability // ------------------ void HeaderAvailability(const CATString& HeaderName, CATBoolean isON); }; |
The CAAMfgTPEUserCommandHeaders class C++-derives from CATBaseUnknown. The class has a constructor, a destructor, and the two methods of the interface CATIMfgToolPathUserHeaders.
First you have to implement the method GetHeaders, which will provide you with getting the standard headers and to give the application yours own headers of command.
HRESULT CAAMfgTPEUserCommandHeaders::GetHeaders( CATListValCATString &ioHeadersList) { HRESULT hRes= S_OK; // Default list of Headers of command in the Tool path Editor. // Each empty string is displayed as a separator in the menu. // TPEPointModification // TPEAreaModification // "" // TPETranslate // TPERotate // TPEMirror // "" // TPEReverse // TPEConnect // TPEApproachRetract // "" // TPEToolLength CATIMfgToolPathEditorHeader_var spTPEHeaders = GetImpl(); if (!!spTPEHeaders) spTPEHeaders->GetHeaders(ioHeadersList); int index=8; ioHeadersList.InsertBefore(index,CATString("TPESplitToolPath")); index=1; ioHeadersList.Replace ( index, CATString("TPEDisplayToolPath")); // User's list of Headers of command. ioHeadersList.Append(CATString("TPEDisplayDistance")); return hRes; } |
First, we get the standard headers of the tool path editor ( if there are used ) by a call to the method GetHeaders of interface CATIMfgToolPathEditorHeader. (Note that an empty string in the list is equivalent to a separator.) Then we customize this list replacing, suppressing or adding command headers.
Now we implement the method IsHeadersAvailable.
HRESULT CAAMfgTPEUserCommandHeaders::IsHeadersAvailable( CATListValCATString& ioHeadersList , CATCSO* iCSO ) { HRESULT hRes= S_OK; if (NULL == iCSO) return E_FAIL; int nbSelectedItems = iCSO->GetSize(); // if several objects are selected, the contextual menu isn't the same. // Two items are disabled if ( nbSelectedItems > 1 ) { // Get the CATIMfgToolPathEditorHeader interface CATIMfgToolPathEditorHeader_var spTPEHeaders = GetImpl(); if (!!spTPEHeaders) spTPEHeaders->IsHeadersAvailable(ioHeadersList,iCSO); HeaderAvailability(CATString("TPESplitToolPath"), CATFalse); } return hRes; } |
First, we call the method IsHeadersAvailable
of interface
CATIMfgToolPathEditorHeader, if we have any standard command header of the tool
path editor.
Then we can activate or deactivate our own headers. For example, if a command doesn't work for a multiple selection of tool path, it should be deactivated
[Top]
[Top]
[1] | Building and Launching a CAA V5 Use Case |
[2] | Dump of Tool Path Content Command |
[Top] |
Version: 1 [March 2002] | Document created |
[Top] |
Copyright © 2002, Dassault Systèmes. All rights reserved.