一些关于使用ufun进行CAM加工设置参数的简单函数示例
一些关于使用ufun进行CAM加工设置参数的简单函数示例
可以参考下,常用的方式!
static int set_tool_param( int jj, tag_t toolTag )
{
double toolDia = 0, toolRad = 3;
/* Modify the default 5-Parameter Milling Tool */
switch( jj )
{
/* Tool No. 1 */
/* Add a 3.0 MM crad */
case 1:
{
UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, toolRad );
break;
}
/* Tool No. 2 */
/* Make this a Ball Nose */
case 2:
{
UF_PARAM_ask_double_value( toolTag, UF_PARAM_TL_DIAMETER, &toolDia );
UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, toolDia/2 );
break;
}
/* Tool No. 3 */
/* Define a smaller Ball Nose */
case 3:
{
UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_DIAMETER, 25.0 );
UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, (25.0/2) );
break;
}
default:
{
printf( "Default...\n" );
}
}
return 0;
}
static int cav_mill_param( int numop, tag_t *operTag )
{
/* int numop;*/
double depthPerCut;
double stockPart;
UF_PARAM_ask_double_value( operTag , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, &depthPerCut);
printf(" Depth/Cut default is set to %f\n", depthPerCut );
UF_PARAM_set_double_value( operTag , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, 12.000 );
UF_PARAM_ask_double_value( operTag , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, &depthPerCut );
printf(" Verify Depth/Cut reset to %f\n", depthPerCut );
UF_PARAM_ask_double_value( operTag , UF_PARAM_STOCK_PART, &stockPart );
printf(" Part Stock default is set to %f\n", stockPart );
UF_PARAM_set_double_value( operTag , UF_PARAM_STOCK_PART, 1.0 );
UF_PARAM_ask_double_value( operTag , UF_PARAM_STOCK_PART, &stockPart );
printf(" Verify Part Stock reset to %f\n", stockPart );
UF_PARAM_set_int_value( operTag, 327, UF_PARAM_cut_trace_method_tolerant );
UF_PARAM_set_int_value( operTag, 328, UF_PARAM_cut_ctrl_trim_method_silhoutte );
return 0;
}
static int flow_cut_param( int numop, tag_t *operTag )
{
UF_PARAM_disp_tool_t display_data;
display_data.type = 2; /* Type = 2 produces 3D tool display in tool path. */
display_data.frequency = 10;
UF_PARAM_set_subobj_ptr_value( operTag, UF_PARAM_DISP_TOOL , &display_data );
UF_PARAM_ask_subobj_ptr_value( operTag, UF_PARAM_DISP_TOOL , &display_data );
printf("Display data for tool type returns %d\n", display_data.type );
printf("Display data for tool frequency returns %d\n", display_data.frequency );
return 0;
}
static int area_mill_param( int numop, tag_t *operTag )
{
UF_PARAM_set_int_value( operTag,UF_PARAM_CUT_EDGE_TRACE_REMOVAL,UF_PARAM_edge_trace_removal_on );
/* 1 = Warning, 2 = Skip, 3 = Retract*/
UF_PARAM_set_int_value( operTag,UF_PARAM_AVOIDANCE,UF_PARAM_avoid_stepover );
UF_PARAM_set_int_value( operTag,UF_PARAM_CUT_FOLLOW_CHECK_STATUS,UF_PARAM_cut_follow_check_on );
return 0;
}
页:
[1]