Machining

NC Review

Allowing Third Party or Home-Made Post-Processors to Be Used

Implementing the CATIMfgExternalPPDefinition interface and an interface derived from CATIMfgExternalPPManagement
Use Case

Abstract

This article discusses the CAAMaiUserPostProcessorIntegration use case and explains how to implement the CATIMfgExternalPPDefinition manufacturing interface, and an interface derived from the CATIMfgExternalPPManagement manufacturing interface.


What You Will Learn With This Use Case

This use case is intended to help you customize the list of available Post-Processors, by implementing the CATIMfgExternalPPDefinition manufacturing interface, and an interface derived from the CATIMfgExternalPPManagement manufacturing interface.

This involves the following:

[Top]

The CAAMaiUserPostProcessorIntegration Use Case

CAAMaiUserPostProcessorIntegration is a use case of the CAAManufacturingItf.edu framework that illustrates ManufacturingInterfaces framework capabilities.

[Top]

What Does CAAMaiUserPostProcessorIntegration Do

CAAMaiUserPostProcessorIntegration runs with a default Process document as shown on Fig.1 that contains the program to use. The use case shows that the tool path computation can be processed, including the NC code generation using a home-made or a third party post-processor.

Fig. 1: The PP selection in CATMFG submission panel

[Top]

How to Launch CAAMaiUserPostProcessorIntegration

To launch CAAMaiUserPostProcessorIntegration, you will need to:

[Top]

Where to Find the CAAMaiUserPostProcessorIntegration Code

The CAAMaiUserPostProcessorIntegration use case is made of:

located in the CAAMaiUserPostProcessorIntegration.m module of the CAAManufacturingItf.edu framework:
Windows InstallRootDirectory\CAADoc\CAAManufacturingItf.edu\CAAMaiUserPostProcessorIntegration.m
Unix InstallRootDirectory/CAADoc/CAAManufacturingItf.edu/CAAMaiUserPostProcessorIntegration.m

where InstallRootDirectory is the directory where the CAA CD-ROM is installed.

[Top]

Step-by-Step

There are five logical steps in CAAMaiUserPostProcessorIntegration:

  1. Create an extension class to implement the CATIMfgExternalPPDefinition interface
  2. Implement on this extension class the method to return the list of post-processors providers.
  3. Create for each provider an interface derived from the CATIMfgExternalPPManagement interface
  4. Create for each provider an extension class to implement this interface
  5. Implement the methods on this extension class

We now comment each of those sections by looking at the code.

[Top]

Create an extension class to implement the CATIMfgExternalPPDefinition interface

The extension class that will implement CATIMfgExternalPPDefinition is named CAAEMaiUserPostProcessorIntegrationExtPPProviders.

The creation of this class is done is three sub steps:

  1. Create the CAAEMaiUserPostProcessorIntegrationExtPPProviders class header file:
    #include "CATBaseUnknown.h"
    #include "CATListPV.h"
    
    class CAAEMaiUserPostProcessorIntegrationExtPPProviders : public CATBaseUnknown
    {
    public:
      CATDeclareClass;
      
      CAAEMaiUserPostProcessorIntegrationExtPPProviders ();
    
      virtual ~CAAEMaiUserPostProcessorIntegrationExtPPProviders ();
      
      virtual HRESULT GetListOfExternalPostProcessorProviders (CATListPV& oListOfPostProcessorProviders);
      
    private:
      CAAEMaiUserPostProcessorIntegrationExtPPProviders(const CAAEMaiUserPostProcessorIntegrationExtPPProviders &iObjectToCopy);
    };

    The CAAEMaiUserPostProcessorIntegrationExtPPProviders C++-class derives from CATBaseUnknown.

    The CATDeclareClass macro declares that the class CAAEMaiUserPostProcessorIntegrationExtPPProviders belongs to a component.

    The class has a constructor, a destructor, the GetListOfExternalPostProcessorProviders method of CATIMfgExternalPPDefinition, and a copy constructor.
    Note that the copy constructor is set as private. This is very important for extensions. Since extensions must never be directly instantiated by client applications, this prevents the compiler from creating the copy constructor as public without you know.
    This copy constructor is not implemented in the source file.

  2. Create the CAAEMaiUserPostProcessorIntegrationExtPPProviders class source file.
    It begins as follows:
    ...
    #include "TIE_CATIMfgExternalPPDefinition.h"
    CATImplementClass(CAAEMaiUserPostProcessorIntegrationExtPPProviders,CodeExtension,CATBaseUnknown,CATMfgExtPPManagement);
    TIEchain_CATIMfgExternalPPDefinition (CAAEMaiUserPostProcessorIntegrationExtPPProviders);
    ...
    HRESULT CAAEMaiUserPostProcessorIntegrationExtPPProviders::GetListOfExternalPostProcessorProviders (CATListPV& oListOfPostProcessorProviders)
    {
      HRESULT rc = S_OK;
      ...

    The CAAEMaiUserPostProcessorIntegrationExtPPProviders class states that it implements the CATIMfgExternalPPDefinition interface thanks to the TIEchain_CATIMfgExternalPPDefinition macro.

    The CATImplementClass macro declares that the CAAEMaiUserPostProcessorIntegrationExtPPProviders class is code extension class, thanks to the CodeExtension keyword, and that it extends the object whose type is CATMfgExtPPManagement. The third parameter must always be set to CATBaseUnknown, makes no sense, and is unused for extensions.

    Extending the CATMfgExtPPManagement object using the CAAEMaiUserPostProcessorIntegrationExtPPProviders class that implements CATIMfgExternalPPDefinition means fitting this object with your customized behavior for PP provider definition which will replace the default one.

    The GetListOfExternalPostProcessorProviders method implementation is shown in the next steps. It has no input parameters and a pointer to the list of pointers of implementation classes ID corresponding to post-processors providers as output parameter.

  3. Update the dictionary

    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 CATMfgExtPPManagement object implements the CATIMfgExternalPPDefinition interface, and whose code is located in the libCAAMaiUserPostProcessorIntegration shared library or DLL. Pay attention to remove the comment (#) in the supplied dictionary.

    CATMfgExtPPManagement  CATIMfgExternalPPDefinition  libCAAMaiUserPostProcessorIntegration

    The CAAManufacturingItf.edu.dico file is located in:
    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.

[Top]

Implement on this extension class the method to return the list of post-processors providers

Each post-processor provider will have to create an implementation class for an interface derived from the CATIMfgExternalPPManagement interface

The list of post-processors providers is retrieved through the GetListOfExternalPostProcessorProviders method with instructions as follows:

  ...
     oListOfPostProcessorProviders.Append ((void*) &CAAIMaiUserPostProcessorIntegrationExternalPPClient1::ClassId ());
  ...

[Top]

Create for each provider an interface derived from the CATIMfgExternalPPManagement interface

The interface derived from CATIMfgExternalPPManagement is named CAAIMaiUserPostProcessorIntegrationExternalPPClient1.

The creation of this interface is done is four sub steps:

  1. Create the CAAIMaiUserPostProcessorIntegrationExternalPPClient1 interface header file:
    ...
    class ExportedByCAAMaiPostProcessorEnv CAAIMaiUserPostProcessorIntegrationExternalPPClient1 : public CATIMfgExternalPPManagement
    {
      CATDeclareInterface ;  
    
      public:
    
    };
    
    CATDeclareHandler (CAAIMaiUserPostProcessorIntegrationExternalPPClient1,CATBaseUnknown) ;
    ...
    		   

    The CATDeclareInterface macro declares that the CAAIMaiUserPostProcessorIntegrationExternalPPClient1 class is an interface

    ExportedByCAAMaiPostProcessorEnv means that the interface will be exported by the module CAAMaiPostProcessorEnv

  2. Create the CAAIMaiUserPostProcessorIntegrationExternalPPClient1 class source file:
    #include "CATMetaClass.h"
    #include "CAAIMaiUserPostProcessorIntegrationExternalPPClient1.h"
    ...
    CATImplementInterface (CAAIMaiUserPostProcessorIntegrationExternalPPClient1,CATBaseUnknown);
    CATImplementHandler (CAAIMaiUserPostProcessorIntegrationExternalPPClient1,CATBaseUnknown);
    ...
    		   

    The CATImplementInterface macro declares that the CAAIMaiUserPostProcessorIntegrationExternalPPClient1 class is an interface

  3. Create the TIE_CAAIMaiUserPostProcessorIntegrationExternalPPClient1 tsrc file
    This file only includes the following instruction:
    #include "CAAIMaiUserPostProcessorIntegrationExternalPPClient1.h"
    		   
  4. Create the CAAMaiPostProcessorEnv header file:
    #ifdef	_WINDOWS_SOURCE
    #ifdef	__CAAMaiUserPostProcessorIntegration
    #define	ExportedByCAAMaiPostProcessorEnv	__declspec(dllexport)
    #else
    #define	ExportedByCAAMaiPostProcessorEnv	__declspec(dllimport)
    #endif
    #else
    #define	ExportedByCAAMaiPostProcessorEnv
    #endif
    		   

[Top]

Create for each provider an extension class to implement this interface

The extension class that will implement CAAIMaiUserPostProcessorIntegrationExternalPPClient1 is named CAAEMaiUserPostProcessorIntegrationExtPPClient1.

The creation of this class is done is three sub steps:

  1. Create the CAAEMaiUserPostProcessorIntegrationExtPPClient1 class header file:
    #include "CATBaseUnknown.h"
              
    ...
    
    class CAAEMaiUserPostProcessorIntegrationExtPPClient1 : public CATBaseUnknown
    {
    public:
      CATDeclareClass;
      
      CAAEMaiUserPostProcessorIntegrationExtPPClient1 ();
    
      virtual ~CAAEMaiUserPostProcessorIntegrationExtPPClient1 ();
      
      virtual HRESULT GetProviderNames ( CATUnicodeString&        oNLSName     ,
    				                       CATString&               oKeywordName );
      virtual HRESULT GetListOfPPs     ( CATListOfCATUnicodeString& oNLSList     , 
    				                       CATListOfCATString&        oKeywordList );
      virtual HRESULT RunHelp          ( CATString&                 iPPKeyword );
      virtual HRESULT RunPP            ( CATListOfCATUnicodeString& iPPParams );
    
    private:
      CAAEMaiUserPostProcessorIntegrationExtPPClient1(const CAAEMaiUserPostProcessorIntegrationExtPPClient1 &iObjectToCopy);
    };

    The CAAEMaiUserPostProcessorIntegrationExtPPClient1 C++-class derives from CATBaseUnknown.

    The CATDeclareClass macro declares that the class CAAEMaiUserPostProcessorIntegrationExtPPClient1 belongs to a component.

    The class has a constructor, a destructor, the methods of CATIMfgExternalPPManagement, and a copy constructor.
    Note that the copy constructor is set as private. This is very important for extensions. Since extensions must never be directly instantiated by client applications, this prevents the compiler from creating the copy constructor as public without you know.
    This copy constructor is not implemented in the source file.

  2. Create the CAAEMaiUserPostProcessorIntegrationExtPPClient1 class source file.
    It begins as follows:
    ...
    #include "TIE_CAAIMaiUserPostProcessorIntegrationExternalPPClient1.h"
    CATImplementClass (CAAEMaiUserPostProcessorIntegrationExtPPClient1,CodeExtension,CATBaseUnknown,CATMfgExtPPManagement);
    TIEchain_CAAIMaiUserPostProcessorIntegrationExternalPPClient1 (CAAEMaiUserPostProcessorIntegrationExtPPClient1);
    ...
    HRESULT CAAEMaiUserPostProcessorIntegrationExtPPProviders::GetListOfExternalPostProcessorProviders (CATListPV& oListOfPostProcessorProviders)
    {
      HRESULT rc = S_OK;
      ...

    The CAAEMaiUserPostProcessorIntegrationExtPPClient1 class states that it implements the CAAIMaiUserPostProcessorIntegrationExternalPPClient1 interface thanks to the TIEchain_CAAIMaiUserPostProcessorIntegrationExternalPPClient1 macro.

    The CATImplementClass macro declares that the CAAEMaiUserPostProcessorIntegrationExtPPClient1 class is code extension class, thanks to the CodeExtension keyword, and that it extends the object whose type is CATMfgExtPPManagement. The third parameter must always be set to CATBaseUnknown, makes no sense, and is unused for extensions.

    Extending the CATMfgExtPPManagement object using the CAAEMaiUserPostProcessorIntegrationExtPPClient1 class that implements CAAIMaiUserPostProcessorIntegrationExternalPPClient1 means fitting this object with your customized behavior for post-processors definition which will replace the default one.

    The methods implementation is shown in the next steps.

  3. Update the dictionary

    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 CATMfgExtPPManagement object implements the CAAIMaiUserPostProcessorIntegrationExternalPPClient1 interface, and whose code is located in the libCAAMaiUserPostProcessorIntegration shared library or DLL. Pay attention to remove the comment (#) in the supplied dictionary.

    CATMfgExtPPManagement  CAAIMaiUserPostProcessorIntegrationExternalPPClient1  libCAAMaiUserPostProcessorIntegration

    The CAAManufacturingItf.edu.dico file is located in:
    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.

[Top]

Implement the methods on this extension class

[Top]


In Short

This article provides an example on how to use the manufacturing interface classes, and has illustrated them on user defined post-processor customization. It shows how to implement the CATIMfgExternalPPDefinition interface and an interface derived from CATIMfgExternalPPManagement to allow third party post-processors or home-made post-processors to be used.

The post-processors provider can be selected in the list of available providers (through the Options item of the Tools menu), thanks to a C++-class implementing the CATIMfgExternalPPDefinition interface.

The post-processor can be selected when submitting the toolpath computation, thanks to a C++-class implementing an interface derived from the CATIMfgExternalPPManagement interface.

[Top]


References

[1] Building and Launching a CAA V5 Use Case
[2] Process Modeler Home Page
[Top]

History

Version: 1 [Sep 2000] Document created
[Top]

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