Machining |
NC Review |
Displaying Several Tool PathesManipulating a tool path |
| Use Case | ||
AbstractThis article discusses the CAAMfgTPEDisplayToolPathCommand use case. |
This use case is intended to help you manipulate the tool path structure. This involves the following:
[Top]
CAAMfgTPEDisplayToolPathCommand is a use case of the CAAToolPathEditorItf.edu framework that illustrates ToolPathEditor framework capabilities.
[Top]
CAAMfgTPEDisplayToolPathCommand runs with the document CAAMfgToolPath.CATPart shown on Fig.1.
![]() |
[Top]
To launch CAAMfgTPEDisplayToolPathCommand, you will need to:
# Decomment this line into file ToolPathEditor.edu.dico to run CAAMfgTPEAddToolBar Sample # CAAMfgTPEM3xAddin CATISmgProgramAddin libCAAMfgTPEAddToolBar
| Windows | InstallRootDirectory\CAADoc\CAAToolPathEditorItf.edu\CNext\resources\graphic |
| Unix | InstallRootDirectory/CAADoc/CAAToolPathEditorItf.edu/CNext/resources/graphic |
This displays the PPR document:


[Top]
The CAAMfgTPEDisplayToolPathCommand use case is made of a class named CAAMfgTPEDisplayToolPathCommand located in the CAAMfgTPEDisplayToolPathCommand.m module of the CAAToolPathEditorItf.edu framework:
| Windows | InstallRootDirectory\CAADoc\CAAToolPathEditorItf.edu\CAAMfgTPEDisplayToolPathCommand.m |
| Unix | InstallRootDirectory/CAADoc/CAAToolPathEditorItf.edu/CAAMfgTPEDisplayToolPathCommand.m |
where InstallRootDirectory is the directory where the CAA CD-ROM
is installed.
[Top]
There are three logical steps in CAAMfgTPEDisplayToolPathCommand:
We now comment each of those sections by looking at the code.
[Top]
The class that will implement the command is named CAAMfgTPEDisplayToolPathCommand. Create the CAAMfgTPEDisplayToolPathCommand class header file:
class ExportedByCAAMfgTPEDisplayToolPathCommand CAAMfgTPEDisplayToolPathCom : public CATStateCommand
{
public:
DeclareResource (CAAMfgTPEDisplayToolPathCom,CATStateCommand)
CAAMfgTPEDisplayToolPathCom (CATString* argument);
virtual ~CAAMfgTPEDisplayToolPathCom();
void BuildGraph();
void Valuate (const CATBaseUnknown_var& iValue);
private:
// to Create the rep of the tool path
void CreateController();
// Delete the rep of the tool path
void DeleteController();
// To update the rep of the tool path
void DispatchInfo();
// To Get the factory of tool pathes.
HRESULT GetToolPathFactory (CATIContainer_var& oContainer);
// To get the tool path
boolean GetSelection (void* data);
// To Terminate the command
boolean End (void* data);
CATIMfgToolPath_var _ToolPath;
CAT3DViewer* _Viewer;
CATPathElementAgent* _TPSelectionAgent;
CATDialogAgent* _TPEndAgent ;
CATPathElement* _ToolPahVisu;
IID* _iid;
CATVisManager* _VisuManager;
};
|
The CAAMfgTPEDisplayToolPathCommand class C++-derives from CATStateCommand.
The DeclareResource macro declares that the ressource file is CAAMfgTPEDisplayToolPathCommand.CATNls.
The class has a constructor, a destructor, a SplitToolPath method
to split the selected tool path, severals methods to manage the user's
interaction and the rep of the tool path, and a copy constructor.
[Top]
First you have to implement the method BuilGraph, which will provide you with capturing the user's interactions.
void CAAMfgTPEDisplayToolPathCom::BuildGraph()
{
_TPSelectionAgent = new CATPathElementAgent("ToolPathSelection");
if (NULL != _TPSelectionAgent) {
_TPSelectionAgent->SetOrderedElementType(CATIMfgCompoundTraject::ClassName());
_TPSelectionAgent->AddOrderedElementType(CATIMfgActivity::ClassName());
_TPSelectionAgent->SetBehavior(CATDlgEngWithPrevaluation|CATDlgEngWithCSO|CATDlgEngMultiAcquisition);
AddCSOClient(_TPSelectionAgent);
}
if ( _TPEndAgent == NULL ) {
_TPEndAgent = new CATDialogAgent("End");
if (NULL != _TPEndAgent)
_TPEndAgent->AcceptOnNotify(NULL, CATEdit::ClassName());
}
CATDialogState* firstState = GetInitialState("TPESelectToolPath");
if (NULL != firstState) firstState->AddDialogAgent(_TPSelectionAgent);
CATDialogState* secondState = AddDialogState("TPEEndCommand");
if (NULL != secondState)
secondState->AddDialogAgent(_TPEndAgent);
CATDialogTransition * firstTransition =
AddTransition (firstState, secondState,
IsOutputSetCondition(_TPSelectionAgent),
Action((ActionMethod) &CAAMfgTPEDisplayToolPathCom::GetSelection));
AddTransition (secondState, NULL,
IsOutputSetCondition(_TPEndAgent),
Action((ActionMethod) &CAAMfgTPEDisplayToolPathCom::End));
}
|
[Top]
Now the method GetSelection is implemented. It gets the selected tool path.
boolean CAAMfgTPEDisplayToolPathCom::GetSelection (void* data)
{
CATBoolean RESULT = CATFalse;
CATSO* selectedObjects = NULL;
if (NULL != _TPSelectionAgent)
selectedObjects = _TPSelectionAgent->GetListOfValues();
if ( selectedObjects ) {
int NbPath = selectedObjects->GetSize();
if ( NbPath > 0 ) {
RESULT = CATTrue;
if (NULL_var == _ToolPath ) {
CATIContainer_var spContainer = NULL_var;
GetToolPathFactory (spContainer);
if (NULL_var != spContainer) {
CATIMfgToolPathFactory_var spTPFactory = spContainer;
_ToolPath = spTPFactory->CreateMfgCompoundTraject ();
}
}
CATIMfgToolPathComponents_var itfComponents (_ToolPath);
if ( !!_ToolPath && !!itfComponents ) {
CATPathElement* ptrCurrentElement=NULL;
CATIMfgCompoundTraject* ptrCTraject=NULL;
CATIMfgCompoundTraject_var itfCmpTraject;
CATIMfgActivity* ptrActivity=NULL;
CATIMfgActivity_var itfActivity;
for ( int ind=0; ind < NbPath ; ind++) {
ptrCurrentElement = (CATPathElement*) (*selectedObjects)[ind];
if (NULL != ptrCurrentElement) {
ptrCTraject = (CATIMfgCompoundTraject *) (ptrCurrentElement->FindElement(CATIMfgCompoundTraject::ClassId()));
itfCmpTraject = ptrCTraject;
if (!! itfCmpTraject ) {
// A Compound traject is selected.
ptrCTraject->Release();
itfComponents->AddElement(itfCmpTraject,0);
ptrCTraject=NULL;
}
else {
// An activity is selected.
// We add all her tool pathes.
ptrActivity = (CATIMfgActivity *) (ptrCurrentElement->FindElement(CATIMfgActivity::ClassId()));
itfActivity = ptrActivity;
if (!!itfActivity ) {
ptrActivity->Release();
CATIMfgToolPathManagement_var itfManagement = itfActivity;
CATIMfgToolPath_var ToolPath(NULL_var);
if (!!itfManagement)
HRESULT RC = itfManagement->GetToolPath(ToolPath);
itfComponents->AddElement(ToolPath,0);
ptrActivity=NULL;
}
}
ptrCurrentElement=NULL;
}
}
// Display the tool path.
CreateController();
DispatchInfo();
}
}
}
return RESULT;
}
|
First, we verify that the selected object is a tool path object, then we display it ( call to methods CreateController to create the image then a call to method DispatchInfo to display it in the 3d viewer.
[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 © 2000, Dassault Systèmes. All rights reserved.