/****************************************************************************** Copyright (c) 1999 Unigraphics Solutions, Inc. Unpublished - All Rights Reserved *******************************************************************************/ /* The following is an example of a users program, written as a user exit to be executed at startup of Unigraphics, to check the current pointer to a registered program and register a new one. */ #include #include #include #include #include static int my_new_partno_func ( UF_UGMGR_new_part_no_p_t appl_data ) { int ifail = 0; const char* old_item = appl_data->old_item; const char* item_type = appl_data->item_type; char partno[132], *ptr = partno; /* Just return for now... */ strcpy(appl_data->new_id, ""); strcpy(appl_data->new_name, ""); strcpy(appl_data->new_description, ""); appl_data->part_number_modifiable = TRUE; appl_data->part_name_modifiable = TRUE; appl_data->part_description_modifiable = TRUE; appl_data->ifail = ifail; partno[0] = '\0'; if (old_item != NULL) strcpy(ptr, old_item); if (item_type != NULL) strcat(ptr, item_type); appl_data->ifail = ifail; return ifail; } /***************************************************************/ extern void ufsta(char *name, int *rtcode, int rtlen) { int irc = 0, argc = 1; const char* argv[] = {"new_partno"}; UF_UGMGR_new_part_no_fn_t old_one; /**************************beginning of executable*******************/ printf("\nstarting partno v1.0\n"); /*********************************************/ irc=UF_UGMGR_initialize(argc, argv);/* get licence*/ if (irc != 0) { printf("Unable to get a UG/Open API/ugmanager license!\n"); return; } printf("got UG/Open API license!\n"); /*********************************************/ /* Make sure we do not have one already. */ irc = UF_UGMGR_ask_new_part_no(&old_one); if (old_one != NULL) { printf("Already registered partno method! &%p\n", old_one); return; } /* Try and register the routine as supplied. */ irc = UF_UGMGR_reg_new_part_no(my_new_partno_func); if (irc != 0) { printf("Unable to register partno method!\n"); return; } printf("Setting routines all finished, bye bye\n"); UF_UGMGR_terminate(); return; }