Mechanical Modeler |
Retrieving Mechanical Import Information using ClientIDUsing CATIMmiMechanicalImportApplicative with Startup Catalog Id as authentication |
|
| Use Case | ||
AbstractThe Use Case illustrates retrieving the link information of an
Applicative Mechanical Import, a copy with link across two Part
documents using the
The article "Managing Applicative Mechanical Imports" [1] is a further reference on that subject. |
User primarily learns the capabilities of the CATIMmiMechanicalImportApplicative
APIs particularly to:
SetPointedElementClientId
APIGetPointedElement, GetSourceProduct
APIsThe Use Case also demonstrates the irrelevance of the calls to
IsPointedElementLoaded and LoadPointedElement
on an Applicative Mechanical Import, using the ClientId
authentication.
[Top]
CAAMmrImportWithClientId is a use case of the
CAAMechanicalModeler.edu framework that
illustrates MecModInterfaces framework capabilities.
[Top]
The use case operates on an Input model as depicted in Fig.1 below
![]() |
The Root Product CAAMmrImportWithClientId_Root
has beneath it :
CAAMmrImportWithClientId_Child1
namely. CAAMmrImportWithClientId_Child1.1 CAAMmrImportWithClientId_Child2 namely.
CAAMmrImportWithClientId_Child2.1CAAMmrImportWithClientId_Child1 has an
Instance of the product CAAMmrImportWithClientId_Org
aggregated beneath it. This Product is a Part containing CombinedCurve.1
and Point.1 features .
The CombinedCurve.1 is an instance of a
CombinedCurve StartUp,
contained within a catalog whose
Client Id is "SAMPLES". The "Instantiating
Combined Curves" [2] Use Case details the
steps involved in this instantiation.
CAAMmrImportWithClientId_Child2 has an Instance of
the product CAAMmrImportWithClientId_Copies
aggregated beneath it. This Product is a Part containing three external features. These
are:
Copy_CombinedCurve.1, a copy "as Result with
Link" of CombinedCurve.1
out of assy context, Copy_CombinedCurve.2, a copy
"as Result with Link" of
CombinedCurve.1 in assy contextCopy_Point.1, a copy "as Result with Link" of Point.1, in assy contextThe use case mainly illustrates the following scenarios:
CAAMmrImportWithClientId_Copies.
We retrieve the feature Copy_CombinedCurve.1 under it.
We then illustrate the failure in the StartUp
Catalog authentication, since the
pointed element (CombinedCurve.1),
included into CAAMmrImportWithClientId_Org,
is not in sessionisPointedElementLoaded
and LoadPointedElement in the context of
retrieving information from a Mechanical Import with ClientID
authenticationCAAMmrImportClientId_Root
in the current session. All its sub-product are loaded too. Hence the StartUp
Catalog authentication on the Mechanical Import now works fine,
and we succeed in retrieving information from Copy_CombinedCurve.1
and Copy_CombinedCurve.2IsPointedElementLoaded
on Copy_CombinedCurve.1 and demonstrate its
failure and thus its irrelevance in this context. At this stage, you'll
observe though authentication was done and the pointed
element loaded, the API returns E_FAILStartUp
Catalog authentication on the Mechanical Import Copy_Point.1. It
fails because the source feature for Copy_Point.1 is not
defined in the same catalog as the Combined Curve.[Top]
To launch CAAMmrImportWithClientId, you will need to set up the build time environment,
then compile CAAMmrImportWithClientId along with its prerequisites, set up the run time
environment, and then execute the use case [3].
To launch the use case execute the command:
mkrun -c "CAAMmrImportWithClientId inputpath"
where inputpath is :
[Top]
The CAAMmrImportWithClientId use case is defined at the
location:
InstallRootDirectory\CAAMechanicalModeler.edu\CAAMmrImportWithClientId.m\ |
The use case has calls to:
Global routines CAAMmrGetGeometry and CAAMmrGetPartFromProduct, to navigate a
loaded model.
These routines are defined at the location:
InstallRootDirectory\CAAMechanicalModeler.edu\CAAMmrUtilities.m\ |
where InstallRootDirectory [3]
is the directory where the CAA CD-ROM
is installed.
[Top]
[Top]
CAAMmrImportWithClientId begins by creating a session, and opening the CAAMmrImportWithClientId_Copies Part document. Next it retrieves the root container of this Part as a pointer to
CATIPrtContainer, pIPrtContOnDocument . This is the usual
sequence for loading a Part document.
Thanks to the GetPart method on the root container we
retrieve the Mechanical Part. This part is handled by the smart pointer spSpecObjectOnMechPart. This
pointer will be useful to search specifications in the document.
[Top]
We proceed to retrieve the
Copy_CombinedCurve.1 feature under the MechanicalPart
feature.
...
CATBaseUnknown * pCopyCombCurve1= NULL ;
rc = ::CAAMmrGetGeometry(
|
A call to CAAMmrGetGeometry enables
us retrieve a feature pCopyCombCurve1
by its name Copy_CombinedCurve.1 from the
MechanicalPart feature spSpecObjectOnMechPart.
The next step is to
seek information from the copied feature Copy_CombinedCurve.1.
It begins with an authentication process, referred to as
ClientID authentication, in the steps ahead.
...
CATIMmiMechanicalImportApplicative *pIMecImportApplicativeOnResultCopy = NULL ;
rc =
|
We seek the CATIMmiMechanicalImportApplicative*
type on the copied feature pCopyCombCurve1.
The CATIMmiMechanicalImportApplicative
Interface exposes services which enable us do a ClientID authentication on the Mechanical Import
Copy_CombinedCurve.1.
...
CATUnicodeString ClientId = "SAMPLES";
rc = pIMecImportApplicativeOnResultCopy->SetPointedElementClientId(ClientId);
if (SUCCEEDED(rc))
return 1;
...
|
The CATIMmiMechanicalImportApplicative::SetPointedElementClientId
call on the Mechanical Import
Copy_CombinedCurve.1, takes the ClientId,
a CATUnicodeString as an argument, which in this
case has been valuated to "SAMPLES".
The significance of this argument is that it should necessarily be the
same as the Client Id of the
StartUp Catalog defining the source feature of the Import.
Here, Copy_CombinedCurve.1 and
Copy_CombinedCurve.2 are copies of CombinedCurve.1,
a feature whose StartUp definition exists in a Catalog whose Client Id is
"SAMPLES", defined in the Use Case "Creating a Combined Curve's Catalog"
[4]
That being the case, an essential pre-requisite for the authentication
process is that the Part containing the pointed element should
necessarily be loaded in the current session. Since CAAMmrImportClientId_RepRef_org
is not loaded in the current session, the authentication process is bound to
fail here.
[Top]
In the earlier step, the ClientID authentication
failed since the pointed element was not loaded in the current session.
We now attempt to load it by a call to CATIMmiMechanicalImportApplicative::LoadPointedElement.
...
rc = pIMecImportApplicativeOnResultCopy->
rc = pIMecImportApplicativeOnResultCopy->
|
It is important to note that the pointed element cannot be loaded
with a call to LoadPointedElement
since it
always returns FAILURE.
Reason being, that any call on the copied feature requires an
authentication. And the ClientID way of
authentication succeeds only after the pointed element is loaded in the
current session. That being the case, calls to
LoadPointedElement and IsPointedElementLoaded
are obviously irrelevant in the ClientID context, and
hence always return FAILURE, as the code above indicates.
[Top]
We proceed to do a
ClientID authentication on Copy_CombinedCurve.1,
having loaded the Part containing the pointed element CAAMmrClientId_RepRef_Org. We load
CAAMmrClienId_RepRef_Org by loading
its Root CAAMmrImportClientId_Root. Loading the
root product, load all its sub-product, and its Part documents.
... CATBaseUnknown_var spPointedElement1; CATBaseUnknown_var spSourceProductInstance1; rc = pIMecImportApplicativeOnResultCopy->SetPointedElementClientId(ClientId); ... |
pIMecImportApplicativeOnResultCopy is the CATIMmiMechanicalImportApplicative
interface pointer on the copied feature, Copy_CombinedCurve.1.
We have retrieved it in the
previous section. The call to SetPointedElementClientId is expected
to return a SUCCESS at this stage since
- Part containing the pointed element
CAAMmrClienId_RepRef_Orgis loaded in the current session- The
ClientIdargument valuated to "SAMPLES" [#] earlier, is the same as theClientIdof theCatalogcontaining theStartUpdefinition ofCombinedCurve.1(source feature forCopy_CombinedCurve.1)
We can now
retrieve all relevant information from
Copy_CombinedCurve.1, a feature copied out of Assy Context.
... CATBaseUnknown_var spPointedElement1;
rc = pIMecImportApplicativeOnResultCopy->GetPointedElement(spPointedElement1);
...
CATBaseUnknown_var spSourceProductInstance1;
rc = pIMecImportApplicativeOnResultCopy->GetSourceProduct
(spSourceProductInstance1);
...
|
The call to
GetPointedElement returns
the source feature of
Copy_CombinedCurve.1
The call to
GetSourceProduct
fails, as expected since Copy_CombinedCurve.1, is a feature
copied, out of Assy Context.
Though the calls to the above APIs succeeded, the
call to IsPointedElementLoaded still fails, since as
explained earlier [#],
this API is irrelevant in the ClientID context.
...
rc = pIMecImportApplicativeOnResultCopy->IsPointedElementLoaded
(LoadedPointedReference);
if (SUCCEEDED(rc))
return 1;
...
|
The next step
is to seek all relevant information from Copy_CombinedCurve.2, a
feature copied in Assy Context, within the Part
document CAAMmrClienId_RepRef_Copies.
In an earlier step [#] we
had retrieved the MechanicalPart feature contained
within this Part.
We begin by seeking the Copy_CombinedCurve.2
feature from this MechanicalPart feature as seen below.
...
CATBaseUnknown *pCopiedFeatureInAssyContext= NULL ;
CATUnicodeString NameFeatureToCopy = "Copy_CombinedCurve.2";
rc = ::CAAMmrGetGeometry(spSpecObjectOnMechPart,
NameFeatureToCopy ,&pCopiedFeatureInAssyContext);
rc = pCopiedFeatureInAssyContext->QueryInterface
(IID_CATIMmiMechanicalImportApplicative,
(void**)&pIMecImportApplicativeOnResultCopy);
...
|
The CAAMmrGetGeomtry call returns
the feature pCopiedFeatureInAssyContext, a
CATBaseUnknown* type, identified by its name
Copy_CombinedCurve.2, given a MechanicalPart
feature, as an input. The MechanicalPart feature is
available as spSpecObjectOnMechPart,
CATISpecObject_var type from an earlier step [#]
We then proceed to seek a
CATIMmiMechanicalImportApplicative* type on
Copy_CombinedCurve.2. The Interface
CATIMmiMechanicalImportApplicative has services for retrieving
information from a copied feature.
As mentioned
before, authentication on the copied feature is an essential pre-requisite
before seeking any information from it. A call to
SetPointedElementClientId with the ClientId,
a CATUnicodeString set to "SAMPLES" earlier [#]
does this authentication.
...
rc = pIMecImportApplicativeOnResultCopy->SetPointedElementClientId(ClientId);
...
|
The call to SetPointedElementClientId is expected
to return a SUCCESS here since
- Part containing the pointed element
CAAMmrClienId_RepRef_Orgis already loaded in the current session- The
ClientIdargument valuated to "SAMPLES" [#] earlier, is the same as theClientIdof theCatalogcontaining theStartUpdefinition ofCombinedCurve.1(source feature forCopy_CombinedCurve.2)
It is now
possible to seek all relevant information from
Copy_CombinedCurve.2, as the code below depicts.
... CATBaseUnknown_var spPointedElement2;
rc = pIMecImportApplicativeOnResultCopy->GetPointedElement(spPointedElement2);
CATBaseUnknown_var spSourceProductInstance2;
rc = pIMecImportApplicativeOnResultCopy->GetSourceProduct
(spSourceProductInstance2);
...
|
The call to GetPointedElement
returns the pointed element, spPointedElement2,
a CATBaseUnknown_var type.
The call to GetSourceProduct
returns the Product Instance CAAMmrImportClientId_Child1.1
which aggregates the Product CAAMmrImportClientId_RepRef_Org,
associated with the Part of the
source feature CombinedCurve.1. It is returned as a
CATBaseUnknown_var type,
spSourceProductInstance2. It succeeds since
Copy_CombinedCurve.2, is a feature copied in Assy Context.
[Top]
Lastly, we illustrate the failure to do a ClientID
authentication on Copy_Point.1, a point
copied in Root Context, within the Part associated with CAAMmrClienId_RepRef_Copies.
We begin by retrieving Copy_Point.1 feature.
... CATBaseUnknown* pCopiedFeature_Point= NULL;
NameFeatureToCopy = "Copy_Point.1";
rc = ::CAAMmrGetGeometry(spSpecObjectOnMechPart,
NameFeatureToCopy ,&pCopiedFeature_Point);
rc = pCopiedFeature_Point->QueryInterface(IID_CATIMmiMechanicalImportApplicative,
(void**)&pIMecImportApplicativeOnResultCopy);
...
|
The CAAMmrGetGeomtry call returns
the feature pCopiedFeature_Point, a
CATBaseUnknown* type, identified by its name
Copy_Point.1, given a MechanicalPart
feature, as an input. The MechanicalPart feature is
available as spSpecObjectOnMechPart,
CATISpecObject_var type [#]
We then proceed to seek a
CATIMmiMechanicalImportApplicative* type on
Copy_Point.1. The Interface
CATIMmiMechanicalImportApplicative has services for retrieving
information from a copied feature.
A call
to SetPointedElementClientId with the
ClientId, a CATUnicodeString set to "SAMPLES"
earlier [#] attempts to do an authentication on
Copy_Point.1, an essential pre-requisite prior to
proceeding further.
...
rc = pIMecImportApplicativeOnResultCopy->SetPointedElementClientId(ClientId);
if (SUCCEEDED(rc))
return 1;
...
|
This authentication fails, for the simple reason that
the ClientId input is that of the
CombinedCurve StartUp Catalog,
which does not define the Copy_Point.1 source.
To retrieve any link information from a standard DS feature,
eg. Point, it should necessarily be an
Applicative Import, meaning a feature copied
"as result with Link" across Part documents
and tagged by a "GUID" [5] The ClientId
authentication could not be valid in this context.
[Top]
The CAAMmrImportWithClientId use case ends by simply closing the PLM
session.
[Top]
The Use Case illustrates retrieving the link information of an
Applicative Mechanical Import, a CombinedCurve [8]
using the StartUp
Catalog authentication on the copied feature. The ClientId input at the time of
authentication should necessarily be the same as the ClientId
of the StartUp Catalog defining the source feature
of the Import.
The authentication
thus necessitates that the Part
containing the pointed element should necessarily be loaded in the current
session. That explains why calls to IsPointedElementLoaded
and LoadPointedElement of the
CATIMmiMechanicalImportApplicative are irrelevant in the
ClientId context.
The article "Managing Applicative Mechanical Imports" [3] is a further reference on that subject.
To retrieve any link information from a copy of a standard DS feature, eg.
Point, the copy should necessarily be an Applicative Import meaning,
a feature copied "as result with link" across Part, and tagged by a "GUID"
[5].
The ClientId authentication is irrelevant in this
context.
[Top]
[Top]
| Version: 1 [July 2007] | Document created |
| [Top] | |
Copyright © 2007, Dassault Systèmes. All rights reserved.