/*! \file BATCHSAM.cpp \brief BATCHSAM a Catia V4 batch sample $Id$ BATCHSAM.cpp \author Hans Lenting (c), mailto:hans@catgeo.net \date Thu Jun 13 11:22:14 DFT 2002 */ #include #include "batchsam.h" using namespace std; int main(int argc, char** argv) { //------------------------------------------------------------------------- // Check for right number of arguments, if not exit //------------------------------------------------------------------------- if(argc < 3 || argc > 3) { cout << "\n usage ./BATCHSAM [DSNAME/DLNAME] [MODEL_NAME]\n\n"; //exit program exit (1); }//end if //------------------------------------------------------------------------- // Declarations //------------------------------------------------------------------------- int ModelNumber = 1; int Error; char DDname[9]; char Proj[8]; char Group[8]; char User[8]; char Account[8]; char Passwd[8]; char Volume[7]; int Index; int Data; double Unit; string Member = "MODEL "; //------------------------------------------------------------------------- // Fill variables with arguments //------------------------------------------------------------------------- string DSName = argv[1]; string ModelName = argv[2]; // ------------------------------------------------------------------------ // Print arguments used to stdout // ------------------------------------------------------------------------ cout << "\n\nBATCHSAM was called with: \n\n"; cout << argv[1] << ' '; cout << argv[2] << ' '; cout << "\n\n"; // ------------------------------------------------------------------------ // Logon to the catgeo librairies and open model // ------------------------------------------------------------------------ //Logon catgeo(); //Cold start glogon(Proj, Group, User, Account, Passwd, Error); if( Error != 0 ) gilerr(Error); //Initialize ModelLocation with spaces DSName.append((44 - DSName.length()), ' '); //Get DDname gifddn((char*)Member.c_str(), (char*)DSName.c_str(), DDname, Volume, Error); if( Error != 0 ) gilerr(Error); //Read the size of the model gimsiz(DDname, (char*)ModelName.c_str(), Index, Data, Error); //Increase index and datatable Index += 2000; Data += 2000; //Read the model ModelNumber = 1; gimrea(ModelNumber, DDname, (char*)ModelName.c_str(), Index, Data, Error); if( Error != 0 ) gilerr(Error); // ------------------------------------------------------------------------ // Add your code here // ------------------------------------------------------------------------ //Example code read unit of model giruni(ModelNumber, Unit, Error); if( Error != 0 ) gilerr(Error); cout << "Modelunit (number of mm per unit): " << Unit << "\n\n"; // ------------------------------------------------------------------------ // Return // ------------------------------------------------------------------------ return 0; }//main