Machining |
NC Review |
Adding new Columns in the Process TableImplementing CATIMfgTabularViewColumn and CATICreateInstance |
Use Case |
AbstractThis article discusses the CAAMfgTPECutAreasUserHeader use case. |
![]() |
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 lines by removing the '#'
character:
CAAMfgProcessTableNewColumn CATIMfgTabularViewColumn libCAAMaiProcessTableNewColumn
CAAMfgProcessTableNewColumn CATICreateInstance libCAAMaiProcessTableNewColumn
Windows | InstallRootDirectory\CAADoc\CAAManufacturingItf.edu\CNext\resources\graphic |
Unix | InstallRootDirectory/CAADoc/CAAManufacturingItf.edu/CNext/resources/graphic |
The CAAMfgProcessTableNewColumn use case is made of a class named
CAAMfgProcessTableNewColumn
located in the CAAMaiProcessTableNewColumn .m module of the
CAAManufacturingItf.edu framework:
Windows | InstallRootDirectory\CAADoc\CAAManufacturingItf.edu\CAAMaiProcessTableNewColumn.m |
Unix | InstallRootDirectory/CAADoc/CAAManufacturingItf.edu/CAAMaiProcessTableNewColumn.m |
where InstallRootDirectory is the directory where the CAA CD-ROM is installed.
class CAAMfgProcessTableNewColumn: public CATIMfgTabularViewColumn { CATDeclareClass; public: // Standard constructors and destructors for an implementation class // ----------------------------------------------------------------- CAAMfgProcessTableNewColumn (); virtual ~CAAMfgProcessTableNewColumn (); /** * Implements a function from an interface. * @see ManufacturingInterfaces.CATIMfgTabularViewColumn#GetListColumnId */ HRESULT GetListColumnId (CATListOfCATString& oListColumnId ) ; /** * Implements a function from an interface. * @see ManufacturingInterfaces.CATIMfgTabularViewColumn#GetListTitleColumn */ HRESULT GetListTitleColumn (CATListOfCATUnicodeString& oListTitle ) ; /** * Implements a function from an interface. * @see ManufacturingInterfaces.CATIMfgTabularViewColumn#GetParamCke */ HRESULT GetParamCke (const CATBaseUnknown_var& ispBUActivity , const CATString& iColumnId , CATBaseUnknown_var& ospBUCkeParm, int& MultiMod ) ; /** * Implements a function from an interface. * @see ManufacturingInterfaces.CATIMfgTabularViewColumn#GetValue */ HRESULT GetValue (const CATBaseUnknown_var& ispBUActivity , const CATString& iColumnId , CATUnicodeString& ostrValue ) ; /** * Implements a function from an interface. * @see ManufacturingInterfaces.CATIMfgTabularViewColumn#ResetCache */ HRESULT ResetCache (const int iCacheID ) ; private: // The copy constructor and the equal operator must not be implemented // ------------------------------------------------------------------- CAAMfgProcessTableNewColumn (const CAAMfgProcessTableNewColumn &); CAAMfgProcessTableNewColumn& operator=(const CAAMfgProcessTableNewColumn&); }; |
The CAAMfgProcessTableNewColumn C++-derives from CATBaseUnknown. The class has a constructor, a destructor, and the method of interfaces CATIMfgTabularViewColumn.
First you have to implement the method GetListColumnId, which defines ID of columns as CATString.
HRESULT CAAMfgProcessTableNewColumn::GetListColumnId (CATListOfCATString& oListColumnId) { oListColumnId.RemoveAll(); oListColumnId.Append("FixtureAccuracyID"); oListColumnId.Append("InfoID"); return S_OK; } |
Second you have to implement the method GetListTitleColumn, which defines NLS column titles as CATUnicodeString.
HRESULT CAAMfgProcessTableNewColumn::GetListTitleColumn (CATListOfCATUnicodeString& oListTitle) { oListTitle.RemoveAll(); oListTitle.Append("Fixture accuracy"); oListTitle.Append("info"); return S_OK; } |
Third you have to implement the method GetParamCke, which defines how to access the Cke Parameter (returns in CATBaseUnknown_var) for columns containing such parameters. Note that you can set an integer ( MultiModif which is an output of the method) to 1 if you don't want that your attribute can be modified during a multi selection.
HRESULT CAAMfgProcessTableNewColumn::GetParamCke (const CATBaseUnknown_var& ispBUActivity , const CATString& iColumnId , CATBaseUnknown_var& ospBUCkeParm, int & MultiModif) { HRESULT RC = E_FAIL; if (iColumnId == "FixtureAccuracyID") { CATIMfgActivityParameters_var spActParameters(ispBUActivity); if (NULL_var != spActParameters) { CATBaseUnknown_var spBUCkeParm; HRESULT hr = spActParameters->FindElement("MfgFixtureAccuracy", spBUCkeParm); if (NULL_var != spBUCkeParm) { CATICkeParm_var spCkeParm(spBUCkeParm); if (NULL_var != spCkeParm) { ospBUCkeParm = spCkeParm; RC = S_OK; } } } } return RC; } |
Fourth you have to implement the method GetValue, which defines the CATUnicodeString displayed for columns containing such parameters.
HRESULT CAAMfgProcessTableNewColumn::GetValue (const CATBaseUnknown_var& ispBUActivity , const CATString& iColumnId , CATUnicodeString& ostrValue) { ostrValue = "-"; if (iColumnId == "InfoID") ostrValue = "Info User"; return S_OK; } |
Finally you have to implement ResetCache which return S_OK to indicate that you don't want to manage cache.
HRESULT CAAMfgProcessTableNewColumn::ResetCache (const int iCacheID) { // no cache to manage here ! return S_OK; } |
Create an extension of the component to implement CATICreateInstance interface
The class that will extend the component and implement CATICreateInstance
interface is named
CAAMfgProcessTableNewColumnInstance.
Create the CAAMfgProcessTableNewColumnInstance header file:
class CAAMfgProcessTableNewColumnInstance: public CATBaseUnknown { CATDeclareClass; public: // Standard constructors and destructors for an implementation class // ----------------------------------------------------------------- CAAMfgProcessTableNewColumnInstance (); virtual ~CAAMfgProcessTableNewColumnInstance (); /** * Implements a function from an interface. * @see System.CATICreateInstance#CreateInstance */ HRESULT __stdcall CreateInstance (void ** oPPV ) ; private: // The copy constructor and the equal operator must not be implemented // ------------------------------------------------------------------- CAAMfgProcessTableNewColumnInstance (CAAMfgProcessTableNewColumnInstance &); CAAMfgProcessTableNewColumnInstance& operator=(CAAMfgProcessTableNewColumnInstance&); }; |
#include "TIE_CATICreateInstance.h" TIE_CATICreateInstance( CAAMfgProcessTableNewColumnInstance); //----------------------------------------------------------------------------- // Implements CATICreateInstance::CreateInstance //----------------------------------------------------------------------------- HRESULT __stdcall CAAMfgProcessTableNewColumnInstance::CreateInstance (void ** oPPV) { CAAMfgProcessTableNewColumn * pt = new CAAMfgProcessTableNewColumn(); *oPPV = (void*) pt; if (NULL != pt) return S_OK; else return E_FAIL; } |
[1] | Building and Launching a CAA V5 Use Case |
[Top] |
Version: 1 [Jul 2004] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.