//=========================================================================== // GoTools Core - SINTEF Geometry Tools Core library, version 2.0.1 // // Copyright (C) 2000-2007, 2010 SINTEF ICT, Applied Mathematics, Norway. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation version 2 of the License. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. // // Contact information: E-mail: tor.dokken@sintef.no // SINTEF ICT, Department of Applied Mathematics, // P.O. Box 124 Blindern, // 0314 Oslo, Norway. // // Other licenses are also available for this software, notably licenses // for: // - Building commercial software. // - Building software whose source code you wish to keep private. //=========================================================================== 00013 #ifndef FALSE 00014 #define FALSE 0 00015 #endif 00016 00017 00018 00019 00020 int main(int argc, char** argv) 00021 { 00022 if (argc!=3) 00023 { 00024 std::cerr << "usage: <infile name> <outfile name>\n"; 00025 return -1; 00026 } 00027 00028 FILE* from_file = fopen(argv[1], "r" ); 00029 if (!from_file) 00030 { 00031 std::cout << "File does not exist!" << std::endl; 00032 return -1; 00033 } 00034 std::ofstream outfile(argv[2]); 00035 00036 int nmb_objs = 1; 00037 // char string[80]; /* character to read $ which identifies a comment */ 00038 //read_non_comment(from_file,string); 00039 //sscanf(string,"%d",&nmb_objs); 00040 int kstat = 0; 00041 int ki; 00042 for (ki = 0; ki < nmb_objs; ++ki) 00043 { 00044 SISLObject* ob=NULL; 00045 file_to_obj(from_file, &ob, &kstat); 00046 if (kstat<0) 00047 { 00048 std::cerr << "file_to_obj returned :" << kstat << std::endl; 00049 return -1; 00050 } 00051 if (ob && ob->iobj==2) 00052 { 00053 Go::SplineSurface* gs=Go::SISLSurf2Go(ob->s1); 00054 gs->writeStandardHeader(outfile); 00055 gs->write (outfile); 00056 } 00057 else if (ob && ob->iobj==1) 00058 { 00059 Go::SplineCurve* gc=Go::SISLCurve2Go(ob->c1); 00060 gc->writeStandardHeader(outfile); 00061 gc->write (outfile); 00062 } 00063 else 00064 { 00065 std::cerr << "Nothing to write" << std::endl; 00066 } 00067 if (ob) delete ob; 00068 } 00069 00070 if (from_file) fclose(from_file); 00071 }