Mechanical Modeler

Verifying the Combined Curve's Sub-Element Selectability

Creating 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

Abstract

This 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. 


What You Will Learn With This Use Case

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]

The CAAMmrDebugPrtWksAddin Use Case

CAAMmrDebugPrtWksAddin is a use case of the CAAMechanicalModeler.edu framework that illustrates MechanicalModelerUI framework capabilities.

[Top]

What Does CAAMmrDebugPrtWksAddin Do

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

Fig.1: The Debug Journal Command in the "CAA Debug" Toolbar

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.

Fig.2: Edge Selection

The "Debug Journal" Dialog box consists in:

The next picture - Fig.3 - shows the role of the options. 

Fig.3: Keep Infos in Visu and in Editor

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.

Fig.4: Selection by a Topological Tag

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]

How to Launch CAAMmrDebugPrtWksAddin 

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

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

[Top]

Where to Find the CAAMmrDebugPrtWksAddin Code

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]

Step-by-Step

Implementing the CATIPrtWksAddin can be divided in three steps:

  1. Creating the Add-in Class Header
  2. Creating the Add-in Source File
  3. Creating the Resource Files

[Top]

Creating the Add-in Class Header

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]

Creating the Add-in Source File

The contents of the CAAMmrDebugAdn.cpp file can be divided in three parts:

  1. Declaring the CATIPrtWksAddin implementation
  2. Creating the CAAMmrDebugAddinHeader command header
  3. Creating the CAA Debug toolbar and arranging the command
  1. Declaring the CATIPrtWksAddin implementation
  2. #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
    ...
  3. Creating the CAAMmrDebugAddinHeader command header
  4. 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:

  5. Creating the CAA Debug toolbar and arranging the command
  6. 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]

Creating the Resource Files

The resource files are located in the CAAMechanicalModeler.edu\CNext\resources directory. 

[Top]

 


In Short

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]


References

[1] Building the Combined Curve's Result
[2] Creating an Add-In
[3] Integrating a New Geometrical Feature in the Update Mechanism
[4] Generic Naming Overview
[5] Topology Concepts
[6] Building and Launching a CAA V5 Use Case
[7] Creating Resources for Command Headers
[8] Creating Resources for Workshops and Workbenches
[Top]

History

Version: 1 [Fev 2003] Document created
[Top]

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