Author: sjackson Date: 2010-05-14 14:34:52 -0500 (Fri, 14 May 2010) New Revision: 3903 Modified: cgm/trunk/itaps/iGeom_CGMA.cc Log: Workaround to allow iGeom to export .step and .iges files Background: The import and export functions of the AcisQueryEngine accept optional log file names, and will, for some file formats, always write a default log file if no name is provided. AcisQueryEngine misuses strcpy as follows: char* log_filename = NULL; if( {no user-provided log name} ) strcpy( log_filename, "default_logfile" ); // writes to null pointer This means that importing or exporting .step or .iges files from iGeom results in a segfault. This checkin works around this problem for exporting files only. (Fixing .step/.iges import would require changing iGeom to use GeometryQueryTool::import_solid_model() instead of the simpler GeometryQueryTool::read_geometry_file() currently used.) Fixing the bugs in AcisQueryEngine would be more appropriate than this workaround, however: * This is the only way to fix CGM when built against Cubit 10, and * AcisQueryEngine may see an overhaul when CGM is upgraded for Cubit 12. Modified: cgm/trunk/itaps/iGeom_CGMA.cc =================================================================== --- cgm/trunk/itaps/iGeom_CGMA.cc 2010-05-14 16:41:09 UTC (rev 3902) +++ cgm/trunk/itaps/iGeom_CGMA.cc 2010-05-14 19:34:52 UTC (rev 3903) @@ -501,12 +501,24 @@ ERROR(iBase_FAILURE, "Unknown geometry file extension and no file type."); } + /** + * Work around AcisQueryEngine log file handling bug: + * If the export format is iges or step, be sure the log file name is not null + */ + const char* logfile_name = NULL; + if( file_type == "IGES" ){ + logfile_name = "igeom_iges_export.log"; + } + else if( file_type == "STEP" ){ + logfile_name = "igeom_step_export.log"; + } + // process options (none right now...) DLIList<RefEntity*> bodies; int num_ents_exported; CubitString cubit_version(" (iGeom)"); CubitStatus status = gqt->export_solid_model(bodies, name, file_type.c_str(), - num_ents_exported, cubit_version); + num_ents_exported, cubit_version, logfile_name ); if (CUBIT_SUCCESS != status) ERROR(iBase_FAILURE, "Trouble saving geometry file.");
participants (1)
-
sjackson@cae.wisc.edu