Machining |
NC Review |
Customizing Tool Path Display in "Tool Path Replay" CommandImplementing the CATIMfgReplayToolPathCustom interface |
Use Case |
AbstractThis article discusses the CAAMaiReplayToolPathCustomization use case and explains how to implement the CATIMfgReplayToolPathCustom manufacturing interface. |
This use case is intended to help you customize the display of the tool path in the "tool path replay", by adding to the standard display your own graphic representation.
To customize the display of tool path, you will have to implement the CATIMfgReplayToolPathCustom manufacturing interface.
This involves to create an extension class to implement CATIMfgReplayToolPathCustom interface on the MfgTPMultipleMotion object which is the object describing the tool path.
[Top]
CAAMaiReplayToolPathCustomization is a use case of the CAAManufacturingItf.edu framework that illustrates ManufacturingInterfaces framework capabilities.
[Top]
CAAMaiReplayToolPathCustomization runs with the Process document shown on figure below that contains a "Facing" operation.
With this use case, tool tip points of the tool path are graphically represented by a set of square points when submitting "tool path replay" command.
[Top]
To launch CAAMaiReplayToolPathCustomization, you will need to:
Windows | InstallRootDirectory\CAADoc\CAAManufacturingItf.edu\CNext\code\dictionary\ |
Unix | InstallRootDirectory/CAADoc/CAAManufacturingItf.edu/CNext/code/dictionary/ |
where InstallRootDirectory
is the directory where the CAA
CD-ROM is installed, and decomment the following line by removing the '#'
character:
MfgTPMultipleMotion CATIMfgReplayToolPathCustom libCAAMaiReplayToolPathCustomization
Windows | InstallRootDirectory\CAADoc\CAAManufacturingItf.edu\CNext\resources\graphic\ |
Unix | InstallRootDirectory/CAADoc/CAAManufacturingItf.edu/CNext/resources/graphic/ |
[Top]
The CAAMaiReplayToolPathCustomization use case is made of a class named CAAEMaiReplayToolPathCustomization. located in the CAAMaiReplayToolPathCustomization.m module of the CAAManufacturingItf.edu framework:
Windows | InstallRootDirectory\CAADoc\CAAManufacturingItf.edu\CAAMaiReplayToolPathCustomization.m |
Unix | InstallRootDirectory/CAADoc/CAAManufacturingItf.edu/CAAMaiReplayToolPathCustomization.m |
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
[Top]
There are two logical steps in CAAMaiReplayToolPathCustomization:
We now comment each of those sections by looking at the code.
[Top]
The extension class that will implement CATIMfgReplayToolPathCustom is named CAAEMaiReplayToolPathCustomization.
Creating this class is done in three sub steps:
#ifndef CAAEMaiReplayToolPathCustomization_h #define CAAEMaiReplayToolPathCustomization_h // COPYRIGHT DASSAULT SYSTEMES 2002 //=========================================================================== // Abstract of the sample: // ----------------------- // // Implementation of CATIMfgReplayToolPathCustom. // //=========================================================================== // Abstract of the class: // ---------------------- // // Data extension of the "MfgTPMultipleMotion" Late Type. // //=========================================================================== // Usage: // ------ // // Launch CATIA V5, Create a "Facing" operation inside Prismatic // Machining Programmer, then replay it. // //=========================================================================== // Inheritance: // ------------ // // CATBaseUnknown (System Framework) // //=========================================================================== // Main Method: // ------------ // // CustomizeToolPathRep // //=========================================================================== // Infrastructure interfaces #include "CATBaseUnknown.h" // Visualization classes class CATRep; class CAAEMaiReplayToolPathCustomization : public CATBaseUnknown { // Used in conjonction with CATImplementClass in the .cpp file CATDeclareClass; public: CAAEMaiReplayToolPathCustomization(); virtual ~CAAEMaiReplayToolPathCustomization(); // CustomizeToolPathRep //===================== // Creates a graphic representation for the "MfgTPMultipleMotion" object // to add to the standard graphic representation in the "Tool Path Replay" // command. // // iOperation : Current machining operation // iStartPoint : First point of the "MfgTPMultipleMotion" object to take // into account // iEndPoint : Last point of the "MfgTPMultipleMotion" object to take // into account CATRep* CustomizeToolPathRep (const CATBaseUnknown_var& iOperation,int iStartPoint,int iEndPoint); private: // Copy constructor, not implemented // Set as private to prevent from compiler automatic creation as public. CAAEMaiReplayToolPathCustomization (const CAAEMaiReplayToolPathCustomization &iObjectToCopy); // Assignment operator, not implemented // Set as private to prevent from compiler automatic creation as public. CAAEMaiReplayToolPathCustomization & operator = (const CAAEMaiReplayToolPathCustomization &iObjectToCopy); }; #endif |
The CAAEMaiReplayToolPathCustomization class C++-derives from CATBaseUnknown.
The CATDeclareClass
macro declares that the class CAAEMaiReplayToolPathCustomization
belongs to a component. The class has a constructor, a destructor, and the CustomizeToolPathRep
method of CATIMfgReplayToolPathCustom.
... #include "TIE_CATIMfgReplayToolPathCustom.h" TIE_CATIMfgReplayToolPathCustom(CAAEMaiReplayToolPathCustomization); CATImplementClass (CAAEMaiReplayToolPathCustomization, DataExtension, CATBaseUnknown, MfgTPMultipleMotion); ... //----------------------------------------------------------------------------- // CustomizeToolPathRep //----------------------------------------------------------------------------- CATRep* CAAEMaiReplayToolPathCustomization::CustomizeToolPathRep (const CATBaseUnknown_var& iOperation,int iStartPoint,int iEndPoint) { ... |
The CAAEMaiReplayToolPathCustomization class states that it
implements the CATIMfgReplayToolPathCustom interface thanks to the TIE_CATIMfgReplayToolPathCustom
macro. The CATImplementClass
macro declares that the CAAEMaiReplayToolPathCustomization
class is data extension class, thanks to the DataExtension
keyword, and that it extends the tool path object whose type is MfgTPMultipleMotion.
The third parameter must always be set to CATBaseUnknown, makes no
sense, and is unused for extensions.
Update the interface dictionary, that is a file named, for example in this case, CAAManufacturingItf.edu.dico, whose directory's pathname is concatenated at run time in the CATDictionaryPath environment variable, and containing the following declaration to state that the MfgTPMultipleMotion feature implements the CATIMfgReplayToolPathCustom interface, and whose code is located in the libCAAMaiReplayToolPathCustomization shared library or DLL. Pay attention to remove the comment (#) in the supplied dictionary.
MfgTPMultipleMotion CATIMfgReplayToolPathCustom libCAAMaiReplayToolPathCustomization
The CAAManufacturingItf.edu.dico file is located in:
Windows | InstallRootDirectory\CAADoc\CAAManufacturingItf.edu\CNext\code\dictionary\ |
Unix | InstallRootDirectory/CAADoc/CAAManufacturingItf.edu/Cnext/code/dictionary/ |
[Top]
//----------------------------------------------------------------------------- // CustomizeToolPathRep //----------------------------------------------------------------------------- CATRep* CAAEMaiReplayToolPathCustomization::CustomizeToolPathRep (const CATBaseUnknown_var& iOperation, int iStartPoint,int iEndPoint) { // In this sample, no test is done on "iOperation" (current operation) // By testing "iOperation", it is possible to have a different behaviour for // each machining operation // Retrieves an handler on the current MfgTPMultipleMotion object CATIMfgTPMultipleMotion_var MultipleMotion (GetImpl()); if (NULL_var == MultipleMotion) return NULL; // Creates a bag to store the several reps CAT3DBagRep* BagRep = new CAT3DBagRep (); if (NULL == BagRep) return NULL; // Associates a graphic point to each tip point if the MfgTPMultipleMotion object CATMathPoint Pt; double x,y,z; for (int i=iStartPoint;i<=iEndPoint;i++) { if (MultipleMotion->GetTipPoint (i,x,y,z)) { Pt.SetCoord (x,y,z); CAT3DPointRep* RepPoint = new CAT3DPointRep (Pt,FULLSQUARE); if (NULL != RepPoint) BagRep->AddChild (*RepPoint); } } // Returns bag rep return BagRep; } |
With this sample, the graphic representation added to the standard display of the tool path consist of a set of graphic points associated to tool tip points. This behavior is the same for each type of operation. Note that it is possible to have a different behavior for each type of operation by testing iOperation which is an handler on the current operation.
The other inputs, iStartPoint and iEndPoint, indicate the first and the last point of the MfgTPMultipleMotion object currently taken into account in the "tool path replay" command.
CATIMfgTPMultipleMotion is an interface on the MfgTPMultipleMotion object: it allows to read data on the object:
CAT3DBagRep is a visualization object in which it is possible to store several basic "reps" like CAT3DPointRep, ...: a pointer on this object is returned by CustomizeToolPathRep method.
For each tool tip point from index iStartPoint to iEndPoint, its coordinates are read on the MfgTPMultipleMotion object with GetTipPoint method of the CATIMfgTPMultipleMotion interface, a graphic point is then created (CAT3DPointRep object) and this graphic point is stored in the BagRep object.
[Top]
This article provides an example on how to use the manufacturing interface classes, and has illustrated them on a tool path display customization. It shows how to implement the CATIMfgReplayToolPathCustom interface to customize the display of tool path in "tool path replay" command by adding its own graphic representations.
The display of tool path is modified by implementing CATIMfgReplayToolPath
in a data extension class. The only method to implement is CustomizeToolPathRep.
To retrieve parameters on the MfgTPMultipleMotion object which models the tool path, you have to use the CATIMfgTPMultipleMotion interface.
To create graphic objects, you have to use Visualization framework capabilities.
[Top]
[1] | Building and Launching a CAA V5 Use Case |
[Top] |
Version: 1 [Mar 2002] | Document created |
[Top] |
Copyright © 2002, Dassault Systèmes. All rights reserved.