3D PLM Enterprise Architecture |
3D Visualization |
Constructing Graphic Representations in Batch ModeHow to use the CATVisManager in batch mode |
Use Case |
AbstractThis article shows how to construct graphic representations in batch mode. |
This use case is intended to show you how to use the CATVisManager to construct the graphic representations (rep) of a model.
[Top]
CAAGviVisuBatch is a use case of the CAAGeometryVisualization.edu framework that illustrates Visualization and VisualizationBase framework capabilities.
[Top]
CAAGviVisuBatch constructs the graphic representations associated with the
MechanicalPart (Part1
) of the following Model:
![]() |
[Top]
To launch CAAGviVisuBatch , you will need to set up the build time environment, then compile CAAGviVisuBatch along with its prerequisites, set up the run time environment, and then execute the use case [1].
mkrun -c
CAAGviVisuBatch InputPart
where InputPart
is the complete path of a Part document. You can
use the following Part document:
InstallRootDirectory/CAAGeometryVisualization.edu/InputData/CAAVisuBatch.CATPart
InstallRootDirectory\CAAGeometryVisualization.edu\InputData\CAAVisuBatch.CATPart
[Top]
The CAAGviVisuBatch use case is made of a single file, CAAGviVisuBatch.cpp, located in the CAAGviVisuBatch.m module of the CAAGeometryVisualization.edu framework:
Windows | InstallRootDirectory\CAAGeometryVisualization.edu\CAAGviVisuBatch.m\ |
Unix | InstallRootDirectory/CAAGeometryVisualization.edu/CAAGviVisuBatch.m/ |
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
[Top]
There are seven logical steps in CAAGviVisuBatch:
[Top]
CAAGviVisuBatch begins by creating a session, and opening a Part document.
Next it retrieves the root container of this Part as a pointer to CATIPrtContainer,
pISpecContainer.
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 spSpecObjectOnMechanicalPart
.
... CATPathElement * pRootObjectPath = new CATPathElement(spSpecObjectOnMechanicalPart); ... |
In this use case, the CATPathElement is built with the root feature of the Part Document. This feature is the MechanicalPart feature, those called Part1 in the specification tree. Refer to the Mechanical Modeler articles. But anyhow, you can create this path with any feature of the model.
... CATVisManager* pVisManager = CATVisManager::GetVisManager(); ... |
There is only one instance of the CATVisManager class in a session.
The GetVisManager
static method enables you to retrieve it.
... list<IID> ListIVisu3d; IID * pIIDInf = new IID(IID_CATI3DGeoVisu) ; ListIVisu3d.fastadd(pIIDInf); CAT3DViewpoint * pVP = new CAT3DViewpoint(); rc = pVisManager->AttachTo ( pRootObjectPath, pVP, ListIVisu3d); ... |
On the CATVisManager you attach to the CATVisManager:
RootObjectPath,
pVP,
ListIVisu3d
.
Here, it is a list with only the CATI3DGeoVisu interface, once the
Mechanical features implement it.The
AttachTo
method constructs the graphic representations.
... CATI3DGeoVisu * pIVisuOnRoot =NULL ; rc = spSpecObjectOnMechanicalPart->QueryInterface(IID_CATI3DGeoVisu, (void **) & pIVisuOnRoot); ... CATRep * pRep = pIVisuOnRoot->GiveRep(); if ( NULL != pRep ) { CAT3DRep * p3DRep = (CAT3DRep *) pRep; CAT3DBoundingSphere pBe = p3DRep->GetBoundingElement(); ... ... |
After the AttachTo
method, it is possible to retrieve the
graphic representations (rep) of an element thanks to the GiveRep
method of the CATI3DGeoVisu interface. In this use case, the rep of the
MechanicalPart feature (the root) is asked.
... rc = pVisManager->DetachFrom(pVP,0) ; pVP->Release(); pVP = NULL ; ... |
When the graphic representations are useless, you should detach the root
model from the CATVisManager. With the DetachFrom
method
with only the viewpoint, all the root models and the list of interfaces attached
with this viewpoint will be detached too. (The same root model can be attached
with different viewpoints and with different interfaces)
[Top]
The last part of the CAAGviVisuBatchuse case shows how to removes the Part document from the session and delete the session. This is also described in the "Loading a Document" use case (see Data Access entry in the CAA Encyclopedia home page)
[Top]
This use case explains how to use the CATVisManager to create the graphic representations of model in a batch.
[Top]
[1] | Building and Launching a CAA V5 Use Case |
[Top] |
Version: 1 [Fev 2003] | Document created |
[Top] |
Copyright © 2003, Dassault Systèmes. All rights reserved.