Mechanical Modeler

Creating an Add-in in the Shape Design Workbench

Customize your application to fully take advantage of this new feature
Use Case

Creating a New Geometrical Feature: the Combined Curve >Creating an Add-in in the Shape Design Workbench


Abstract

This use case completes the Shape Design Workbench by adding a new toolbar containing a new command corresponding to Combined Curve Creation.


What You Will Learn With This Use Case

This use case creates a new toolbar in the Shape Design workbench to present a Combined Curve creation icon.

Thanks to this Use Case, the newborn Combined Curve Mechanical Feature is now fully integrated with other Shape Design Features.

[Top]

The CAAMmrCombinedCurveAddIn Use Case

CAAMmrCombinedCurveAddIn is a use case of the CAAMechanicalModeler.edu framework that illustrates MechanicalModeler framework capabilities.

[Top]

What Does the CAAMmrCombinedCurveAddIn Use Case Do

This use case creates an add-in implementing the CATIShapeDesignWorkshopAddin interface. This interface is precisely defined to add toolbars or commands to the Shape Design workbench.

Another use case describes in detail how to create an add-in [1].

[Top]

How to Launch CAAMmrCombinedCurveAddIn

See the section entitled "How to Launch the Combined Curve Use Case" in the "Creating a New Geometrical Feature: The Combined Curve" use case for a detailed description of how this use case should be launched.

[Top]

Where to Find the CAAMmrCombinedCurveAddIn Code

The CAAMmrCombinedCurveAddIn use case is made of a several classes located in the CAAMmrCombinedCurveAddIn.m module of the CAAMechanicalModeler.edu framework:

Windows InstallRootDirectory\CAAMechanicalModeler.edu\CAAMmrCombinedCurveAddIn.m\
Unix InstallRootDirectory/CAAMechanicalModeler.edu/CAAMmrCombinedCurveAddIn.m/

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

[Top]

Step-by-Step

To create the add-in, you should first create a separate module directory to store the add-in code. This is CAAMmrCombinedCurveAddIn.m for this use case.

In this module, you have to:

[Top]

Creating the Add-in Description Class

The add-in extends the CAAMmrCombinedCurveAddin late type to implement the interface CATIShapeDesignWorkshopAddin.

CATImplementClass(CAAEMmrCombinedCurveAdn,
                  DataExtension,
                  CATBaseUnknown,
                  CAAMmrCombinedCurveAddin);

#include <TIE_CATIShapeDesignWorkshopAddin.h> // needed to tie the implementation to its interface
TIE_CATIShapeDesignWorkshopAddin(CAAEMmrCombinedCurveAdn);

Do not forget to update your dictionary. CAAMmrCombinedCurveAddin is extended to implement CATIShapeDesignWorkshopAddin.

[Top]

Creating the Command Header

The MacDeclareHeader macro creates the header file and the source file for the CAAEMmrCombinedCurveAdnHeader class, and associates with this class the resource files CAAEMmrCombinedCurveAdnHeader.CATNls and CAAEMmrCombinedCurveAdnHeader.CATRsc.

// Creates the CAAEMmrCombinedCurveAdnHeader command header class
MacDeclareHeader(CAAEMmrCombinedCurveAdnHeader);

To create the Command Header, use the CreateCommands method:

void CAAEMmrCombinedCurveAdn::CreateCommands()
{
  new CAAEMmrCombinedCurveAdnHeader("CAAMmrCombinedCurveHdr",
                                    "CAAMmrCombinedCurveUI",
                                    "CAAMmrCombCrvPanelStCmd",
                                    (void *)NULL );
}

The CAAMmrCombCrvPanelStCmd class enables to create or edit an Combined Curve feature. You can refer to the "Editing Combined Curves" use case [2] for details about this command class.

[Top]

Creating the Toolbar and Arranging the Command

Finally, we'll create the toolbar and arrange the command. This is the job of the CreateToolbars method.

CATCmdContainer* CAAEMmrCombinedCurveAdn::CreateToolbars()
{
    NewAccess        ( CATCmdContainer  , pCombinedCurveWkb , CAAMmrCombinedCurveTlb );
    
    NewAccess        ( CATCmdStarter    , pCombinedCurve    , CAAMmrCombinedCurveStr );
    SetAccessCommand ( pCombinedCurve    , "CAAMmrCombinedCurveHdr" );
    SetAccessChild   ( pCombinedCurveWkb , pCombinedCurve  );
    
    AddToolbarView   ( pCombinedCurveWkb , -1 , Right ); 
    
    return pCombinedCurveWkb;
}

Once again, refer to the use case describing how to create an add-in [1] to get more details: for example about these macros and how insert the command in the menu bar.

[Top]

Providing the Resources

You should provide the resources for the toolbar and for all its commands.

[Top]


In Short

Thanks to the Add-in technology, this last use case of the Combined Curve Use Case makes it possible to create a Combined Curve by Clicking on an icon of the Shape Design Workbench. Combined Curve are now perfectly integrated among V5 Mechanical Design Applications.

[Top]


References

[1] Creating an Add-in
[2] Editing Combined Curves
[Top]

History

Version: 1 [Mar 2000] Document created
Version: 2 [Jan 2003] Document updated
[Top]

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