Solution |
Modeler |
Managing Axis SystemsUsing CATIMf3DAxisSystemManager |
Use Case |
AbstractThis article shows how to use the CATIMf3DAxisSystemManager interface. |
This use case is intended to show you how to use the CATIMf3DAxisSystemManager interface to:
[Top]
CAAMmrAxisSystemManagement is a use case of the CAAMechanicalModeler.edu framework that illustrates MechanicalModeler framework capabilities.
[Top]
CAAMmrAxisSystemManagement lists all the axis systems of a Part document, sets as current an axis system, and transforms the (0,0,0) point and the (0,0,1) vector in this current axis system.
If you use the CAAAxisSystemCreation_Save
Part document created by the CAAMmrAxisSystemCreation use case [1]
:
![]() |
The list of axis systems is the following: (*)
![]() |
You can see in the Fig-1 that there is no axis system
with the
icon, so there is no axis system as current. The AS_Standard axis system is set as standard:
(*)
![]() |
The origin of the absolute axis system and the z vector are translated in the AS_Standard axis system: (*)
![]() |
The AS_Standard characteristics are the following:
![]() |
*) It is an extract of the CAAMmrAxisSystemManagement output traces.
[Top]
To launch CAAMmrAxisSystemManagement , you will need to set up the build time environment, then compile CAAMmrAxisSystemManagement along with its prerequisites, set up the run time environment, and then execute the use case [2]. To launch the use case execute the command:
mkrun -c CAAMmrAxisSystemManagement Filename CurrentAS [OutputPath]
where
CAAAxisSystemCreation_Save
Part
document included in the CAAMechanicalModeler.edu/InputData
directory
InstallRootDirectory/CAAMechanicalModeler.edu/InputData
InstallRootDirectory\CAAMechanicalModeler.edu\InputData
AbsoluteAS
string, the absolute axis system becomes the current one.
With the CAAAxisSystemCreation_Save
Part document as Filename
argument, you can test "AS_Standard", "AS_AxisRotation",
"AS_EulerAngles", "AS_Explicit" or "AS_AxisStandardOriAxisDir".CAAAxisSystemManagement
Part document is created in the current directory.[Top]
The CAAMmrAxisSystemManagement use case is made of one module, CAAMmrAxisSystemManagement.m, found in the the CAAMechanicalModeler.edu framework and containing a single source program, CAAMmrTestManagement.cpp:
Windows | InstallRootDirectory\CAAMechanicalModeler.edu\CAAMmrAxisSystemManagement.m\ |
Unix | InstallRootDirectory/CAAMechanicalModeler.edu/CAAMmrAxisSystemManagement.m/ |
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
[Top]
There are eight logical steps in CAAMmrAxisSystemManagement:
[Top]
CAAMmrAxisSystemManagement begins by creating a session, and opening the
input 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 [3].
[Top]
The CATIMf3DAxisSystemManager interface is implemented by the root
container, pIPrtContOnDocument,
which is also the specification
container of the Part document [4].
... CATIMf3DAxisSystemManager * pIMf3DAxisSystemManagerOnFeatCont = NULL ; rc = pIPrtContOnDocument->QueryInterface(IID_CATIMf3DAxisSystemManager, (void **) & pIMf3DAxisSystemManagerOnFeatCont); ... |
[Top]
pIMf3DAxisSystemManagerOnFeatCont
is the CATIMf3DAxisSystemManager
interface pointer. The GetAxisSystems
method retrieves the list of
axis systems in the Part document.
... CATLISTV(CATIMf3DAxisSystem_var) ListAxisSystem ; rc = pIMf3DAxisSystemManagerOnFeatCont->GetAxisSystems(ListAxisSystem); ... int nbAS = ListAxisSystem.Size(); cout <<" There are " << nbAS << " axis system(s) in the document" << endl; for ( int i= 1 ; i <= nbAS ; i++) { CATIMf3DAxisSystem_var spMf3DAxisSystemOnAS= ListAxisSystem[i] ; if ( NULL_var != spMf3DAxisSystemOnAS) { CATIAlias_var spAliasOnCurrentAS = spMf3DAxisSystemOnAS; if ( NULL_var != spAliasOnCurrentAS ) { cout<<" "<< spAliasOnCurrentAS->GetAlias().ConvertToChar() << endl; } } } ... |
[Top]
The GetCurrentAxisSystem
method retrieves the current
axis system. If the returned value is NULL_var, no axis system is current.
... CATIMf3DAxisSystem_var spMf3DAxisSystemOnCurrentAS ; rc=pIMf3DAxisSystemManagerOnFeatCont->GetCurrentAxisSystem(spMf3DAxisSystemOnCurrentAS); ... |
[Top]
The second argument, iArgv[2]
, of the use case is the name of an
axis system to set as current. If this name is "AbsoluteAS", no axis
system should be current. The goal of this section is to find this axis system
in the list of axis systems retrieved in
the "Displays the Count of Axis
Systems" section (ListAxisSystem
).
... CATUnicodeString NewCurrentAxisName = iArgv[2] ; CATUnicodeString AbsoluteAS = "AbsoluteAS" ; CATBoolean Found = FALSE ; if ( (AbsoluteAS != NewCurrentAxisName) && (OldCurrentAxisName != NewCurrentAxisName) ) { int i = 1 ; while ( (FALSE == Found) && ( i<= nbAS )) { CATIMf3DAxisSystem_var spMf3DAxisSystem = ListAxisSystem[i]; if ( NULL_var != spMf3DAxisSystem ) { CATIAlias_var spAliasOnCurrentAS = spMf3DAxisSystem ; if ( NULL_var != spAliasOnCurrentAS ) { if ( NewCurrentAxisName == spAliasOnCurrentAS->GetAlias() ) { Found = TRUE ; spMf3DAxisSystemOnCurrentAS = spMf3DAxisSystem; } } } i++ ; } if ( FALSE == Found) { cout << " The " << NewCurrentAxisName <<" has not been found" << endl; NewCurrentAxisName = OldCurrentAxisName ; } } ... |
If the input axis system has been found ( Found
is
equal to TRUE
), spMf3DAxisSystemOnCurrentAS
, a CATIMf3DAxisSystem
interface pointer declared in the "Finds the Current Axis System" section, contains the pointer on
this axis system. OldCurrentAxisName
is the name of the axis system
found in the "Finds the Current Axis System"
section. If there is no current axis system, the name is AbsoluteAS.
[Top]
If the input axis system is "AbsoluteAS ", no axis system should be
current, the SetCurrentAxisSystem
method argument is NULL_var. But,
if the input axis system has been found, the SetCurrentAxisSystem
method
argument is spMf3DAxisSystemOnCurrentAS
the CATIMf3DAxisSystem
interface pointer on the input axis system.
... if ( AbsoluteAS == NewCurrentAxisName) { rc = pIMf3DAxisSystemManagerOnFeatCont->SetCurrentAxisSystem(NULL_var); ... }else if ( TRUE == Found ) { rc = pIMf3DAxisSystemManagerOnFeatCont->SetCurrentAxisSystem(spMf3DAxisSystemOnCurrentAS); ... } ... |
[Top]
... if ( AbsoluteAS != NewCurrentAxisName) { CATMathPoint PointToConvert (.0,.0,.0) ; CATMathPoint ConvertedPoint; rc = pIMf3DAxisSystemManagerOnFeatCont->ConvertPointCoordinates(TRUE, PointToConvert,ConvertedPoint); ... CATMathVector VectorToConvert (.0,.0,1.0) ; CATMathVector ConvertedVector; rc = pIMf3DAxisSystemManagerOnFeatCont->ConvertVectorCoordinates(TRUE, VectorToConvert,ConvertedVector); ... |
The first argument of the ConvertPointCoordinates
and ConvertVectorCoordinates
methods specifies the coordinates system of conversion: TRUE : the current axis
system , FALSE the absolute axis system.
[Top]
The last actions of the use case are the following: save as the Part document, close it and delete the session. It is also described in the Creating a Load Document use case [3].
[Top]
This use case explains how to use the CATIMf3DAxisSystemManager interface.
[Top]
[1] | Creating Axis Systems |
[2] | Building and Launching a CAA V5 Use Case |
[3] | Loading a Document |
[4] | The Structure of the Part Document |
[Top] |
Version: 1 [Apr 2003] | Document created |
[Top] |
Copyright © 2003, Dassault Systèmes. All rights reserved.