Mechanical Modeler |
Verifying the Combined Curve's Sub-Element SelectabilityCreating a Part workshop add-in and verifying the Combined Curve's topological result |
|
Use Case | ||
Creating a New Geometrical Feature: The Combined Curve > Verifying the Combined Curve's Sub-Element Selectability |
AbstractThis article shows how to create an Add-in of the Part document workshop and how to use a mechanical command to verify the cells of the Combined Curve's topological result. |
This use case is intended to show you how to create an add-in of the Part document workshop. This Add-in contains a mechanical command to verify that each cell of the CATBody associated with the Combined Curve can be selected. This article concludes the use case entitled "Building the Combined Curve's Result" [1].
Before getting to this use case, it is important to get an understanding of some of the concepts used, that is, the add-in [2] on one hand, the procedural reports [3], the generic naming [4], and the topological journal [5] on the other hand.
[Top]
CAAMmrDebugPrtWksAddin is a use case of the CAAMechanicalModeler.edu framework that illustrates MechanicalModelerUI framework capabilities.
[Top]
The CAAMmrDebugPrtWksAddin use case consists in an add-in of the Part document workshop. This Add-in contains only one toolbar, the CAA Debug toolbar, which itself contains one command, the Debug Journal command. See Fig.1
The following image Fig. 2 shows the "Debug
Journal" Dialog box when an edge of the
Combined Curve has been selected. This Combined Curve is located in the CAACombinedCurveForReplace
Part document that you will find in the InputData directory of the
CAAMechanicalModeler.edu framework.
The "Debug Journal" Dialog box consists in:
[Edge_1842(body_1758)]<-CREATION-[Vertex_1057(body_1048), Edge_1662(body_1652)] Info=0
The "Debug Journal" command tries to reconstruct the line that could be found in a topological report and adds some information like the tag's body. The previous line can be generalized as following:
[XXX_tagTopo(body_tagTopo)] <-YYY- [XXX_tagTopo(body_tagTopo),
XXX_tagTopo(body_tagTopo)] Info=ZZZ
where in the order:
XXX_tagTopo |
The selected cell. XXX can be Vertex, Edge or Face. tagtopo
is the topological tag of the cell. |
body_ tagTopo |
The body the selected cell comes from. It is not necessarily the current body. |
YYY |
A topological order: CREATION, MODIFICATION, ABSORTION, or SUB-DIVISION |
[] | Inside the brakets the parent(s) of the selected cell |
Info |
A topological information |
If the selected edge is not a followed cell [4] , the "Dump Result Editor" displays :
No Dump : this Cell is not a followed cell. No info shown in the visu.
The options frame enables you:
To keep the displayed information in the right editor after each selection - Fig.3
The Edit editor enables you to enter the topological tag of a cell; the right editor is modified when the Find button is pushed. - Fig.4
The next picture - Fig.3 - shows the role of the options.
In the picture below you can notice that after two selections, there are two graphic representations in the 3D and the "Dump results editor" contains two lines. The two buttons in the "Options" frame are checked.
The next picture shows the role of the "Edit" editor and the "Find" Button.
In the Edit editor, the tag 1058
has been entered. By clicking on
the "Find" button, a text is displayed in the "Dump
results editor"
editor. You notice, that an information indicates that there is no 3D graphic
representation because the cell 1058 comes from an invisible feature. All the
features of the Part, except the combined curve, have been hidden to simplify
the pictures.
[Top]
To launch CAAMmrDebugPrtWksAddin, you will need to set up the build time environment, then compile CAAMmrDebugPrtWksAddin along with its prerequisites, set up the run time environment, and then launch CATIA [6].
(*) The file is located in the directory CAAMechanicalModeler.edu/InputData
InstallRootDirectory/CAAMechanicalModeler.edu/InputData
InstallRootDirectory\CAAMechanicalModeler.edu\InputData
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
[Top]
The CAAMmrDebugPrtWksAddin use case is made of a single class, CAAMmrDebugAdn, located in the CAAMmrDebugPrtWksAddin.m module of the CAAMechanicalModeler.edu framework:
Windows | InstallRootDirectory\CAAMechanicalModeler.edu\CAAMmrDebugPrtWksAddin.m\ |
Unix | InstallRootDirectory/CAAMechanicalModeler.edu/CAAMmrDebugPrtWksAddin .m/ |
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
[Top]
Implementing the CATIPrtWksAddin can be divided in three steps:
[Top]
The CAAMmrDebugAdn class is the implementation of the CATIPrtWksAddin addin. The contents of the CAAMmrDebugAdn.h file is the following:
... #include "CATBaseUnknown.h" class CATCmdContainer; class CAAMmrDebugAdn: public CATBaseUnknown { CATDeclareClass; public: CAAMmrDebugAdn(); virtual CAAMmrDebugAdn(); void CreateCommands(); CATCmdContainer * CreateToolbars(); private : CAAMmrDebugAdn(const CAAMmrDebugAdn &iObjectToCopy); CAAMmrDebugAdn& operator = (const CAAMmrDebugAdn &iObjectToCopy); }; ... |
Like any Add-in implementation classes, the CAAMmrDebugAdn class contains the CreateCommands
method to create the command header instances and the CreateToolbars
method to create the toolbars
and arrange the commands inside them.
[Top]
The contents of the CAAMmrDebugAdn.cpp file can be divided in three parts:
#include "CAAMmrDebugAddin.h" #include "CATCreateWorkshop.h" #include <TIE_CATIPrtWksAddin.h> TIE_CATIPrtWksAddin(CAAMmrDebugAdn); CATImplementClass(CAAMmrDebugAdn, DataExtension, CATBaseUnknown, CAAMmrDebugAddin); ... |
The CAAMmrDebugAdn class states that it implements the CATIPrtWksAddin
interface thanks to the TIE_CATIPrtWksAddin
macro. The CATImplementClass
macro declares that the CAAMmrDebugAdn
class is a data extension, thanks to the DataExtension
keyword,
that extends CAAMmrDebugAddin. The third argument must always be set as CATBaseUnknown
or CATNull for any kind of extension.
Next, update the interface dictionary, that is a file named, for example, CAAMechanicalModeler.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 CAAMmrDebugAddin component implements the CATIPrtWksAddin interface, and whose code is located in the libCAAMmrDebugPrtWksAddin shared library or DLL.
... CAAMmrDebugAddin CATIWorkbenchAddin libCAAMmrDebugPrtWksAddin CAAMmrDebugAddin CATIPrtWksAddin libCAAMmrDebugPrtWksAddin ... |
The CAAMmrDebugAddinHeader class is created by the MacDeclareHeader macro.
... #include "CATCommandHeader.h" MacDeclareHeader(CAAMmrDebugAddinHeader); void CAAMmrDebugAdn::CreateCommands() { new CAAMmrDebugAddinHeader("CAAMmrDebugJournalHdr", "CATMmuDebugCAA", "CATMmuDebugCAA", (void *)NULL); } ... |
The CreateCommands
method contains one instance of the CAAMmrDebugAddinHeader
class. The constructor arguments are:
- CAAMmrDebugJournalHdr: The identifier of the header - It will be used in the resources files
- CATMmuDebugCAA: The name of the library containing the mechanical command
- CATMmuDebugCAA : The mechanical command
- NULL: The CATMmuDebugCAA command has no argument
This Part workshop add-in contains only one toolbar, the "CAA Debug" toolbar.
... CATCmdContainer *CAAMmrDebugAdn::CreateToolbars() { NewAccess(CATCmdContainer, pCAAMmrDebugTlb, CAAMmrDebugTlb); NewAccess(CATCmdStarter, pCAAMmrDebugJournalStr, CAAMmrDebugJournalStr); SetAccessCommand(pCAAMmrDebugJournalStr, "CAAMmrDebugJournalHdr"); SetAccessChild(pCAAMmrDebugTlb, pCAAMmrDebugJournalStr); AddToolbarView(pCAAMmrDebugTlb, -1, Right); return pCAAMmrDebugTlb; } |
The identifier of the "CAA Debug" toolbar is CAAMmrDebugTlb
.
This toolbar is declared invisible thanks to the second argument of the AddToolbarView
set to -1
( 1
would make it visible) at the first add-in loading.
This toolbar
contains only one starter
which is named CAAMmrDebugJournalStr
.The CAAMmrDebugJournalHdr
header command instance is associated with this starter thanks to the SetAccessCommand
macro.
[Top]
The resource files are located in the CAAMechanicalModeler.edu\CNext\resources directory.
The CAAMmrDebugAddinHeader.CATNls contains the following lines:
... CAAMmrDebugAddinHeader.CAAMmrDebugJournalHdr.Title = "Debug Journal"; CAAMmrDebugAddinHeader.CAAMmrDebugJournalHdr.ShortHelp = "Debug Journal"; CAAMmrDebugAddinHeader.CAAMmrDebugJournalHdr.Help = "Debug Journal" ; CAAMmrDebugAddinHeader.CAAMmrDebugJournalHdr.LongHelp = "Debug Journal" ; CAAMmrDebugAddinHeader.CAAMmrDebugJournalHdr.Category = "Tools" ; ... |
The CAAMmrDebugAddinHeader.CATRsc contains the following lines:
... CAAMmrDebugAddinHeader.CAAMmrDebugJournalHdr.Icon.Normal = "I_CAAMmrDebugJournal"; ... |
I_CAAMmrDebugJournal ( ) is the name of the icon representing the Debug Journal command. You retrieve it in the CAAMechanicalModeler.edu\CNext\resources\graphic directory.
For details about the command header resources, refer to the technical article [7]
The CAAMmrDebugAdn.CATNls contains the following lines:
CAAMmrDebugTlb.Title = "CAA Debug"; |
For details about the toolbar resources, refer to the technical article [8]
[Top]
This use case illustrates how to create a Part workshop Add-in and how to use a mechanical command to verify the selection of each cell of the CATBody associated with the combined curve.
[Top]
Version: 1 [Fev 2003] | Document created |
[Top] |
Copyright © 2003, Dassault Systèmes. All rights reserved.