Mechanical Modeler |
Integrating a New Mechanical Feature in V5Implementing appropriate interfaces to integrate a new feature deriving from an existing Mechanical StartUp |
|
Technical Article |
AbstractThis article describes the interfaces that need to be implemented in order to integrate a new mechanical feature in the basic behaviors. Note that a generic article describing the integration of new features defined from "scratch" [1] already exists.
|
The "Creating a New StartUp from a Mechanical StartUp" article [2] has explained how to create a new mechanical feature. The new feature can only derive from the following StartUps:
All these features derive from the MechanicalFeature StartUp.
This document takes into account a certain number of basic behaviors that need to be considered whenever you create a new mechanical feature.
The CATIBuild (ObjectSpecsModeler) interface allows the re-calculation of
a feature's results. It is mandatory to implement this interface in order to
integrate the feature in the update process whose execution is
triggered by the Update
method of the CATISpecObject
interface.
If the new feature derives from MechanicalFormFeature, it should also implement
the CATIBuildShape (MecModInterfaces) interface. This interface is called by the Build
method of the CATIBuild interface.
The CATIMechanicalProperties interface (MecModInterfaces) manages the activate or
de-activate state of the feature in the update mechanism.
This interface is implemented on the MechanicalFormFeature,
the MechanicalContextualFeature and the GSMGeom StartUps, so if your StartUp
derives from one of those StartUps, you have nothing to implement. For feature deriving
from the GeometricalElement3D StartUp, there is no default implementation, but
since the V5R15 you have the possibility to implement CATIMechanicalProperties
. Nevertheless if your feature is a datum ( the IsADatum
method
of the
CATIMf3Dbehavior
interface returns S_OK
) it is useless.
For a solid feature (deriving from MechanicalFormFeature or MechanicalContextualFeature), the Mechanical Modeler engine does not invoke the build if the CAA feature is de-activated. For a surfacic feature, it does it. So if your feature derives from GSMGeom, you have necessary to take the state into account in your CATIBuild implementation, but for a feature deriving from GeometricalElement3D, you should do it only if you have implemented the CATIMechanicalProperties interface.
The "Integrating a New Geometrical Feature in the Update
Mechanism" article [3] explains
the implementation of the Build
method.
The CATIReplace interface (ObjectSpecsModeler) allows to replace the value of one attribute by another object. You should implement it for features deriving from GeometricalElement3D, MechanicalFormFeature and MechanicalContextualFeature. A default implementation exists for the features deriving from GSMGeom.
To validate an applicant for a replace operation, two cases have to be to considered:
You should implement the CATIAttrBehavior interface (ObjectSpecsModeler) to provide a list of interfaces implemented by the suitable applicant for a replace operation.
The easier solution is to implement the CATIReplace through its
adaptor class, CATSpecReplaceExt. In its IsElementValidForReplace
method you call the same method as those of the CATSpecReplaceExt
class. In this case, you
have only to implement the CATIAttrBehavior
interface (ObjectSpecsModeler) to provide a list of interfaces implemented by
the suitable applicant for a replace operation. Otherwise, the
information can be set directly in your IsElementValidForReplace
method, and the
implementation of the CATIAttrBehavior
interface is not necessary.
Implement the CATIReplaceUI interface (InteractiveInterfaces) enables the selection to be filtered during the Replace command.
At last, if you implement the CATIReplacable interface (InteractiveInterfaces), you can prevent the replacement of a given attribute. You implement this interface only in some specific cases.
Refer to the Mechanical use case entitled "Modifying Combine's Curve Specifications" [4] for a detailed example on the replacement process integration.
The CCP and delete operations are managed by the CATICutAndPastable and LifeCycleObject interfaces (ObjectModelerBase). You do not have to implement these two interfaces. They are already implemented by all mechanical features.
The CATICutAndPastable interface calls the CATIMechanicalCCP interface (MechanicalModeler) to know if the copy and the delete operations are authorized. The default CATIMechanicalCCP implementation authorizes these two operations. You can implement this interface to change this default behavior.
The interactive commands (Cut, Copy, Paste and Delete) call the CATICCPable (InteractiveInterfaces) interface to know if the copy and the delete operations are authorized in the interactive context. In case of wrong operation, a dialog box displays a message. The default CATICCPable implementation calls the CATIMechanicalCCP interface. You can, for example, implement this interface to prevent the end user to delete (interactively) your features, whereas the software delete operation is authorized, or you can implement it to display a specific NLS message.
For a solid feature, i.e. feature deriving either from MechanicalFormFeature or MechanicalContextualFeature, there is also the CATIShapeFeatureProperties interface (MechanicalModeler). This interface enables you, among other things, to retrieve the sketches to be deleted or copied with the solid feature deletion of copy. You are advised to implement it.
Read the Part Design use case entitled "Implementing the Cut/Copy/Paste Behavior for Mechanical Design Features" for a detailed sample of the CATIShapeFeatureProperties and CATIMechanicalCCP implementations.
The integration of a geometrical feature inside an ordered set [14] is based on the CATIInputDescription (InteractiveInterfaces) interface. This interface only relates to the surfacic features [5], in other words to the CAA StartUp deriving from GeometricalElement3D or GSMGeom. Its implementation can be sometimes useless, but to avoid implicit code, it is strongly recommended to implement it for your StartUps deriving from these two kinds of StartUps. It is the reason why CATIInputDescription appears as mandatory in the In Short section. The 'Creation versus Modification (Absorbent) Feature' section of the referenced article [5] gives you all the keys to understand its implementation.
For the solid features [5] you do not have to implement this interface.
The main interface to consider is CATIMf3DBehavior. This interface declares the type of the mechanical feature: is it a solid, surfacic or datum feature? There are exclusive behaviors. In case of surfacic feature, if it is a volumic feature, you could have to take the CATIMf3DBehavior2 interface into account.
Your StartUp derives either from the MechanicalFormFeature or the MechanicalContextualFeature Startup. In this case, you have nothing to do, your feature is natively a solid feature. The default implementation of the CATIMf3DBehavior interface specifies that the feature is a solid feature.
Your StartUp derives either from the GSMGeom or the GeometricalElement3D StartUp. If your StartUp derives from GSMGeom, you may implement the CATIMf3DBehavior interface on your StartUp; it is not mandatory, because the default implementation is valid. In other hand, if your feature derives from GeometricalElement3D, you must implement it.
In the two cases, the IsAShape
method should return S_OK, and
IsASolid
and IsADatum
should return E_FAIL. You can you refer to the Combined Curve sample [15].
A volume is a feature whose the StartUp derives either from the GSMGeom or the GeometricalElement3D
StartUp. The IsAVolume
method of the CATIMf3DBehavior2
interface must in this case return S_OK. You must implement the CATIMf3DBehavior2 interface,
since the default implementation of the IsAVolume
method returns
E_FAIL. Check that the IsAShape
method of CATIMf3DBehavior
return S_OK.
Your StartUp derives from the GeometricalElement3D StartUp. You must
implement the CATIMf3DBehavior
interface. IsADatum
method returns S_OK, IsASolid
and IsAShape
return E_FAIL.
The CATIAlias interface (ObjectModelerBase) manages the persistence of a feature's name. This interface is already implemented by the mechanical features and its re-implementation is not necessary.
Editing a feature occurs through a dialog box that is displayed upon either double-clicking on the feature, right clicking on the feature to display its contextual menu and selecting the "Definition" command in the sub-menu section. The dialog box contains the attribute values for the selected feature that can be modified. This editing ability is managed by the CATIEdit interface (ApplicationFrame).
When the CATIEdit interface is implemented on a feature, it is also possible to expand the contextual sub-menu with new commands: simply implement the CATIContextualSubMenu interface (ApplicationFrame). Except for the GSMGeom feature, there is no default implementation for this latter interface. Refer to the use case entitled "Adding a Contextual Sub-Menu" [12] for an example of implementation.
Read the Mechanical use case entitled "Editing Combine Curves" [6] for a detailed example of the edition process.
Visualizing a feature in the specification tree and enabling further navigation of the feature itself, is managed by the CATINavigateObject interface. This interface is implemented on all natively-defined features, i.e., features defined in applications provided by Dassault Systèmes. This interface's methods return the name of the feature and a list of its children. When a feature is added to the specification tree under an existing node, this parent node must be able to list it as its child. The feature itself must also be capable of listing any of the features it may be pointing to.
For a GSMGeom, the default implementation displays the aggregating CATICkeParm objects and the Material features in the file tree. If your surfacic feature has a type of parameter no displayed (integer for example) you can implement this interface to drive its visible parameters in the file tree.
The CATIIcon (InteractiveInterfaces) interface allows a specific icon to be specified for a given feature. It is not necessary to implement it, you have just to provide an icon, named I_NameofTheFeature. NameofTheFeature being the name of new feature, in other words the forth argument of the CATOsmSUFactory global function. However, you can implement this interface for specific cases.
You can use the methods of CATIRedrawEvent (ObjectModelerBase) to force a refresh of the specification tree whenever a modification has been made.
The GeometricalElement3D feature implements the CATI3DGeoVisu interface. A feature's graphical properties are managed by the CATIVisProperties interface. The CATIModelEvents interface manages sending event notifications when the visualization of the feature has been modified and needs to be refreshed.
These three interfaces (Visualization framework) should not be re-implemented.
The CATIParmPublisher (KnowledgeInterfaces) interface allows the publication of a feature's parameters. A published parameter is displayed in the F(x) command , in the Parameter tab page for Power Copy/User Feature; ... [7].
The default implementation publishes the aggregating CATISpecObject features and the objects implementing the dedicated interface. It is possible to implement this interface to modify the default behavior.
The aim is to find out instances according to a criterion [13]. There are two kinds of criteria:
- General criterion : name, color, visibility, layer, line properties
- Advanced criterion : it is a knowledge criterion (dimension, boolean, ....)
This table shows what are the search limits for a CAA feature:
Interactive code General yes yes Advanced no yes The first column means that your feature cannot be found according to advanced criteria in the Search command. The second column means that you can make research by code whatever the criteria.
If the new feature derives from the GSMGeom StartUp, it is integrated in the CATIAHybridShapes , CATIAReference and CATIReference interfaces.
To create or modify an instance, a VBScript interface must be created - Refer to the "Integrating a New Mechanical Feature in the CAA Exposed Model" use case [8]
There is nothing to do.
A new feature can be an input of a power copy or a user feature [9].
In this section the behavior of the new feature for some interactive commands is given: what is its default behavior, how to have the V5 behavior if any ?
In an interactive session, with the CreateDatum setting, you can create a Dassault Systèmes feature in datum mode [5]. It means that the new instance does not have any geometrical specifications, but only has a topological result. However for the moment, it is impossible to take this parameter into account in a command.
This command is available only for a new feature deriving from GSMGeom.
This command is never available for a new feature.
This command is always available for a new feature.
The catalog document [10] natively integrates the following components:
You can integrate your own type of component, in other words your own feature, by implementing three interfaces: CATICatalogEnable, CATICatalogInstantiation and CATICatalogSynchronize (ComponentsCatalogs framework). Refer to the "Integrating a New Type of Component" use case [11] for an example.
Here is summarized the interfaces which are described just above. For each derivable StartUp, there are sorted with this classification:
The StartUp are the following:
[Top]
Version: 1 [May 2002] | Document created |
Version: 2 [Dec 2002] | Document updated |
Version: 3 [May 2003] | Document updated |
Version: 4 [May 2003] | Document updated for OGS Integration |
Version: 5 [Apr 2004] | Document updated for solid and surfacic features set Integration |
Version: 6 [May 2007] | Document updated for MechanicalSet & MechanicalElement Integration |
[Top] |
Copyright © 2002, Dassault Systèmes. All rights reserved.