Mechanical Modeler

Creating Combined Curve's Catalog

Defining a New StartUp in a catalog 
Use Case
Creating a New Geometrical Feature: The Combined Curve > Creating Combined Curve's Catalog

Abstract

This use case explains how to generate a Catalog file including the Combined Curve Feature's Initial Definition: its StartUp.


What You Will Learn With This Use Case

This use case is intended to help you generate the Catalog file containing the Combined Curve Feature StartUp.

More specifically, the CAAMmrCreateCombCrvCatalog use case shows how to:

[Top]

The CAAMmrCreateCombCrvCatalog Use Case

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

[Top]

What Does CAAMmrCreateCombCrvCatalog Do

The goal of this use case is to generate the Catalog file containing the Combined Curve Feature's StartUp. As described in the technical article entitled "Creating a New StartUp from a Mechanical Feature" [1], the first thing is to define the new StartUp:

  1. Choosing the derived mechanical StartUp
  2. The Combined Curve is a wireframe geometrical object, so we have chosen to derive the CombinedCurve StartUp from the GeometricalElement3D mechanical StartUp. Derive from the GSMGeom StartUp can be also possible, but it is not possible to derive from MechanicalFormFeature and MechanicalContextualFeature since the Combined Curve is not a solid feature. 

    The hieararchy of StartUp is the following:

    In so doing, you will automatically benefit from all standard behaviors already implemented for all geometrical features and more generally for all mechanical features. Refer to the article entitled "Integrating a New Mechanical Feature in V5" [2] for details about the standard behavior of a feature deriving from the GeometricalElement3D StartUp and the interfaces to implement to be fully integrated in V5. 

  3. Defining the attributes of the new feature

Now that you have met the parents of the Combined Curve Feature, you still have to define its own Attributes. Those Attributes will be added to those inherited from its ancestors.

Since a Combined Curve is build using two curves and two directions, it is straightforward to define four new input Attributes: "Curve1", "Direction1", "Curve2" and "Direction2".

These Attributes will be point to four other Features. This means they are of type "tk_specobject". From an update point of view, the input Attributes have to be evaluated before building the Combined Curve. That's why they are IN Attributes ( "sp_IN" type ) [3]

Once the Combined Curve Feature's Inheritance and Attributes have been defined, you are ready to generate the Combined Curve Catalog file that will contain the Combine Feature's initial definition: The Combined Curve Feature "StartUp".

Catalogs are particular files in which StartUp are created, enhanced with new Attributes and stored. These StartUps are then instantiated into run time instances.

Here is a figure representing what the Combined Curve Catalog File will "look like":

Fig.1: Extract of the CAAMmrCombinedCurveCatalog.CATfct file
You can see the Combined Curve Feature StartUp - named "CombinedCurve" - and its four input Attributes, all included in the CAAMmrCombinedCurveCatalog catalog file. This file is located in the CNEXT/resources/graphic directory of the CAAMechanicalModeler.edu framework.

This CAAMmrCombinedCurveCatalog file will be created by a batch, the CAAMmrCreateCombCrvCatalog batch. Refer to the "How to launch theCAAMmrCreateCombCrvCatalog Code" section for details. 

[Top]

How to Launch CAAMmrCreateCombCrvCatalog

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.

The particular part of the use case described in this article is launched by executing the following command:

    mkrun -c "CAAMmrCreateCombCrvCatalog CatalogPath"
where CatalogPath is the directory of the catalog to be created. It is recommended that the new catalog be stored in the CNext + resources + graphic directory of the current framework; then, by updating the runtime view, the catalog will be moved to the runtime directory and will be accessible by subsequent programs. 

[Top]

Where to Find the CAAMmrCreateCombCrvCatalog Code

The CAAMmrCreateCombCrvCatalog use case is made of one module, CAAMmrCreateCombCrvCatalog.m,  found in the the CAAMechanicalModeler.edu framework and containing a single source program, CAAMmrCreateCombCrvCatalog.cpp:

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

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

[Top]

Step-by-Step

There are six logical sections in the CAAMmrCreateCombCrvCatalog main code:

  1. Creating a Path to the Combined Curve Catalog
  2. Creating the Combined Curve Catalog
  3. Adding a Client Identification to the Combined Curve Catalog
  4. Creating the Combined Curve StartUp
  5. Adding Attributes to this Startup
  6. Saving the Combined Curve Catalog

We will now comment each of those sections by looking at the code.

[Top]

Creating a Path to the Combined Curve Catalog

Create a path to the catalog using CATMakePath of CATLib.h. To work properly, this path should point to a resources/graphic directory.

...
const char *pDirName = argv[1];
const char *pFileName = "CAAMmrCombinedCurveCatalog";
char StorageName[200];

CATMakePath( pDirName , pFileName , StorageName );

[Top]

Creating the Combined Curve Catalog

CATUnicodeString CombinedCurveCatalogStorageName = StorageName;
CATICatalog *piCombinedCurveCatalog = NULL;

rc = ::CreateCatalog( &CombinedCurveCatalogStorageName ,
                          &piCombinedCurveCatalog );

Use the CreateCatalog global function to create a new feature catalog. The arguments of this function are:

[Top]

Adding a Client Identification to the Combined Curve Catalog

A catalog file can not be used if it has no client identification.

CATUnicodeString ClientId = "SAMPLES";

rc = piCombinedCurveCatalog->SetClientId( &ClientId );

In order to protect your catalog from unwanted access, you must also assign a client ID to it. This ID is needed in order to open the catalog to retrieve StartUps from it. The client ID is set using the SetClientId method of CATICatalog and passing a CATUnicodeString parameter representing the client ID.

[Top]

Creating the Combined Curve StartUp

    ...
    CATUnicodeString CombinedCurveStartUpType = "CombinedCurve";   
    CATUnicodeString CatalogName = "MechMod" ;
    CATUnicodeString SuperTypeName = "GeometricalElement3D";
    CATBoolean       publicSU = FALSE ;
    CATBoolean       derivableSU = FALSE ;
    CATISpecObject *piSpecOnCombinedCurveStartUp = NULL;

    rc = ::CATOsmSUFactory(&piSpecOnCombinedCurveStartUp,
                           &CombinedCurveStartUpType,
                           piCombinedCurveCatalog,
                           &SuperTypeName,
                           &CatalogName,
                           publicSU,
                           derivableSU) ;
     ...

A new StartUp is created using the CATOsmSUFactory global function( ObjectSpecsModeler framework). This function takes as input:

It returns piSpecOnCombinedCurveStartUp, a CATISpecObject pointer to the new StartUp.

[Top]

Adding Attributes to this StartUp

It is now time to add attributes to the StartUp. An attribute is defined by its name, its type and update mode.

...
CATISpecObject *piSpecOnCombinedCurveStartUp = NULL;
rc = pCombinedCurveStartUp->QueryInterface(IID_CATISpecObject,
                         (void**) &piSpecOnCombinedCurveStartUp);

...
CATUnicodeString Curve1Name = "Curve1";
CATISpecAttribute *piCurve1SpecAttribute =  NULL ;
piSpecOnCombinedCurveStartUp->AddAttribute( Curve1Name,
                                            tk_specobject,
                                            sp_IN);
...

A new attribute of a StartUp is created using the AddAttribute method of CATISpecObject. This method takes the following arguments:

The attributes of the other StartUps are added the same way.

[Top]

Saving the Combined Curve Catalog

rc = ::SaveCatalog(&piCombinedCurveCatalog,
                   &CombinedCurveCatalogStorageName);
...

The Combined Curve Feature's Catalog is now filled in with a Combined Curve Feature's StartUp with its four attributes. This is enough to define the Combined Curve Feature. You can save the Catalog file using the SaveCatalog global function.

[Top]


In Short

This use case has demonstrated how to create and define the Combined Curve Feature's StartUp in a Catalog. This StartUp will later be used to instantiate Combined Curve Instances through a factory interface [4].

[Top]


References

[1] Creating a New StartUp Deriving from a Mechanical StartUp 
[2] Integrating a New Mechanical Feature in V5
[3] Feature Modeler Overview
[4] Creating Combined Curve's Factory Interface
[Top]

History

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

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