Mechanical Modeler |
Creating an Add-in in the Shape Design WorkbenchCustomize 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 |
AbstractThis use case completes the Shape Design Workbench by adding a new toolbar containing a new command corresponding to Combined Curve Creation. |
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]
CAAMmrCombinedCurveAddIn is a use case of the CAAMechanicalModeler.edu framework that illustrates MechanicalModeler framework capabilities.
[Top]
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]
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]
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]
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]
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]
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]
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; } |
NewAccess
macro. pCombinedCurveWkb
is the variable used to handle the CombinedCurve toolbar command container
instance pointer, and CombinedCurve
is the identifier used to
refer to it in the add-in resource files.AddToolbarView
macro, where -1
means that the toolbar is invisible by default
(1
means visible), and Right
means that the
toolbar is docked at the right side of the application window.
NewAccess
macro. pCombinedCurve
is the variable used to handle a pointer to that instance, and CAAMmrCombinedCurveStr
is its identifier.
SetAccessCommand
macro.
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]
You should provide the resources for the toolbar and for all its commands.
CAAEMmrCombinedCurveAdnHeader.CombinedCurve.Icon.Normal = "CAAMmr_I_CombinedCurve"; |
You provide the "normal" icon. It must be located in the resources/graphic directory. The pressed and focused are automatically generated. |
CAAEMmrCombinedCurveAdnHeader.CombinedCurve.Title = "CombinedCurve"; CAAEMmrCombinedCurveAdnHeader.CombinedCurve.ShortHelp = "CAAMmrCombinedCurve"; CAAEMmrCombinedCurveAdnHeader.CombinedCurve.Help = "Creates a Combined Curve"; CAAEMmrCombinedCurveAdnHeader.CombinedCurve.LongHelp = "Combined Curve using two curves and two directions"; CAAEMmrCombinedCurveAdnHeader.CombinedCurve.Category = "Insert"; |
If you want to provide help for this new command in several languages, just copy (and translate!) this file in CNext\Resources\msgcatalog\German for German, CNext\Resources\msgcatalog\Japanese for Japanese, CNext\Resources\msgcatalog\French for French, etc.
[Top]
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]
[1] | Creating an Add-in |
[2] | Editing Combined Curves |
[Top] |
Version: 1 [Mar 2000] | Document created |
Version: 2 [Jan 2003] | Document updated |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.