|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
" E- }, ^1 Q) c2 ]# {一些关于使用ufun进行CAM加工设置参数的简单函数示例
4 q0 M# \$ f: f$ U8 Q4 m; I; W可以参考下,常用的方式!/ u9 P+ i i; t; R! C; `' _, N
( u: L; f X1 s. m' B, q' O) Rstatic int set_tool_param( int jj, tag_t toolTag )
. i9 N1 F2 R* k A0 d# k ?{
6 {6 P0 K1 _6 f" R! K double toolDia = 0, toolRad = 3;
( h3 Z) x: d6 T$ x4 L
5 L+ z ^( k: t. k/* Modify the default 5-Parameter Milling Tool */
" S* n' i5 j; p J5 g" T5 V. J$ n
+ ^) t P9 v: _ l" s: K3 [* Y swiTCh( jj )
0 ~ x1 U, ]0 C) D# t5 [ {
n$ r% H( b V" K& ]/* Tool No. 1 */ B9 P( V9 R5 r9 d- k# F
/* Add a 3.0 MM crad */
# F9 H, ?9 [& }2 a3 Q% I case 1:$ S' d+ V, ?2 N* w' N: g6 v
{
9 f9 s! u! ]% H% Q UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, toolRad );
& n: t; u/ d0 c/ Y/ h$ s break;
5 v+ _2 [/ e8 v) b- |1 o3 ` }! L4 R. {! S$ y" R3 y) p
/* Tool No. 2 */
( X+ Y/ _, Y, y# {2 O* C9 ~% H/* Make this a Ball Nose */
& P9 o8 V+ D) I4 S5 X' E* e case 2:) S" f4 Y8 \) {9 e7 K( _
{
& I4 B# n- H6 p7 `9 G* K/ A UF_PARAM_ask_double_value( toolTag, UF_PARAM_TL_DIAMETER, &toolDia );
* N3 d+ @+ c- ^ UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, toolDia/2 );/ d. K$ P# S# u
break;
/ `- S0 c' X, e/ d& i }
" a, h: j- z! m/* Tool No. 3 */% i3 e3 c1 N0 l+ P3 z( X& ^
/* Define a smaller Ball Nose */0 V/ `4 y) n9 ^/ w/ [) U1 ?8 i
case 3:
/ y% G! O# z0 m' s" C% s/ e {2 T! i: f: O5 h, @1 j' n
UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_DIAMETER, 25.0 );( B# s$ X9 ]$ z8 \1 j7 z' G
UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, (25.0/2) );6 n A7 f3 Z' y& Y# L4 t
break;, o3 a p, F# z* A: E" W _1 {
}
0 d8 K! m5 Z- j default:: f9 o3 ~& ~) N4 Z( n1 Z
{4 u" u( ] G, t( \' q) A3 b
printf( "Default...\n" );
. @3 M0 ^' I1 w; P0 C, z }3 C( ~2 c d% A$ q' _, A
}
% u: P3 Q. }8 Z% R+ `; F return 0;8 v! w/ O2 O; o/ ^5 w
}
2 M; ?1 U% i5 I& p+ n! O9 s' {. J# `/ A: U
static int cav_mill_param( int numop, tag_t *operTag )
6 a7 P! z0 ^8 D+ Q' ~{2 p+ u! x# \% v' l7 J/ V. x7 |0 r; F' ?
/* int numop;*/3 h' r2 @4 k: `0 L9 X
double depthPerCut;" h0 w E; m) s/ |/ |
double stockPart;
8 e5 Q; c0 X1 i, W+ _
5 a9 a7 u% t3 w UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, &depthPerCut);' w. W* M4 B8 P. x- o* [
printf(" Depth/Cut default is set to %f\n", depthPerCut );
3 \& G9 @/ I: i* j% S- Y UF_PARAM_set_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, 12.000 );
: X- |3 T. g9 [/ D2 t" } B UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, &depthPerCut );
& M5 }* j, b9 y( k) m printf(" Verify Depth/Cut reset to %f\n", depthPerCut );& ~9 K" u) j- K' o; A+ z
0 J9 V1 D# E) e7 S2 b6 P. ~ UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, &stockPart );; N9 @+ b6 c2 ~6 B
printf(" Part Stock default is set to %f\n", stockPart );
# s6 s, \2 F; K4 U7 t3 ` UF_PARAM_set_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, 1.0 );
6 @1 `3 H5 p8 T UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, &stockPart );+ H/ l; F9 Y3 @
printf(" Verify Part Stock reset to %f\n", stockPart );
- d8 u- K" `/ y! y$ v* P5 c/ l
UF_PARAM_set_int_value( operTag[numop-1], 327, UF_PARAM_cut_trace_method_tolerant );
' G* s3 W& Y0 o7 { UF_PARAM_set_int_value( operTag[numop-1], 328, UF_PARAM_cut_ctrl_trim_method_silhoutte );
) p* T4 H1 C$ G
$ U) J5 x/ H8 _ return 0;
! q1 R( l$ |6 v, n' x8 m}
$ y# l' Q6 `/ ^" u# ^! ]! d6 q) ?2 ?. T
static int flow_cut_param( int numop, tag_t *operTag )
) J2 R; q3 @5 _; w{
3 Z1 F9 t& N0 \9 K UF_PARAM_disp_tool_t display_data;( c& C$ W- f! J; G9 W
display_data.type = 2; /* Type = 2 produces 3D tool display in tool path. */
2 n5 [4 U' S4 Y5 H display_data.frequency = 10;
4 c9 {; b$ c) o+ U) _: n- J z# _8 w/ K. i- v/ g
UF_PARAM_set_subobj_ptr_value( operTag[numop-1], UF_PARAM_DISP_TOOL , &display_data );
0 t8 c+ a& Z+ t6 }/ m0 p, ]/ `9 x UF_PARAM_ask_subobj_ptr_value( operTag[numop-1], UF_PARAM_DISP_TOOL , &display_data );
9 M8 |: S: y& \% c printf("Display data for tool type returns %d\n", display_data.type );) N; f: A1 B# w2 y
printf("Display data for tool frequency returns %d\n", display_data.frequency );
, E! l/ }: T; m" v$ ?/ I' D( `8 J
return 0;
. h/ t" T7 M) ^' M2 y}
% s2 y. C9 K0 S* @/ u; q
2 y' C% i' @& H0 E/ mstatic int area_mill_param( int numop, tag_t *operTag )
% H* E8 x) B4 p; M& @1 P! K{4 H" z3 }2 j$ Z: O& h
3 i( q- a7 @ J, z
UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_CUT_EDGE_TRACE_REMOVAL,UF_PARAM_edge_trace_removal_on );' ]3 ]% s ^3 `. ^
; D% e* o6 t% O+ t3 f0 b6 U1 B
/* 1 = Warning, 2 = Skip, 3 = Retract */ & z( b5 Y+ D: R% {# t
' @6 V3 C8 A; b7 P1 d5 H, | UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_AVOIDANCE,UF_PARAM_avoid_stepover );
2 h! i0 ~# y8 v _$ P- v UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_CUT_FOLLOW_CHECK_STATUS,UF_PARAM_cut_follow_check_on );
' X7 m# I* J" b L3 C* b3 S2 ?, Q8 \3 r
return 0;" v- c& G v: U( |
}+ w6 b# }/ i; b0 @' ]. e6 X
% ~5 {! M. G' B8 f2 m
|
|