cgma
|
00001 #include "CubitCompat.h" 00002 #include "CubitCompat.hpp" 00003 #include "GeometryQueryTool.hpp" 00004 #include <string.h> 00005 00006 #define CUBIT_COMPAT_FT_ELIF(TYPE) \ 00007 else if (!strcmp(file_type,#TYPE)) \ 00008 return TYPE ## _TYPE 00009 00010 static Model_File_Type 00011 CubitCompat_file_type( const char* file_type ) 00012 { 00013 if (!file_type) 00014 return MFT_NOT_DEFINED; 00015 CUBIT_COMPAT_FT_ELIF(IGES); 00016 CUBIT_COMPAT_FT_ELIF(CATIA); 00017 CUBIT_COMPAT_FT_ELIF(STEP); 00018 CUBIT_COMPAT_FT_ELIF(PROE); 00019 CUBIT_COMPAT_FT_ELIF(GRANITE); 00020 CUBIT_COMPAT_FT_ELIF(GRANITE_G); 00021 CUBIT_COMPAT_FT_ELIF(GRANITE_SAT); 00022 CUBIT_COMPAT_FT_ELIF(GRANITE_PROE_PART); 00023 CUBIT_COMPAT_FT_ELIF(GRANITE_PROE_ASM); 00024 CUBIT_COMPAT_FT_ELIF(GRANITE_NEUTRAL); 00025 CUBIT_COMPAT_FT_ELIF(NCGM); 00026 CUBIT_COMPAT_FT_ELIF(CATIA_NCGM); 00027 CUBIT_COMPAT_FT_ELIF(CATPART); 00028 CUBIT_COMPAT_FT_ELIF(CATPRODUCT); 00029 CUBIT_COMPAT_FT_ELIF(FACET); 00030 CUBIT_COMPAT_FT_ELIF(SOLIDWORKS); 00031 CUBIT_COMPAT_FT_ELIF(OCC); 00032 else 00033 return MFT_NOT_DEFINED; 00034 } 00035 00036 CubitStatus 00037 CubitCompat_import_solid_model( const char* file_name, 00038 const char* file_type, 00039 const char* logfile_name, 00040 CubitBoolean heal_step, 00041 CubitBoolean import_bodies, 00042 CubitBoolean import_surfaces, 00043 CubitBoolean import_curves, 00044 CubitBoolean import_vertices, 00045 CubitBoolean free_surfaces, 00046 DLIList<RefEntity*> *imported_entities) 00047 { 00048 const bool print_results = false; 00049 const bool merge_globally = false; 00050 const bool no_assembly_level_features = false; 00051 ModelImportOptions CubitCompat_opts = { heal_step, 00052 print_results, 00053 import_bodies, 00054 import_surfaces, 00055 import_curves, 00056 import_vertices, 00057 free_surfaces, 00058 merge_globally, 00059 no_assembly_level_features, 00060 logfile_name ? logfile_name : "" }; 00061 00062 return GeometryQueryTool::instance()->import_solid_model( 00063 file_name, 00064 CubitCompat_file_type(file_type), 00065 CubitCompat_opts, 00066 imported_entities ); 00067 } 00068 00069 CubitStatus 00070 CubitCompat_export_solid_model( DLIList<RefEntity*>& ref_entity_list, 00071 const char* filename, 00072 const char * filetype, 00073 int &num_ents_exported, 00074 const CubitString &cubit_version, 00075 const char* logfile_name ) 00076 { 00077 // const bool print_results = false; 00078 // const bool merge_globally = false; 00079 // const bool no_assembly_level_features = false; 00080 ModelExportOptions CubitCompat_opts = {1, logfile_name ? logfile_name : "" }; 00081 00082 return GeometryQueryTool::instance()->export_solid_model( 00083 ref_entity_list, 00084 filename, 00085 CubitCompat_file_type(filetype), 00086 num_ents_exported, 00087 cubit_version, 00088 CubitCompat_opts ); 00089 }