Mechanical Design |
Aerospace Sheet Metal Design |
Creating and modifying a WebUsing the aerospace sheet metal factory and public interface to create or modify a web feature |
Use Case |
AbstractThis article discusses the CAAStmWeb use case. This use case explains how to create or modify a Web feature. A Web is the base feature for all other aerospace sheet metal features.[1]
|
This use case learns how to use the aerospace sheet metal factory and the Web public interface to create , display or modify a Web. Its main intent is to introduce important concepts about the way to create or modify aerospace sheet metal features.
CAAStmWeb is a use case of the CAAAerospaceSheetMetal.edu framework that illustrates the creation or modification of a Web feature.
This use case will show you the different steps to create or modify a Web.
More precisely this sample :
- Read and analyse an input data (.txt) file.
- Create a session.
- Open a CATPart document including the necessary geometric input features.
- Create the Web feature if it does't exist in the input Part.
- Set the values of the parameters of the Web.
- Update the Part.
- Save the result in a new CATPart document.
- Close the session.
With this sample, you will have in batch mode the same capabilities than an interactive session.
The input data file contains the same fields than the UI Web command panel :
Some samples of input data are provided in Data.d directory.
The structure of this file is simple :
KEYWORD: when a keyword is encountered a boolean is set to TRUE : the corresponding data is to set.
More details about available KEYWORDS are provided in front of the sample source file.
i.e. : The input data file above will create a Web with features read in CAATestBasicGeometry.CATPart :
Remark that the Sheet Metal Parameters feature must exist in the input Part ( see the spec tree above ).
The sample will create a Web with Plane.1 as Support and Extrude.1, Fill.1, Sketch.4 and Sketch.3 as Boundary :
[Top]
To launch CAAStmWeb, you will need to set up the build time environment, then compile CAAStmWeb along with its prerequisites, and set up the run time environment, and then execute the use case [2].
Launch the use case as follows:
Edit the File : CAATestCreateWeb.txt Customize the fields INPUT and OUTPUT Specify the Paths where the .CATParts files will be retrieved and saved |
e:\CAAStmWeb inputDirectory\CAATestCreateWeb.txt |
$ CAAStmWeb inputDirectory/CAATestCreateWeb.txt |
where:
inputDirectory |
The directory into which CAATestCreateWeb.txt is found
|
[Top]
The CAAStmWeb use case is made of main program located in the CAAStmWeb.m module of the CAAAerospaceSheetMetal.edu framework:
Windows | InstallRootDirectory\CAAAerospaceSheetMetal.edu\CAAStmWeb.m\ |
Unix | InstallRootDirectory/CAAAerospaceSheetMetal.edu/CAAStmWeb.m/ |
The input CAATestCreateWeb.txt and CAATestCreateWeb.CATPart are proposed in Data.d directory of CAAAerospaceSheetMetal.edu
Windows | InstallRootDirectory\CAAAerospaceSheetMetal.edu\Data.d\Web
|
Unix | InstallRootDirectory/CAAAerospaceSheetMetal.edu/Data.d/Web |
where InstallRootDirectory
is the directory where the CAA
CD-ROM is installed.
[Top]
There are 7 main steps in CAAStmWeb :
We will now comment each of those sections by looking at the code of the main method of the file CAAStmWeb.cpp.
[Top]
CAAStmWeb sample will first read and analyse an input data file.
Note : some services are provided in the class CAAStmServices.
... CAAStmServices CAASmaTools; rc = CAASmaTools.AnalyseWebInputData (InputDataFilePath, CAAWebInput); ... |
The method AnalyseWebInputData will read the input data file and store the data in the class CAAStmInputData: i.e : if the method GetSupportGeomToSet() returns TRUE it means that the Support is to set.
... class ExportedByCAAStmServices CAAStmInputData { public: CAAStmInputData(); virtual ~CAAStmInputData(); /** * Role: Methods to get the Input Data. * */ // General Data : // -------------- CATUnicodeString GetInputPartPath (); CATUnicodeString GetOutputPartPath (); CATUnicodeString GetLengthUnit (); CATBoolean GetDisplay (); ... |
[Top]
Create a session and open the CATPart Document : this step has no specificity. It is a call to standard functionalities :
... // create a session char * pSessionName = "CAAStmWeb"; CATSession * pSession = NULL; rc = Create_Session (pSessionName, pSession); ... // Load the input Document rc = CATDocumentServices::OpenDocument((CAAWebInput.InputPartPath).ConvertToChar(), pDocument); ... // Retrieve the Part Feature and the Aerospace Sheet Metal Factory : CATIPrtContainer * piPrtCont = (CATIPrtContainer *) piInit -> GetRootContainer("CATIPrtContainer"); if(NULL != piPrtCont) { spPrtPartSpec = piPrtCont -> GetPart(); if(NULL_var != spPrtPartSpec) { ... rc = piPrtCont -> QueryInterface(IID_CATIAerospaceSheetMetalFactory, (void **)& piAslFactory); ... |
[Top]
Create a Web feature using CreateWeb method of CATIAerospaceSheetMetalFactory : this method will create all internal features and links between the attributes of the Web. Due to only one Web may exist in a Part we try first to find if a Web exist :
... // Try to retrieve the Web Feature : rc = CAASmaTools.FindWeb (piPrtPartSpec, &piWebSpec); ... // No Web found : creation of a new one rc = piAslFactory -> CreateWeb ((CATISpecObject *) spPrtPartSpec, &piWebSpec); ... |
[Top]
Set the Web parameters according to the values stored in CAAWebInput
i.e : Support : set a CATISpecObject pointer
... if(SUCCEEDED(rc) && (CAAWebInput.GetSupportGeomToSet())) { // Search the Web Support input specification : CATISpecObject * pSupportSpec = NULL; rc = CAASmaTools.FindFeatureInSpecTree (spPrtPartSpec, CAAWebInput.SupportGeomName, &pSupportSpec); if(SUCCEEDED(rc) && (NULL != pSupportSpec)) { // Set the Web Support : rc = piStmWeb -> SetSupport(pSupportSpec); ... |
i.e : Material orientation : set a CATOrientation
... if(SUCCEEDED(rc) && (CAAWebInput.GetMaterialOrientToSet())) { rc = piStmWeb -> SetMaterialOrient(CAAWebInput.MaterialOrient); ... |
[Top]
We suggest to update the Part Feature instead of the Web to force all internal links of the Web to re-build :
This step is not necessary if "DISPLAY:" has been chosen.
... rc = CAASmaTools.Update (piPrtPartSpec); ... |
[Top]
Save the result Part in a new CATPart file.
This step is NOT applied if "DISPLAY:" has been chosen.
... // Save the Document rc = CATDocumentServices::SaveAs (*pDocument, (CAAWebInput.OutputPartPath).ConvertToChar()); ... |
[Top]
Release the interface pointers and close the session.
... // Releases on Interfaces : if(NULL != piAslFactory) { piAslFactory -> Release(); piAslFactory = NULL; } if(NULL != piStmWeb) { piStmWeb -> Release(); piStmWeb = NULL; } if(NULL != piWebSpec) { piWebSpec -> Release(); piWebSpec = NULL; } // Close the document rc = CATDocumentServices::Remove (*pDocument); ... // End session rc = Delete_Session (pSessionName); ... |
[Top]
This use case has demonstrated the way to create, display or modify a Web feature.
[Top]
Version: 1 [January 2005] | Document created |
[Top] |
[1] | An Overview of the Aerospace Sheet Metal Design Features |
[2] | Building and Launching a CAA V5 Use Case |
[Top] |
Copyright © 2004, Dassault Systèmes. All rights reserved.