Machining

NC Review

Adding new Columns in the Process Table

Implementing CATIMfgTabularViewColumn and CATICreateInstance
Use Case

Abstract

This article discusses the CAAMfgTPECutAreasUserHeader use case.

What You Will Learn With This Use Case

This use case is intended to help you to add new columns in the Process Table.
[Top]

The CAAMfgProcessTableNewColumn Use Case

CAAMfgProcessTableNewColumn is a use case of the CAAManufacturingItf.edu framework that illustrates ManufacturingInterfaces framework capabilities.
[Top]

What Does CAAMfgProcessTableNewColumn Do

CAAMfgProcessTableNewColumn helps you to insert your own column in the Process Table as shown on Fig.1.
 
Fig. 1: The new columns in the Process Table
[Top]

How to Launch CAAMfgProcessTableNewColumn

To launch CAAMfgProcessTableNewColumn, you will need to:

 

         

         

[Top]

Where to Find the CAAMfgProcessTableNewColumn Code

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.

[Top]

Step-by-Step

  1. Create a component to implement the CATIMfgTabularViewColumn interface
  2. Implement methods of CATIMfgTabularViewColumn on this component
  3. Create an extension of the component to implement CATICreateInstance interface
  4. Implement method of CATICreateInstance on this extension
We now comment these sections by looking at the code.
[Top]

Create a component to implement the CATIMfgTabularViewColumn interface

The class that will implement the CATIMfgTabularViewColumn interface is named CAAMfgProcessTableNewColumn.
Create the CAAMfgProcessTableNewColumn header file:
 
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.

Implement methods of CATIMfgTabularViewColumn on this component

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&);

};

Implement method of CATICreateInstance on this extension

#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;
}
[Top]

In Short

This article provides an example on how to add new columns in the Process Table.
[Top]

References

[1] Building and Launching a CAA V5 Use Case
[Top]

History

Version: 1 [Jul 2004] Document created
[Top]

Copyright © 2000, Dassault Systèmes. All rights reserved.