Mechanical Modeler

Freezing Internal Copy With Link

Using CATIMmiResultFreeze

 
Technical Article

Abstract

This article shows how to freeze internal copies with link


What is freezing

An internal copy with link is obtained by copying and pasting a mechanical feature (as result with link) inside the same CATPart. It may also be obtained from CATMmrInterPartCopy [1] (inside a CATPart, option with link). The internal copy is a feature which has a geometrical result copied from the original feature.

Fig.1: Point.2 is a copy of Point.1
 

When the original feature is modified, the update mechanism [2] will copy the geometry of the copied feature to the internal copy.

In some cases the user may want to update the part while keeping the geometry of some internal copies : this is called freezing the internal copy.

When an internal copy is frozen, the original feature may be modified without impacting the geometry of the internal copy.

The concept of freezing is different from the concept of deactivating (described in [3] : deactivating is equivalent to a temporary deletion). If an internal copy is freezed its geometry still exists, and is always displayed in 3D viewer.

However the "deactivate command" (from the contextual submenu) which normally performs a deactivation for all features, has a different behavior for internal copies : it performs freezing. The mask of frozen internal copies is the same mask as a deactivated feature : an opening and a closing bracket [Fig. 2].

Fig.2: A Point and its copy after freezing

[Top]

How to freeze and unfreeze

The interface CATIMmiResultFreeze must be called on the internal copy : its type may be a point, a line, a surface, a plane, volume or a solid.

Here is the way to freeze the internal copy feature:

...
CATIMmiResultFreeze * pIFreezeOnInternalFeature = ... ;

pIFreezeOnInternalFeature->Freeze();
CATBoolean  status = pIFreezeOnInternalFeature ->IsFrozen(); // status is TRUE
}
...
    

Here is the way to unfreeze the internal copy feature: Note that after unfreezing, the geometry does not change : an update of the copy must be called to synchronize the geometry.

...
CATIMmiResultFreeze * pIFreezeOnInternalFeature = ...
CATISpecUpdate      * pISpecUpdateOnInternalFeature = ..... ;

pISpecUpdateOnUnFeature->Unfreeze();
CATBoolean  status = pIFreezeOnInternalFeature ->IsFrozen(); // status is FALSE
pISpecUpdateOnUnFeature ->Update();
...

[Top]


Changing Reference

Changing the reference of an internal copy with link can be done using the CATIMmiInternalCopyWithLinkEdition interface. Any object that implements to CATIMmiInternalCopyWithLink implements to the CATIMmiInternalCopyWithLinkEdition interafce too. However, changing the reference of an internal import is only available for solid internal copies for now.

CASE1: The most simple example explained visually

Fig.3 Before the Change
 

On the pictutre just above you can see Solid.1 (highlighted feature) an (internal) copy of PartBody. The Solid.1 geometry is a copy of the PartBody geometry. (it is not visible on the picture, but there are two pad (Pad.1 and Solid.1, this last is highlighted) at the same place)

Fig.4 After the Change

On the picture just above, you can see the result of the change of reference for Solid.1. Body.2 (containing triangle pad) is the new reference for Solid.1. Now the Solid.1 geometry is a copy of the Body.2 geometry. (it is not visible on the picture, but there are two pad (Pad.2 and Solid.1, this last is highlighted) at the same place)

Using the Replace Viewer

Client scenarios are rarely so simple. As stated earlier, when an internal copy is created, its geometry is a copy of the geometry of its reference.

Sub elements of the geometry of the internal copy can be used to build other features. These features are therefore children of the internal copy. When the reference of an internal copy is changed, its geometry changes too. The old copied geometry is replaced with a copy of the geometry of its new reference. Children features that were based on sub elements of the old copied geometry cannot automatically be replugged on sub elements of the new copied geometry. In order to do so, user intervention is needed.

The user will have to specify, via the Replace Viewer, on which sub elements of the new geometry these children have to be rerouted. If this is not done, the features that referenced sub elements of the internal copy will not be able to update themselves correctly.

CASE2: Changing the reference in a interactive context with the help of the Replace Viewer

Fig.5 Before the Change

Just above you can see Solid.1 an internal copy of PartBody (containing Pad.1). Based on Solid.1 a fillet (EdgeFillet.1) has been created.

Now you replace the initiale reference of Solid.1(PartBody) by Body.2. Changing its reference to Body.2 would mean that Solid.1 will then be based on the geometry contained in Body.2. The EdgeFillet cannot automatically replug itself on any Edge of the new geometry. Therefore user intervention is required.

Fig.6 The Replace viewer

Thanks the Replace viewer the end user can choose an edge on the new geometrie of Solid.1 to be the input of the EdgeFillet.

Fig.7 New Edge Selection

The edge was defined by 2 faces on the old geometry (left-hand side). The user now has to select the 2 faces that define the edge on the new geometry (right-hand side).

Fig.8 Re-root is done

When the end user closes the dialog box, EdgeFillet.1 is correctly defined. There is no update error.

Without Using the Replace Viewer

For an interactive command you have the choice to use or not the Replace viewer for manual re-rooting. In batch mode, the Replace viewer has no sense, it will be never launched. So, if after the replace a manual re-root is necessary, and that it cannot be done, it could imply update error for some internal copy children.

Fig.9 Change without a re-root

On the picture just above, you can see the result of the change of reference of Solid.1 from PartBody (box) to Body.2 (triangle). The replace has been successful, but an input of EdgeFillet.1, based on Solid.1 whose the geometry has changed, is a none-existant edge. So it implies an update error for the EdgeFillet.1 feature (see update error icon). The edgefillet is not geometrically represented.

The user will then have to solve these errors manually through the update error panel.

How Does it Work?

The CATIMmiInternalCopyWithLinkEdition interface contains one method, SetSelected, whose the arguments are:

As of today, the SetSelected method only works on Solid feature [5]. By consequence the new reference feature can only be an hybrid body [6], a feature implementing the CATIMechanicalTool interface.

This boolean has no sense in a batch, in this case the value will be not taken into account. But inside an interactive command, if the value is true, and if a manual re-root is required, the Replace viewer will be launched. This viewer is a shared state command. It de-activates your command, and when the end use closes the dialog box, your command is re-activated.

The SetSelected returns E_FAIL and a CATError (that you retrieve using CATGetLastError ) when the method fails. The kind of error can be :

Error Id Meaning
101 Cannot change the reference of an internal copy to a NULL object.
102 The reference of the given internal copy cannot be changed. Only solid internal imports can be changed.
103 The internal copy is frozen. Its reference cannot be changed as longs it is frozen.
201 Cannot create a Specification with a NULL object.
202 Failed to retrieve keys and accesses of given object.
203 Failed to create Specification.
204 Failed to generate the list of Inputs for the given Specification.
205 Cannot create a Link with a NULL object.
206 Link creation failed.
301 No matching Input found on given Specification
405 Failed to set Link on given Input.

and returns

[Top]


In Short

While an internal copy feature is unfreezed (default behavior), if the geometry of the original feature is modified, the geometry of the copied feature is automatically modified too. Freezing an internal copy allows you to temporarily disable this update.

Just after the internal copy feature unfreezing, do not forget to update the internal feature: unfreeze api does not launch the update mechanism. Then, the next modifications on the original feature will be automatically take into account in the copied feature.

You can check the CATIMmiResultFreeze usage in the dedicated interactive use case [4].

The CATIMmiInternalCopyWithLinkEdition interface enables you to change the reference feature.

[Top]


References

[1] Copying Mechanical Features
[2] Specification/Result Mechanism Applied to Mechanical Features
[3] Enabling the Build Deactivation
[4] Freezing or Unfreezing Internal Copy
[5] The Contents of the Specification Container - Geometrical Features
[6] The Contents of the Specification Container - Geometrical Features Sets
[Top]

History

Version: 1 [Feb 2007]Document created
[Top]

Copyright © 1999-2006, Dassault Systèmes. All rights reserved.
Special Notices CAA V5 CATIA | CAA V5 DELMIA | CAA V5 ENOVIA