- 积分
- 10
- 注册时间
- 2007-10-5
- 仿真币
-
- 最后登录
- 1970-1-1
|
#include <uf_param.h>
#include <uf_param_indices.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <uf.h>
#include <uf_defs.h>
#include <uf_assem.h>
#include <uf_ncgroup.h>
#include <uf_oper.h>
#include <uf_setup.h>
#include <uf_ui.h>
/* Error Display */
static void PrintErrorMessage( int errorCode );
/* Callback Function for Cycling members of a group */
static logical Cycle_Tag(tag_t tag, void *data);
logical Cycle_Tag(tag_t tag, void *data)
{
int ecode;
int iVvalue;
char name[UF_OPER_MAX_NAME_LEN + 1];
logical answer;
double dVvalue1=0, dVvalue2=0;
double eVvalue[2]= { 99, 98};
char buff[132] = "";
strcpy(name, "");
ecode = UF_NCGROUP_is_group(tag, &answer);
if( answer == 0 ){
/* Ask the operation name */
ecode = UF_OPER_ask_name_from_tag(tag, name);
if( strcmp(name, (char *)data) == 0 ){
uc1601(name, 1);
/* Set the step over parameter */
dVvalue2 = .123;
ecode = UF_PARAM_set_double_value(tag, UF_PARAM_STEPOVER_DIST, dVvalue2);
ecode = UF_PARAM_set_double_value(tag, UF_PARAM_ENG_DIST, dVvalue2);
ecode = UF_PARAM_ask_int_value(tag,UF_PARAM_ENG_INIT_TYPE, &iVvalue);
printf("iVvalue is : %d \n",iVvalue);
if( ecode == 0 ){
}
return FALSE;
}
}
PrintErrorMessage(ecode);
return TRUE;
}
/* Main */
void ufusr( char *parm, int *returnCode, int rlen )
{
tag_t part_tag;
int error = 0;
tag_t setup_tag;
tag_t program_root_tag;
int errorCode;
char opr_name[132];
errorCode = UF_initialize();
if ( errorCode == 0 ){
part_tag = UF_ASSEM_ask_work_part();
if( part_tag != NULL_TAG ){
error = UF_SETUP_ask_setup(&setup_tag);
error = UF_SETUP_ask_program_root(setup_tag,
&program_root_tag);
strcpy(opr_name, "PLANAR_MILL");
error = UF_NCGROUP_cycle_members(program_root_tag,
Cycle_Tag, (void
*)opr_name);
}
/* Terminate the API environment */
errorCode = UF_terminate();
}
/* Print out any error messages */
PrintErrorMessage( errorCode );
}
extern int ufusr_ask_unload( void )
{
return( UF_UNLOAD_IMMEDIATELY );
}
/* PrintErrorMessage */
static void PrintErrorMessage( int errorCode )
{
if ( errorCode != 0 ){
char message[133];
UF_get_fail_message( errorCode, message );
/* Print out the message */
UF_UI_set_status( message );
fprintf( stderr, "%s\n", message );
}
} |
|