/* III GGGG EEEEE SSSS CCCC OOOOO PPPP Y Y CCCC ** I G E S C O O P P Y Y C ** I G GGG EEEE SSS C O O PPPP Y C ** I G G E S C O O P Y .. C ** III GGG EEEEE SSSS CCCC OOOOO P Y .. CCCC ** ** Copyright 1989,1997 by Dennette A Harrod, Jr ** (d.b.a. "WiZ WORX", Concord, MA) All rights reserved. */ // Copyright (c) 2006 by Dennette@WiZ-WORX.com (Washington, DC) #include "igs_util.h" #include "grafix.h" /* defines IGES colors & line-fonts */ #define VER_NUM "9.3" /**************************************************************************/ void version(void) { fprintf(stderr, "\nIGESCOPY(tm) - IGES File Copier - Version %s (%s)\n", VER_NUM, VER_DATE); MSG("Copyright (c) 1989,2006 by Dennette@WiZ-WORX.com All rights reserved.\n"); } /**************************************************************************/ void instruct(void) { version(); NLINE; MSG("Syntax: IGESCOPY [ ]"); NLINE; MSG("Default file extension for is '.igs'"); MSG("If is omitted, the file '.new' is created."); author(); } /**************************************************************************/ /* get the "de-th" entity from the input file and copy it ** to the output file ... examine and change anything ** about the entity you want to between "get" & "put" calls */ void copyent(PNTR de) { ENTITY ent; /* local copy of IGES entity */ pinwheel(); /* rotating cursor shows activity */ getent(de, &ent); /* get entity from input IGES file */ /* here are simple examlpes of changing two DE values - ** COLOR and LINEFONT */ if (ent.e_color.ival == I_BLUE) /* 4 = blue */ ent.e_color.ival = I_RED; /* 2 = red */ if (ent.e_lfont.ival == I_DOTTED) /* 5 = dotted */ ent.e_lfont.ival = I_DASHED; /* 2 = dashed */ /* *ALWAYS* finish with a PUT and a FREE */ putent(&ent); /* put entity to output IGES file */ freent(&ent); /* recover dynamic memory */ } /**************************************************************************/ int main(int argc, char *argv[]) { PNTR de, de_max; char of_name[80]; if (argc > 1) version(); /* say hello */ else { instruct(); /* clueless! */ exit(1); } de_max = openiges(argv[1]); /* open input IGES file */ lsttermin(); /* show Terminate Section */ if (argc == 3) /* user provided name */ strcpy(of_name, argv[2]); else { /* create default name */ strcpy(of_name, argv[1]); of_name[strcspn(of_name, ".")] = '\0'; /* strip extension */ strcat(of_name, ".new"); /* add default extension */ } outfopen(of_name); /* open output IGES file */ MSG("\nReading... "); for (de = 1; de <= de_max; de += 2) /* entity by entity... */ copyent(de); /* copy from input to output */ MSG("\bWriting..."); outfclose(); /* close output IGES file */ goodbye(); /* say good-night, gracie */ }