3D PLM Enterprise Architecture

User Interface - Frame

Creating a Workbench

Exposing and organizing commands dedicated to a given task

Use Case

Abstract

This article shows how to create a workbench.


What You Will Learn With This Use Case

This use case is intended to show how to create a workbench to be added to a given workshop. Like the workshop, the workbench is an object that gathers the commands to work on the document and arrange them in toolbars and menus. Command headers are used to make the link between the workbench and the commands.

[Top]

The CAAAfrGeoCreationWbench Use Case

CAAAfrGeoCreationWbench is a use case of the CAAApplicationFrame.edu framework that illustrates the ApplicationFrame framework capabilities.

[Top]

What Does CAAAfrGeoCreationWbench Do

The CAAAfrGeoCreationWbench use case creates a workbench named CAA Geometrical Creation for the CAAGeometry document. Its specifications cover most of the cases you will meet. Two toolbars are provided:

The Solids toolbar. It includes five new commands: Cuboid, Sphere, Torus, and Cylinder 1 and 2.
The Surfaces toolbar. It includes three new commands: Revolution Surface, Nurbs Surface, and Offset Surface.

The only change in the menu bar is the addition of these commands in the Insert menu using two submenus below the existing ones.

[Top]

How to Launch CAAAfrGeoCreationWbench

See the section entitled "How to Launch the CAAGeometry Use Case" in the "The CAAGeometry Sample" use case for a detailed description of how this use case should be launched. For the specific scenario :

Do not type the module name on the command line, but type CNEXT instead. When the application is ready, do the following:

This creates a new CAAGeometry document with the CAA V5: Geometrical Creation workbench active.

[Top]

Where to Find the CAAAfrGeoCreationWbench Code

The CAAAfrGeoCreationWbench use case is made of classes and interfaces located in the CAAAfrGeoCreationWbench.m module and in the ProtectedInterfaces directory of the CAAApplicationFrame.edu framework:

Windows InstallRootDirectory\CAAApplicationFrame.edu\CAAAfrGeoCreationWbench.m\
Unix InstallRootDirectory/CAAApplicationFrame.edu/CAAAfrGeoCreationWbench.m/

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

These classes and interfaces are:

CAAAfrGeoCreationWkb Workbench description class
CAAAfrGeoCreationWkbFactory Factory class for the workbench class
CAAIAfrGeoCreationWkbFactory Factory interface implemented by CAAAfrGeoCreationWkbFactory
TIE_CAAIAfrGeoCreationWkbFactory TIE class for the factory interface
CAAIAfrGeoCreationWkbAddin Add-in interface exposed by the workbench and that all its add-ins must implement
TIE_CAAIAfrGeoCreationWkbAddin TIE class for the add-in interface

[Top]

Step-by-Step

But before creating the workbench, you should:

 

To create the CAA Geometrical Creation workbench, there are seven steps:

# Step Where
1 Create the workbench factory interface LocalInterfaces and src
2 Create the workbench factory LocalInterfaces and src
3 Create the workbench description class LocalInterfaces and src
4 Create the command headers CreateCommands method
5 Create the workbench and arrange the commands CreateWorkbench method
6 Provide the resources and insert the workbench into the Start menu Resource files
7 Create the workbench exposed interface ProtectedInterfaces and src

[Top]

Creating the Workbench Factory Interface

This factory interface is named CAAIAfrGeoCreationWkbFactory. To create this interface, create:

  1. The header file
  2. The source file
  3. The TIE tsrc file.

This is shown below.

  1. Its header file CAAIAfrGeoCreationWkbFactory.h is as follows
    #include <CATIGenericFactory.h> 
    
    extern IID IID_CAAIAfrGeoCreationWkbFactory;
    
    class CAAIAfrGeoCreationWkbFactory : public CATIGenericFactory
    {
      CATDeclareInterface;
      public :
    };

    A factory interface is a CAA interface, that is, an abstract class that derives from CATIGenericFactory. As any interface, it has an IID declared as IID_ followed by the interface name, and includes the CATDeclareInterface macro that declares that this abstract class is an interface. No additional method than those of CATIGenericFactory is necessary. Don't forget the public keyword required by the TIE compiler.

  2. Its source file CAAIAfrGeoCreationWkbFactory.cpp is as follows.
    #include <CAAIAfrGeoCreationWkbFactory.h>
    
    IID IID_CAAIAfrGeoCreationWkbFactory = {
        0xb32eed10,
        0xd4c1,
        0x11d3,
        {0xb7, 0xf5, 0x00, 0x08, 0xc7, 0x4f, 0xe8, 0xdd}
      };
    
    CATImplementInterface(CAAIAfrGeoCreationWkbFactory, CATIGenericFactory);

    This file includes a GUID [1], shown in bold typeface. The CATImplementInterface macro is used in conjunction with CATDeclareInterface in the header file to make an interface from this abstract class and to declare that it OM-derives from CATIGenericfactory.

  3. Create a file named TIE_CAAIAfrGeoCreationWkbFactory.tsrc in the src directory, and containing:
    #include "CAAIAfrGeoCreationWkbFactory.h"

    The Multi-Workspace Application Builder (mkmk) will generate the TIE for this interface for you, that is, the TIE_CAAIAfrGeoCreationWkbFactory.h file in the ProtectedGenerated directory.

[Top]

Creating the Workbench Factory

 warning.gif (206 bytes)The factory class that creates workbench instances must concatenate the name of the class to instantiate, that is, the workbench description class CAAAfrGeoCreationWkb, with the string Factory. This gives CAAAfrGeoCreationWkbFactory.

To create this class, create:

  1. The header file, using the CATDeclareConfigurationFactory macro
  2. The source file, using the CATImplementConfigurationFactory macro
  3. Update the interface dictionary and the factory dictionary.
  1. Create the CAAAfrGeoCreationWkbFactory.h header file.
    #include "CATWorkshopConfigurationFactory.h" 
    
    CATDeclareConfigurationFactory(CAAAfrGeoCreationWkb);

    The CATDeclareConfigurationFactory macro argument is the name of the workbench description class. 

  2. Create the CAAAfrGeoCreationWkbFactory.cpp file.
    #include <CAAAfrGeoCreationWkb.h>
    #include <CAAAfrGeoCreationWkbFactory.h>
    
    #include <TIE_CAAIAfrGeoCreationWkbFactory.h>
    
    CATImplementConfigurationFactory(CAAAfrGeoCreationWkb,
                                     CAAIAfrGeoCreationWkbFactory);

    The CATImplementConfigurationFactory arguments are the name of the workbench description class and the name of the workbench factory interface respectively. The CATDeclareConfigurationFactory and CATImplementConfigurationFactory macros create the workbench factory implementation class as a data extension of the CATApplicationFrame component

  3. You should now update the two dictionary files:

    At run time, the pathname of the directory that contains these dictionaries files is concatenated to other dictionary pathnames in the CATDictionaryPath environment variable.

[Top]

Creating the Workbench Description Class

The CAAAfrGeoCreationWkb class implements the CATICAAAfrGeometryWksConfiguration interface exposed by the CAAGeometry workshop . It includes the following methods:

You should:

  1. Create the CAAAfrGeoCreationWkb.h file
    #include "CATBaseUnknown.h"
    #include "CATListPV.h"
    
    class CATCmdWorkbench;
    
    class CAAAfrGeoCreationWkb : public CATBaseUnknown
    {
      CATDeclareClass;
      public:
         CAAAfrGeoCreationWkb();
         virtual ~CAAAfrGeoCreationWkb();
    
         void              CreateCommands();
         CATCmdWorkbench * CreateWorkbench();
         CATClassId        GetAddinInterface();
         void              GetCustomInterfaces(CATListPV * oDefaultIIDList , 
                                               CATListPV * oCustomIIDList) ;
      private:
         CAAAfrGeoCreationWkb(const CAAAfrGeoCreationWkb &iObjectToCopy);
    };

    The CAAAfrGeoCreationWkb class C++-derives from CATBaseUnknown. The CATDeclareClass macro declares that the class CAAAfrGeoCreationWkb belongs to a component. The class has a constructor, a destructor, the four methods of the CATIWorkbench interface, and a copy constructor. Note that the copy constructor is set as private. 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 CAAAfrGeoCreationWkb.cpp file. The file skeleton is shown below. The implementation of each method is described in separate sections.
    #include <CAAAfrGeoCreationWkb.h>
    
    #include <CATCommandHeader.h> // See Creating the Command Headers
    MacDeclareHeader(CAAAfrGeoCreationWkbHeader);
    
    #include <CATCreateWorkshop.h>
    
    CATImplementClass(CAAAfrGeoCreationWkb, Implementation, CATBaseUnknown, CATNull);
    #include <TIE_CATICAAAfrGeometryWksConfiguration.h> 
    TIE_CATICAAAfrGeometryWksConfiguration(CAAAfrGeoCreationWkb);
    
    CAAAfrGeoCreationWkb::CAAAfrGeoCreationWkb() {}
    CAAAfrGeoCreationWkb::~CAAAfrGeoCreationWkb() {}
    
    void CAAAfrGeoCreationWkb::CreateCommands()
    {
      ...  // See Creating the Command Headers
    }
    
    CATCmdWorkbench * CAAAfrGeoCreationWkb::CreateWorkbench()
    {
      ...  // See Creating the Workbench and Arranging the Commands
    }
    
    CATClassId CAAAfrGeoCreationWkb::GetAddinInterface()
    {
      return "CAAIAfrGeoCreationWkbAddin";
    }
    
    void CAAAfrGeoCreationWkb::GetCustomInterfaces(CATListPV * oDefaultIIDList,
                                                   CATListPV * oCustomIIDList)
    {}

    The CAAAfrGeoCreationWkb class states that it implements the CATICAAAfrGeometryWksConfiguration interface thanks to the TIE_CATICAAAfrGeometryWksConfiguration macro. The CATImplementClass macro declares that the CAAAfrGeoCreationWkb class is a component main class [2], thanks to the Implementation keyword, and that it OM-derives from CATBaseUnknown [2]. The fourth parameter must always be set to CATNull for component main classes.

    The GetCustomInterfaces method must be empty. The names of the interface exposed by the workbench to enable clients to create add-ins is returned by the GetAddinInterface method. See Creating the Workbench Exposed Interface to create this interface.

  3. Updating the Dictionary

    Update the interface dictionary, that is a file named, for example, CAAApplicationFrame.dico, whose directory's pathname is concatenated at run time in the CATDictionaryPath environment variable, and containing the following declaration to state that the CAAAfrGeoCreationWkb class implements the CATICAAAfrGeometryWksConfiguration interface, and whose code is located in the libCAAAfrGeoCreationWbench shared library or DLL. The update is in bold typeface:

    CATApplicationFrame  CAAIAfrGeoCreationWkbFactory         libCAAAfrGeoCreationWbench
    CAAAfrGeoCreationWkb CATICAAAfrGeometryWksConfiguration   libCAAAfrGeoCreationWbench

[Top]

Creating the Command Headers

This is done by the CreateCommands method. Each command available in your workbench must have a command header. A command header is an instance of a command header class, and different commands can share the same command header class to create their command header. Refer to The Command Headers for more details.

A single command header class is created for the commands, named CAAAfrGeoCreationWkbHeader using the MacDeclareHeader macro. You can also create the class more classically if the command may be sometimes unavailable. This is described in The Command Headers.

  1. Create the CAAAfrGeoCreationWkbHeader command header class. To do this, add the following in CAAAfrGeoCreationWkb.cpp:
    #include <CATCommandHeader.h>
    MacDeclareHeader(CAAAfrGeoCreationWkbHeader);

    The MacDeclareHeader macro creates the header file and the source file for the CAAAfrGeoCreationWkbHeader class, and associates with this class the resource files CAAAfrGeoCreationWkbHeader.CATNls and CAAAfrGeoCreationWkbHeader.CATRsc. See Providing the Resources and Inserting the Workbench into the Start Menu.

  2. Create the code to instantiate your command headers in the empty CreateCommands method. This method should contain one instantiation statement of the command header class per command. Each statement has the following form, for example for the Cuboid command.
    void CAAAfrGeoCreationWkb::CreateCommands()
    {
      ...
      new CAAAfrGeoCreationWkbHeader("CAAAfrCuboidHdr",
                                     "CAADegGeoCommands",
                                     "CAADegCreateCuboidCmd",
                                     (void *) NULL);
      ...
    }  

    The command header constructor has the following arguments:

[Top]

Creating the Workbench and Arranging the Commands

This is the job of the CreateWorkbench method. To understand how to do, let's remind of what the workbench is made of.

You should create:

  1. Creating the Workbench

    The workbench contains its toolbars and its menu bar. Create the workbench as an instance of the CATCmdWorkbench class using the NewAccess macro.

    CATCmdWorkbench * CAAAfrGeoCreationWkb::CreateWorkbench()
    {
      NewAccess(CATCmdWorkbench,pCAAAfrGeoCreationWkb,CAAAfrGeoCreationWkb);
      ... // See Creating the Containers for the Toolbars and the Menu Bar
      return pCAAAfrGeoCreationWkb;
    }

    pCAAAfrGeoCreationWkb is the variable used to handle the workbench instance pointer, and CAAAfrGeoCreationWkb is the workbench identifier. Note that the workbench class name and the workbench identifier must be identical to take into account the workbench resources in the Start menu. They appear both in bold typeface. This identifier is also used to name the workbench resource files CAAAfrGeoCreationWkb.CATNls and CAAAfrGeoCreationWkb.CATRsc. The workbench resources, and how to provide them, are described in Creating Resources for Workbenches. See also Providing the Resources and Inserting the Workbench into the Start Menu for an overview of all the resources to create.

  2. Creating the Containers for the Toolbars and the Menu Bar

    The toolbars and the menu bar are in turn containers for the commands and submenus.

    The code to create the toolbars and the menu bar is the following:

    ...
        NewAccess(CATCmdContainer,pCAAAfrSolidEltTlb,CAAAfrSolidEltTlb);
        SetAccessChild(pCAAAfrGeoCreationWkb, pCAAAfrSolidEltTlb);
        ...  // See Creating the Solids Toolbar Content
        AddToolbarView(pCAAAfrSolidEltTlb,1,Right);
    
        NewAccess(CATCmdContainer,pCAAAfrSurfacicEltTlb,CAAAfrSurfacicEltTlb);
        SetAccessNext(pCAAAfrSolidEltTlb,pCAAAfrSurfacicEltTlb);
        ...  // See Creating the Surfaces Toolbar Content
        AddToolbarView(pCAAAfrSurfacicEltTlb,-1,Right);
    
        NewAccess(CATCmdContainer,pCAAAfrGeoCreationMbr,CAAAfrGeoCreationMbr);
        ...  // See Creating the Menu Bar Content
        SetWorkbenchMenu(pCAAAfrGeoCreationWkb,pCAAAfrGeoCreationMbr);
    ...

    Here is what's happen:

    The toolbar resources, and how to provide them, are described in Creating Resources for Workbenches. See also Providing the Resources and Inserting the Workbench into the Start Menu for an overview of all the resources to create.

  3. Creating the Solids Toolbar Content

    This toolbar contains four commands: Cuboid, Sphere, Torus, and Cylinder. You should, for each command:

    1. Create a command starter using the NewAccess macro
    2. Associate the command starter, using the SetAccessCommand macro, with the appropriate command header identifier defined in the CreateCommands method
    3. Arrange the command starters in the toolbar using the SetAccessChild and SetAccessNext macros
    ...
          NewAccess(CATCmdStarter,pCAAAfrTSolidEltCuboidStr,CAAAfrTSolidEltCuboidStr);
          SetAccessCommand(pCAAAfrTSolidEltCuboidStr,"CAAAfrCuboidHdr");
          SetAccessChild(pCAAAfrSolidEltTlb,pCAAAfrTSolidEltCuboidStr);
    
          NewAccess(CATCmdStarter,pCAAAfrTSolidEltSphereStr,CAAAfrTSolidEltSphereStr);
          SetAccessCommand(pCAAAfrTSolidEltSphereStr,"CAAAfrSphereHdr");
          SetAccessNext(pCAAAfrTSolidEltCuboidStr,pCAAAfrTSolidEltSphereStr);
    
          NewAccess(CATCmdStarter,pCAAAfrTSolidEltTorusStr,CAAAfrTSolidEltTorusStr);
          SetAccessCommand(pCAAAfrTSolidEltTorusStr,"CAAAfrTorusHdr");
          SetAccessNext(pCAAAfrTSolidEltSphereStr,pCAAAfrTSolidEltTorusStr);
    
          NewAccess(CATCmdStarter,pCAAAfrTSolidEltCylinder1Str,CAAAfrTSolidEltCylinder1Str);
          SetAccessCommand(pCAAAfrTSolidEltCylinder1Str,"CAAAfrCylinder1Hdr");
          SetAccessNext(pCAAAfrTSolidEltTorusStr,pCAAAfrTSolidEltCylinder1Str);
             
          NewAccess(CATCmdStarter,pCAAAfrTSolidEltCylinder2Str,CAAAfrTSolidEltCylinder2Str);
          SetAccessCommand(pCAAAfrTSolidEltCylinder2Str,"CAAAfrCylinder2Hdr");
          SetAccessNext(pCAAAfrTSolidEltCylinder1Str,pCAAAfrTSolidEltCylinder2Str);
    ...

    Three macros are required for each command. For example, the Cuboid command is processed as follows:

    1. First create the command starter as a CATCmdStarter instance using the NewAccess macro. pCAAAfrTSolidEltCuboidStr is the variable used to handle a pointer to that instance, and CAAAfrTSolidEltCuboidStr is its identifier.
    2. Then associate the Cuboid command header with this command starter using the SetAccessCommand macro. The second parameter is the Cuboid command header identifier defined as the first parameter of the command header consrtuctor. Refer to Creating the Command Headers
    3. Finally set the Cuboid command starter as the child of the Solids toolbar.

    Proceed in the same way for the other commands, except that they are set as next of one another using the SetAccessNext macro.

  4. Creating the Surfaces Toolbar Content

    This toolbar contains three commands: Revolution Surface, Nurbs Surface, and Offset Surface. You should, for each command:

    1. Create a command starter using the NewAccess macro
    2. Associate the command starter, using the SetAccessCommand macro, with the appropriate command header identifier defined in the CreateCommands method
    3. Arrange the command starters in the toolbar using the SetAccessChild and SetAccessNext macros
    ...
        NewAccess(CATCmdStarter,pCAAAfrTSurfRevolStr,CAAAfrTSurfRevolStr);
        SetAccessCommand(pCAAAfrTSurfRevolStr,"CAAAfrRevolSurfHdr");
        SetAccessChild(pCAAAfrSurfacicEltTlb,pCAAAfrTSurfRevolStr);
    
        NewAccess(CATCmdStarter,pCAAAfrTSurfNurbsStr,CAAAfrTSurfNurbsStr);
        SetAccessCommand(pCAAAfrTSurfNurbsStr,"CAAAfrNurbsSurfHdr");
        SetAccessNext(pCAAAfrTSurfRevolStr,pCAAAfrTSurfNurbsStr);
    
        NewAccess(CATCmdStarter,pCAAAfrTSurfOffsetStr,CAAAfrTSurfOffsetStr);
        SetAccessCommand(pCAAAfrTSurfOffsetStr,"CAAAfrOffsetSurfHdr");
        SetAccessNext(pCAAAfrTSurfNurbsStr,pCAAAfrTSurfOffsetStr);
    ...

    Three macros are required for each command. For example, the Revolution Surface command is processed as follows:

    1. First create the command starter as a CATCmdStarter instance using the NewAccess macro. pCAAAfrTSurfRevolStr is the variable used to handle a pointer to that instance, and CAAAfrTSurfRevolStr is its identifier.
    2. Then associate the Revolution Surface command header with this command starter using the SetAccessCommand macro. The second parameter is the Revolution Surface command header identifier defined as the first parameter of the command header consrtuctor. Refer to Creating the Command Headers
    3. Finally set the Revolution Surface command starter as the child of the Surfaces toolbar.

    Proceed in the same way for the other commands, except that they are set as next of one another using the SetAccessNext macro.

  5. Creating the Menu Bar Content

    Menus and submenus are created as CATCmdContainer instances, and menu items as CATCmdStarter instances. The menu bar you create will be merged when the workbench is loaded or activated at run time with the workshop menu bar, itself resulting in the merge of the default menu bar, that is, the one that exists when no document is active, with the one defined for the workshop. You can neither remove a menu from the default menu bar or from the menu bar defined for the workshop, nor change the menu order, nor modify an existing menu item , nor add a submenu to an existing menu item.You can only add an item at first level of an existing menu with a submenu or not.

     

    You should:

    1. Create a command container for each menu and submenu using the NewAccess macro
    2. Create a command starter for each command using the NewAccessmacro
    3. Associate each command starter, using the SetAccessCommand macro, with the appropriate command header identifier defined in the CreateCommands method
    4. Arrange the command starters in the menu using the SetAccessChild, and SetAccessNext macros

    Insert Menu - Solids Submenu

    ...
        NewAccess(CATCmdContainer,pCATAfrInsertMnu,CATAfrInsertMnu);
        SetAccessChild(pCAAAfrGeoCreationMbr,pCATAfrInsertMnu);
    
          NewAccess(CATCmdSeparator,pCAAAfrGeoCreationInsertSep,CAAAfrGeoCreationInsertSep);
          SetAccessChild(pCATAfrInsertMnu,pCAAAfrGeoCreationInsertSep);
    
          NewAccess(CATCmdContainer,pCAAAfrSolidEltSnu,CAAAfrSolidEltSnu);
          SetAccessNext(pCAAAfrGeoCreationInsertSep,pCAAAfrSolidEltSnu);
    
            NewAccess(CATCmdStarter,pCAAAfrMSolidCuboidStr,CAAAfrMSolidCuboidStr);
            SetAccessChild(pCAAAfrSolidEltSnu,pCAAAfrMSolidCuboidStr);
            SetAccessCommand(pCAAAfrMSolidCuboidStr,"CAAAfrCuboidHdr");
    
            NewAccess(CATCmdStarter,pCAAAfrMSolidSphereStr,CAAAfrMSolidSphereStr);
            SetAccessNext(pCAAAfrMSolidCuboidStr,pCAAAfrMSolidSphereStr);
            SetAccessCommand(pCAAAfrMSolidSphereStr,"CAAAfrSphereHdr");
    			    
            NewAccess(CATCmdStarter,pCAAAfrMSolidTorusStr,CAAAfrMSolidTorusStr);
            SetAccessNext(pCAAAfrMSolidSphereStr,pCAAAfrMSolidTorusStr);
            SetAccessCommand(pCAAAfrMSolidTorusStr,"CAAAfrTorusHdr");
    
            NewAccess(CATCmdStarter,pCAAAfrMSolidCylinder1Str,CAAAfrMSolidCylinder1Str);
            SetAccessNext(pCAAAfrMSolidTorusStr,pCAAAfrMSolidCylinder1Str);
            SetAccessCommand(pCAAAfrMSolidCylinder1Str,"CAAAfrCylinder1Hdr");
                
            NewAccess(CATCmdStarter,pCAAAfrMSolidCylinder2Str,CAAAfrMSolidCylinder2Str);
            SetAccessNext(pCAAAfrMSolidCylinder1Str,pCAAAfrMSolidCylinder2Str);
            SetAccessCommand(pCAAAfrMSolidCylinder2Str,"CAAAfrCylinder2Hdr");
    ...

    The Insert menu command container is created, even if it already exists. Then the Solids submenu command container is created and set as the child of the Insert menu command container. Since no other positioning information is given, it should lay below the last submenu or command of the workshop menu bar, that is the Plane command. Then the Cuboid command starter is created and set as the child of the Solids submenu command container, and the others are cretaed and set next of one another.

    Insert Menu - Surfaces Submenu

    ...
          NewAccess(CATCmdContainer,pCAAAfrSurfacicEltSnu,CAAAfrSurfacicEltSnu) ;
          SetAccessNext(pCAAAfrSolidEltSnu,pCAAAfrSurfacicEltSnu);
    
            NewAccess(CATCmdStarter,pCAAAfrMSurfRevolStr,CAAAfrMSurfRevolStr);
            SetAccessChild(pCAAAfrSurfacicEltSnu,pCAAAfrMSurfRevolStr);
            SetAccessCommand(pCAAAfrMSurfRevolStr,"CAAAfrRevolSurfHdr");
    
            NewAccess(CATCmdStarter,pCAAAfrMSurfNurbsStr,CAAAfrMSurfNurbsStr);
            SetAccessNext(pCAAAfrMSurfRevolStr,pCAAAfrMSurfNurbsStr);
            SetAccessCommand(pCAAAfrMSurfNurbsStr,"CAAAfrNurbsSurfHdr");
    
            NewAccess(CATCmdStarter,pCAAAfrMSurfOffsetStr,CAAAfrMSurfOffsetStr);
            SetAccessNext(pCAAAfrMSurfNurbsStr,pCAAAfrMSurfOffsetStr);
            SetAccessCommand(pCAAAfrMSurfOffsetStr,"CAAAfrOffsetSurfHdr");
    ...

    The Surfaces submenu command container is created and set next to the Solids submenu command container. Then the Revolution Surface command starter is created and set as the child of the Surfaces submenu command container, and the others are cretaed and set next of one another.

    The menu and submenu resources, and how to provide them, are described in Creating Resources for Workbenches. See also Providing the Resources and Inserting the Workbench into the Start Menu for an overview of all the resources to create.

[Top]

Providing the Resources and Inserting the Workbench into the Start Menu

You should provide the resources for the workbench and for all its contents. These resources are classified as follows:

More about Internationalization and resources can be found in Internationalizing Your Client Application.

 

[Top]

Creating the Workbench Exposed Interface

To enable client applications of your workbench to customize it with add-ins, you should provide the CAAIAfrGeoCreationWkbAddin interface the client application will implement. This enables the client application to add its own commands in one or several new toolbars.

The header file of this interface should be inserted in the ProtectedInterfaces or PublicInterfaces directory of your framework to make it available to client applications. To create the CAAIAfrGeoCreationWkbAddin interface:

The CATDeclareInterface and CATImplementInterface macros make an interface from this C++ class.

[Top]


Troubleshooting

A Command Doesn't Display in the Menu Bar or Toolbar

symptom.gif (111 bytes) I create a command starter for a command, and I arrange it in the menu bar or in a toolbar, but the command doesn't display in the menu bar or toolbar where I place it.
diagnos.gif (130 bytes) The command starter is not associated with a command header, and is thus not displayed, since the command cannot be launched without command header.
solution.gif (218 bytes) Check your CreateWorkbench method. The command starter must be associated with a command header for the command you want to display thanks to the SetAccessCommand macro.

[Top]


In Short

A workbench gathers tools, that is commands you develop or pick-up among those existing to work on documents of a given type. A workbench is part of the workshop for that document type and can be selected from the Start menu.

Then you create the workbench files, declare the implemented interfaces CATIxxxConfiguration and pppIxxxWorkbenchFactory, where ppp is the prefix of your application (such as CAT for CATIA), and xxx is the name of your workbench, and the workbench factory, in the dictionary. You have to declare the headers of the commands you want to propose, arrange them in menus and toolbars, and create the necessary external resources. Your wokbench is ready to use.

You can create different workbenches in a workshop. Each workbench shares with the other workbenches the ability to work on your document, and usually shares with them a set of common commands. Each workbench gathers commands dedicated for specific process and one workbench can be activated by the end user at a time using the Start menu.

You should also provide the IxxxAddin interface with your workbench, where xxx is the name of your workbench, to enable client applications to customize it by adding new toolbars.

[Top]


References

[1] About Globally Unique IDentifiers
[2] Object Modeler Component and Implementation Inheritances
[3] Warm Start Incremental Backup
[Top]

History

Version: 1 [Jan 2000] Document created
Version: 2 [Sep 2003] Warm start Integration
[Top]

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