Geometric Modeler |
Topology |
Using the Smart DuplicatorHow to Modify a "Touched" Topology |
Use Case |
AbstractRight after its creation a topology is modifiable. But when the body which contains this topology is frozen, you can no longer modify this topology. With the smart duplicator, you can modify only a part of a body. The part to be modified has to be "touched". This results in a new body sharing the untouched topologies with the initial body. This use case illustrates the smart mechanism with a skin body which has a holed face. Touching the holed face allows you to remove the internal domain to fill in the hole. |
This use case is intended to help you use the CATSmartBodyDuplicator operator.
[Top]
CAATobSmartDuplicator is a use case of the CAATopologicalObjects.edu framework that illustrates the NewTopologicalObjects framework capabilities.
[Top]
The CAATobSmartDuplicator use case:
[Top]
To launch CAATobSmartDuplicator , you will need to set up the build time environment, then compile CAATobSmartDuplicator.m along with its prerequisites, set up the run time environment, and then execute the use case [1].
With Windows CAATobSmartDuplicator e:\partwithhole.NCGM
With UNIX CAATobSmartDuplicator /u/partwithhole.NCGM
where partwithhole.NCGM is an input file delivered in the CAATopologicalObjects.edu/FunctionTests/InputData file.
[Top]
The CAATobSmartDuplicator use case is made of a main named CAATopSmartDuplicator.cpp located in the CAATobSmartDuplicator.m module of the CAATopologicalObjects.edu framework:
Windows | InstallRootDirectory\CAATopologicalObjects.edu\ CAATobSmartDuplicator.m\ |
Unix | InstallRootDirectory/CAATopologicalOjects.edu/ CAATobSmartDuplicator.m/ |
where InstallRootDirectory
is the directory where the CAA
CD-ROM is installed.
[Top]
There are six main steps in CAATopSmartDuplicator.cpp:
[Top]
The geometry factory (CATGeoFactory) creates and manages all the
CATICGMObject (and the curves and surfaces in particular). In this use case,
the factory is defined by reading a NCGM file that was previously stored,
the global function ::CATLoadCGMContainer
must be used to retrieve
the factory. The body is retrieved by using the
CATICGMContainer::FindObjectFromTag method. There is only one body in the
container which is loaded. 10990 is the body tag.
CATGeoFactory* piGeomFactory = CATLoadCGMContainer(filetoread); ... CATICGMObject * piCGMObj1 = piGeomFactory->FindObjectFromTag(10990 ); |
The initial body looks something like this:
[Top]
To retrieve the holed face, all the faces of the body are scanned and for each cell, the number of internal domains is computed. For the cells which have internal domains, the domains are scanned. The internal loop is detected by using CATDomain::GetLocation.
for (int k = 1; k < faceList.Size()+1; k++) { CATCell * pLocalCell = faceList[k]; if (pLocalCell && pLocalCell->GetNbInternalDomains() > 0) { int NbDomains=pLocalCell->GetNbDomains(); for(int j=1;j<=NbDomains;j++) { CATDomain *pDomain=pLocalCell->GetDomain(j); CATLocation Location=pDomain->GetLocation(); if(Location==CATLocationInner) { pInnerLoop=pDomain; // the inner loop holedFace = (CATFace *) faceList[k] ; // the holed face break; } } } } |
[Top]
The CATTopology::Touch method is used to specify which topology is going to be modified.
holedFace->Touch(piBody); |
[Top]
First, you must create an empty body from CATGeoFactory. The CATSmartBodyDuplicator operator is created from this new body. It must be run.
CATBody * copBody = piGeomFactory->CreateBody(); CATSmartBodyDuplicator * smartDuplicator = copBody->CreateSmartDuplicator(piBody, topdata); if (smartDuplicator == NULL) return (1); smartDuplicator->Run(); CATFace * duplicatedFace = (CATFace *)smartDuplicator->GetDuplicatedCell(holedFace); |
[Top]
The face inner loop is retrieved by scanning its domains. A domain which is an internal domain is removed.
int NbD=duplicatedFace->GetNbDomains(); for(int j=1;j<=NbD;j++) { CATDomain *pDom=duplicatedFace->GetDomain(j); CATLocation Loc=pDom->GetLocation(); if(Loc==CATLocationInner) { duplicatedFace->RemoveDomain(pDom); } } |
[Top]
To save the model in a file, the ::CATSaveCGMContainer
global
function is used. Notice that in the use case, the save is conditioned by an
input parameter representing the file inside which the model must be saved.
The use case ends with the closure of the geometry factory, done by the ::CATCloseCGMContainer
global function.
if(1==toStore)
{
#ifdef _WINDOWS_SOURCE
ofstream filetowrite(pfileName, ios::binary ) ;
#else
ofstream filetowrite(pfileName,ios::out,filebuf::openprot) ;
#endif
::CATSaveCGMContainer(piGeomFactory,filetowrite);
filetowrite.close();
}
//
// Closes the container
//
::CATCloseCGMContainer(piGeomFactory);
|
[Top]
[1] | Building and Launching a CAA V5 Use Case |
[Top] |
Version: 1 [Jan 2009] | Document created |
[Top] |
Copyright © 2009, Dassault Systèmes. All rights reserved.