Shape Design & Styling |
Generative Shape Design |
Inserting Boolean Operations on Volume FeaturesUsing the Part Design Boolean factory, add, remove , intersect operations on volume features |
Use Case |
AbstractThis article discusses the CAAGsiVolumeBooleanOpe use case. This use case explains how to boolean operation on volume.
|
This use case learns how to use Part Design Boolean factory to create
boolean operations between volumes
Note : Creations of volume and use of boolean operations on volumes are
licensed by GSO Product
- Add , Remove , Intersect, Union trim are the supported operation on volumes
[Top]
CAAGsiVolumeBooleanOpe is a use case of the CAAGSMInterfaces.edu framework that illustrates boolean operations on volumes using Part Design
Boolean operation on volume are propose in the CATIPrtBooleanFactory, use
also for boolean operations on solid features, a context has to be initalize in
the creation methods
Note : The sample uses a C++ "#define" to be valuated to 4 for volume named
BOOLEAN_OPE_ON_VOLUME
[Top]
CAAGsiVolumeOpe creates different operations on volumes using CATIPrtBooleanFactory
[Top]
To launch CAAGsiVolumeBooleanOpe, you will need to set up the build time environment, then compile CAAGsiVolumeBooleanOpe along with its prerequisites, and set up the run time environment, and then execute the use case [1].
Launch the use case as follows:
e:>CAAGsiVolumeBooleanOpe inputDirectory\GAAGsiNozzle.CATPart outputDirectory\CAAGsiVolumeBooleanOpe.CATPart |
$ CAAGsiVolumeBooleanOpe inputDirectory/CAAGsiStartForBoolean.CATPart outputDirectory/CAAGsiVolumeBooleanOpe.CATPart |
where:
inputDirectory |
The directory into which CAAGsiStartForBoolean.CATPart is found
|
outputDirectory |
The directory into which CAAGsiVolumeBooleanOpe.CATPart is saved |
CAAGsiVolumeBooleanOpe.CATPart |
The file that contains the part created with the datum surface t |
[Top]
The CAAGsiVolumeBooleanOpe use case is made of main program located in the CAAGsiVolumeBooleanOpe.m module of the CAAGSMInterfaces.edu framework:
Windows | InstallRootDirectory\CAAGSMInterfaces.edu\CAAGsiVolumeBooleanOpe.m\ |
Unix | InstallRootDirectory/CAAGSMInterfaces.edu/CAAGsiVolumeBooleanOpe.m/ |
The input CAAGsiStartForBoolean.CATPart is proposed in Data.d directory of CAAGSMInterfaces.edu
Windows | InstallRootDirectory\CAAGSMInterfaces.edu\Data.d\CAAGsiStartForBoolean.CATPart
|
Unix | InstallRootDirectory/CAAGSMInterfaces.edu/Data.d/CAAGsiStartForBoolean.CATPart |
where InstallRootDirectory
is the directory where the CAA
CD-ROM is installed.
[Top]
There are five logical step in CAAGsiVolumeBooleanOpe:
We will now comment each of those sections by looking at the code of the main method of file CAAGsiVolumeBooleanOpe.
[Top]
CAAGsiVolumeBooleanOpe sample first creates a session and opens the input CATPart.
Note: The important feature of the following sequence of code consists in the required call to the GetPart() method of the CATPrtContainer interfaces. This method allow to load in session the different containers of the part
.... // creates a session char *pSessionName = "SampleSession"; CATSession *pSession = NULL; rc = Create_Session(pSessionName, pSession); if (NULL == pSession ) { cout << "(CAAGsiVolumeBooleanOpe) ERROR: Create_Session" << endl ; TestCaseError = 1 ; } // loads the document and initializes it cout << "The input document " << InputName << " is opened" << endl ; CATDocument *pDoc = NULL; rc =CATDocumentServices::OpenDocument(InputName, pDoc) ; if (NULL == pDoc ) { cout << "(CAAGsiVolumeBooleanOpe) ERROR CATDocumentServices::OpenDocument" << endl ; TestCaseError = 2 ; } // Part Container CATIPrtContainer *piPartContainer = NULL ; CATIPrtPart_var spPrtPart; if ( NULL != pDoc ) { // queries on the document to get the root container CATInit *pDocAsInit = NULL; pDoc->QueryInterface(IID_CATInit, (void**)&pDocAsInit) ; if ( NULL != pDocAsInit ) { // Extracts from document a reference to its part in hPartAsRequest piPartContainer = (CATIPrtContainer*)pDocAsInit->GetRootContainer("CATIPrtContainer"); pDocAsInit->Release(); pDocAsInit = NULL ; if( NULL != piPartContainer ) { CATISpecObject_var spPart = piPartContainer->GetPart() ; spPrtPart = spPart ; } } ... |
Then in the initialization phase the wire frame and shape design and Part Design factory are retrieved. .
.... CATIPrtBooleanFactory_var spBoolPrtFact; if ( NULL !=piPartContainer ) { // Retrieve the boolean part Factory Interface CATIPrtBooleanFactory * _pBoolPrtFact =NULL; rc = piPartContainer -> QueryInterface(IID_CATIPrtBooleanFactory ,(void**)&_pBoolPrtFact); if (SUCCEEDED(rc) ) { spBoolPrtFact = _pBoolPrtFact; if (_pBoolPrtFact) _pBoolPrtFact -> Release(); _pBoolPrtFact = NULL; } } .... |
[Top]
Create add operation using CreateAdd method of CATIPrtBooleanFactory
Note: Insert in procedural view is done at creation under the current geometrical feature set
... #define BOOLEAN_OPE_ON_VOLUME 4 ... // Add // ---------------------------------------------------------------------------- cout << "(CAAGsiVolumeFormFeatures) Add " << endl; CATISpecObject_var spSpecExtr1 = ... CATISpecObject_var spSpecExtr2 = ... CATISpecObject_var spSpecAdd = spBoolPrtFact -> CreateAdd ( spSpecExtr1,spSpecExtr2 ,BOOLEAN_OPE_ON_VOLUME) ; CAAGsiObjectUpdate(spSpecAdd) ; ... |
[Top]
Create remove operation using CreateRemove method of CATIPrtBooleanFactory
Note: Insert in procedural view is done at creation under the current geometrical feature set
... #define BOOLEAN_OPE_ON_VOLUME 4 ... // Remove // ---------------------------------------------------------------------------- cout << "(CAAGsiVolumeFormFeatures) Remove " << endl; CATISpecObject_var spSpecExtr3 = ... CATISpecObject_var spSpecRemove = spBoolPrtFact -> CreateRemove ( spSpecAdd,spSpecExtr3 ,BOOLEAN_OPE_ON_VOLUME ) ; CAAGsiObjectUpdate(spSpecRemove) ; |
[Top]
Create intersect operation using CreateIntersect method of CATIPrtBooleanFactory
... #define BOOLEAN_OPE_ON_VOLUME 4 ... // Intersection // ---------------------------------------------------------------------------- cout << "(CAAGsiVolumeFormFeatures) Intersection " << endl; CATISpecObject_var spSpecExtr4 = ... CATISpecObject_var spSpecExtr5 = ... CATISpecObject_var spSpecInt = spBoolPrtFact -> CreateIntersect ( spSpecExtr4,spSpecExtr5 ,BOOLEAN_OPE_ON_VOLUME ) ; CAAGsiObjectUpdate(spSpecInt) ; |
[Top]
Save part and close the session
... // save if (NULL != OutputName ) { rc = CATDocumentServices::SaveAs (*pDoc, OutputName ); if (SUCCEEDED(rc)) { cout << "(CAAGsiVolumeBooleanOpe) Document saved " << endl; } else { cout << "ERROR in saving document" << endl ; } } // Closes the document CATDocumentServices::Remove(*pDoc); // Ends session and drops document Delete_Session("SampleSession"); ... |
[Top]
This use case has demonstrated the way to perform boolean operation on volume thanks to part design boolean factory. resulting feature add, remove , intersect and Union-Trin are inserted in GS or OGS When then are inserted in OGS the boolean operation are 'absorbant' features
We illustrate feature in this use case boolean operation that do not have BRep feature as input . Operations that required BRep feature in input (Ex: Union-Trim) the use of boolean operation interface is similar as presented in the sample.
Note : The BRep features are retrieved in interactive commands through in selecting of sub-element and using Mechanical Modeler agent (Ex:CATFeatureImportAgent)
Union-Trim
Note : The BRep features are retrieved in interactive commands through in selecting of sub-element and using Mechanical Modeler agent CATFeatureImportAgent
[Top]
[1] | Building and Launching a CAA V5 Use Case |
[2] | About Generative Shape Design Features |
[3] | Inserting a Shape Design Feature in the procedural view |
[4] | Updating a shape Design feature |
[Top] |
Version: 1 [May 2004] | Document created |
[Top] |
Copyright © 2004, Dassault Systèmes. All rights reserved.