cgma
|
operation, another simple C++ driver for CGM More...
#include <cassert>
#include "GeometryModifyTool.hpp"
#include "GeometryQueryTool.hpp"
#include "CubitMessage.hpp"
#include "Body.hpp"
#include "RefVolume.hpp"
#include "RefFace.hpp"
#include "RefEdge.hpp"
#include "RefVertex.hpp"
#include "InitCGMA.hpp"
#include "OCCModifyEngine.hpp"
#include "CubitCompat.hpp"
#include <algorithm>
Go to the source code of this file.
Defines | |
#define | SRCDIR . |
#define | STRINGIFY_(X) #X |
#define | STRINGIFY(X) STRINGIFY_(X) |
#define | SRCPATH STRINGIFY(SRCDIR) "/" |
#define | PRINT_SEPARATOR PRINT_INFO("=======================================\n"); |
Functions | |
CubitStatus | read_geometry (int, char **, bool local=false) |
CubitStatus | make_Point () |
int | main (int argc, char **argv) |
std::string | type_from_file_name (const std::string &filename) |
CubitStatus | read_geometry (int num_files, const char **argv, bool local) |
operation, another simple C++ driver for CGM
This program acts as a simple driver for CGM. It reads in a geometry, and performs varies checks for bodies, surfaces, curves and vertices.
Definition in file operation.cpp.
#define PRINT_SEPARATOR PRINT_INFO("=======================================\n"); |
Definition at line 39 of file operation.cpp.
#define SRCDIR . |
Definition at line 28 of file operation.cpp.
Definition at line 33 of file operation.cpp.
#define STRINGIFY | ( | X | ) | STRINGIFY_(X) |
Definition at line 32 of file operation.cpp.
#define STRINGIFY_ | ( | X | ) | #X |
Definition at line 31 of file operation.cpp.
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 43 of file operation.cpp.
{ CubitStatus status = InitCGMA::initialize_cgma("OCC"); if (CUBIT_SUCCESS != status) return 1; //Do make point. status = make_Point(); if (status == CUBIT_FAILURE) PRINT_INFO("Operation Failed"); int ret_val = ( CubitMessage::instance()->error_count() ); if ( ret_val > 0 ) { PRINT_ERROR("Errors found during Mergechk session.\n"); } return ret_val; }
CubitStatus read_geometry | ( | int | , |
char ** | , | ||
bool | local = false |
||
) |
CubitStatus read_geometry | ( | int | num_files, |
const char ** | argv, | ||
bool | local | ||
) |
attribs module: list, modify attributes in a give model or models
Arguments: file name(s) of geometry files in which to look
Definition at line 84 of file operation.cpp.
{ CubitStatus status = CUBIT_SUCCESS; GeometryQueryTool *gti = GeometryQueryTool::instance(); assert(gti); int i; PRINT_SEPARATOR; for (i = 0; i < num_files; i++) { std::string type = type_from_file_name( argv[i] ); if (type.empty()) // just guess OCC type = "OCC"; std::string filename( local ? "./" : SRCPATH ); filename += argv[i]; status = CubitCompat_import_solid_model(filename.c_str(), type.c_str()); if (status != CUBIT_SUCCESS) { PRINT_ERROR("Problems reading geometry file %s.\n", filename.c_str()); abort(); } } PRINT_SEPARATOR; return CUBIT_SUCCESS; }
std::string type_from_file_name | ( | const std::string & | filename | ) |
Definition at line 62 of file operation.cpp.
{ size_t dot_pos = filename.find_last_of( '.' ); if (dot_pos == std::string::npos) return std::string(); std::string extension = filename.substr( dot_pos + 1 ); std::transform( extension.begin(), extension.end(), extension.begin(), ::tolower ); if (extension == "occ" || extension == "brep") return "OCC"; else if (extension == "step" || extension == "stp") return "STEP"; else if (extension == "iges" || extension == "igs") return "IGES"; else return std::string(); }