Mechanical Modeler |
Managing Applicative Mechanical ImportsUsing CATIMmiMechanicalImportApplicative |
|
Technical Article |
AbstractThis article explains what are the Mechanical Import, how to create them in order to retrieve information on them. |
A mechanical import is a mechanical feature which is the result of the copy of another mechanical feature. You know [1] that in the general case there are three kinds of copy:
The wording "mechanical import" comes from that the conditions of copy are the following:
It means that in the target 3D Shape, the copied feature ( the mechanical import ) has a link to the original feature which is inside another 3D Shape.
By CAA code, there are two means to create a Mechanical Import:
If you use the CATIMmiInterPartCopy interface, do not forget to use
SetLinkMode
with TRUE option SetProducts
in case of assembly contextThe Mechanical Import feature is the result of the copy. Generally it is the
feature returned by
the Run
method. It is true for the following mechanical features :
point, line, plan, curve. But it is not true for the following cases:
Run
method returns a Body
feature, but the Mechanical Import is the solid feature -
Here
Body.2
, on the right, is the copy of PartBody, on the left.Body.2
will be the feature returned by theRun
method, but the real result of the copy is the featureSolid.1
.Solid.1
is the Mechanical Import.
Run
method returns a
set feature, but this set is not the Mechanical Import feature, it is all
the elements inside the copied set.
On the right-top,
Ordered Geometrical Set.6
is the result of the copy ofOrderered Geometrical Set.2
, on le left.Ordered Geometrical Set.6
is the feature returned by theRun
method, but the Mechanical import features are features contained insideGeometrical Set.6
(here one but it can several).On the right-bottom,
Geometrical Set.5
is the copy ofGeometrical Set.1
, on the left.Geometrical Set.5
is the feature returned by theRun
method, but the Mechanical import features are features contained insideGeometrical Set.5.
Run
method returns a
sketch feature, but it is not the Mechanical Import feature, see below.
Here
Sketch.2
is the copy of another sketch.Sketch.2
will be the feature returned by theRun
method, but the Mechanical Import is the featureCopy.1
.
The characteristics of a mechanical import are
It is the original feature, those which has been copied.
These information can be retrieved thanks CATIMmiMechanicalImportApplicative interface.
GetPointedElement
method, for the
pointed element GetSourceProduct
method , for the
pointed product instanceBut you cannot retrieve these two information if you are not authorized to retrieve them. The authorization mechanism is simple:
In the both cases, you cannot call the GetPointedElement
or the
GetSourceProduct
methods without calling a specific method of the CATIMmiMechanicalImportApplicative
interface for an authentification step. It is detailed just below.
The specific method to be able to retrieve the import information is
SetPointedElementClientId
method. The argument of this method is a string
which is the key to open the startup file (startup catalog) which defines the original feature.
This key is defined when the catalog is created. Here is an extract of the use
case creating a catalog of StartUp [3]
... CATICatalog *piCatalog = NULL; CATUnicodeString storageName = argv[6]; HRESULT rc = ::CreateCatalog(&storageName,&piCatalog); CATUnicodeString clientId("MyCLientId"); piCatalog->SetClientId(&clientId); ... |
MyclientId
is the key to be able to open the catalog. It is
the same key that you use with
SetPointedElementClientId
... CATIMmiMechanicalImportApplicative * pIFeatureResult = ... ; pIFeatureResult->SetPointedElementClientId(&clientId); ... |
There is another way when you are not the owner of the Startup catalog, or you do not know its identifier. The application copying features can "expose" a special identifier. This identifier is a GUID [5] . This identifier is associated with the copy when it is created. The process is the following:
... GUID MyApplicativeImportID = { 0x7c7b3737, 0x5358, 0x0000, {0x02, 0x80, 0x02, 0x0b, 0x3e, 0x00, 0x00, 0x00} }; ... |
This definition is set in a header file,
MyApplicativeImportID.h
file .
SetImportApplicativeId
methodCase with CATIMmrInterPartCopy
... #include "MyApplicativeImportI.h" CATIMmrInterPartCopy *pIInterPartCopy = ... pIInterPartCopy.SetImportApplicativeId(MyApplicativeImportID); ... CATISpecObject_var ResultCopy ; pIInterPartCopy->Run(ResultCopy ); ... |
Case with selection agent
... #include "MyApplicativeImportI.h" myStateCommand::BuildGraph(...) { ... CATFeatureImportAgent* pSelectionAgent = new CATFeatureImportAgent ( ...) ; ... pSelectionAgent-> SetImportApplicativeId(MyApplicativeImportID); } ... |
SetApplicativeId
of CATIMmiMechanicalImportApplicative
... #include "MyApplicativeImportI.h" CATIMmiMechanicalImportApplicative * pIFeatureResult = ... ; pIFeatureResult->SetApplicativeId(MyApplicativeImportID); ... |
[Top]
This interface is implemented on the GeometricalElement3D feature which are coming from a copy. It is the feature considered as Mechanical Import which implements this interface. You have the detail in the Doing a Mechanical Import by Code section. This interface contains three kinds of method:
SetApplicativeId
orSetPointedElementClientId
If one of these two methods is not called firstly, all the other methods of the interface will fail.
About
SetPointedElementClientId :
attention, this method will fail if the original feature (the pointed element) is not accessible in session. But take care, you could not use the tool methods to do a check or to load the pointed element. You must explicitly load the part document containing the pointed element.
GetPointedElement
. This method returns the original feature. This method will fail
- SetApplicativeId or SetPointedElementClientId not previously called
- if the Part document is not loaded in memory
GetSourceProduct
. To retrieve the Product instance . This method will fail if:
- SetApplicativeId or SetPointedElementClientId not previously called
- The copy has been done without assembly context,
- The Product assembly is not loaded in memory
These two methods fails if you do not have previously called
SetApplicativeId
orSetPointedElementClientId.
There are two methods :
IsPointedElementLoaded
andLoadPointedElement.
These two methods are only usable if you use an applicative GUID as authentication process.
IsPointedElementLoaded
enables you to know if the pointed feature is accessible, in other words, it enables you to check, before to callGetPointedElement,
if the pointed element could be returned. If the pointed element is not loaded, you can call theLoadPointedElement
method. This method will do the necessary to load in memory the Part document. After a successful call to theLoadPointedElement
method, theGetPointedElement
must success.
On all mechanical imports created before V5R17, you can retrieve the link
information without authentication. SetApplicativeId
/SetPointedElementClientId
are useless, but the other methods of the CATIMmiMechanicalImportApplicative
interface can be used. Up to V5R17, mechanical imports need to be applicative to retrieve information
on them.
[Top]
An applicative mechanical import is an import which is tagged or which points an applicative object. The tag or catalog client id is used to obtain information on the import (such as the pointed element).
[Top]
[1] | Copying Mechanical Features |
[3] | Creating StartUps in Catalogs |
[5] | About Globally Unique Identifier |
[Top] |
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