Mechanical Modeler |
Creating Combined Curve's CatalogDefining a New StartUp in a catalog |
||
Use Case | |||
Creating a New Geometrical Feature: The Combined Curve > Creating Combined Curve's Catalog |
AbstractThis use case explains how to generate a Catalog file including the Combined Curve Feature's Initial Definition: its StartUp. |
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]
CAAMmrCreateCombCrvCatalog is a use case of the CAAMechanicalModeler.edu framework that illustrates MechanicalModeler framework capabilities.
[Top]
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:
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.
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":
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]
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]
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]
There are six logical sections in the CAAMmrCreateCombCrvCatalog main code:
We will now comment each of those sections by looking at the code.
[Top]
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]
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:
CombinedCurveCatalogStorageName - this is the entire pathname and name of the catalog. This parameter is the same as the one passed to the method that saves the catalog.
piCombinedCurveCatalog - this is the returned CATICatalog pointer to the new catalog that has been created.
[Top]
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]
... 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:
CombinedCurveStartUpType
- the late type of the new StartUp
to be createdpiCombinedCurveCatalog
- the CATICatalog pointer to
the catalog in which the new StartUp will be stored.SuperTypeName
- the type of the derived feature
(GeometricalElement3D)CatalogName
- the name of the catalog which contains the derived feature
(MechMod)publicSU
- precise if the new startup is public or not.
If the StartUp is public a CATSpecs file is also provided.derivableSU
- precise if the new startup is derivable or not
(information not pertinent if the new StartUp is private)It returns piSpecOnCombinedCurveStartUp
, a CATISpecObject
pointer to the new StartUp.
[Top]
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:
Curve1Name- this argument is a CATUnicodeString variable representing the name of the new attribute.
tk_specobject - this is the type of attribute to be added. In this case, the attribute is a referenced feature. [3]
sp_IN - this is the "quality" of the attribute: it is used during the Update process to determine whether this feature is to be re-built or not.
The attributes of the other StartUps are added the same way.
[Top]
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]
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]
[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] |
Version: 1 [Mar 2000] | Document created |
Version: 2 [Jan 2003] | Document updated |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.