|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
6 m7 c& A7 w* N9 `0 R一些关于使用ufun进行CAM加工设置参数的简单函数示例
% |$ h P. D5 `: g; w( T' |; p可以参考下,常用的方式!
+ d0 `$ T) k- P3 [4 f) z' J
2 \2 J8 ~2 b1 p1 g Kstatic int set_tool_param( int jj, tag_t toolTag )* E2 v9 P" k+ Y$ Q* E% L% `7 a
{
5 o) v- r6 B: d# K double toolDia = 0, toolRad = 3;
5 i# ^( [1 Q1 @8 G3 [4 D5 @1 \2 U8 F% Z% r" {& P+ M6 D
/* Modify the default 5-Parameter Milling Tool */0 Z' ~. ?# W* x" Z5 F
2 G0 e! `# q& s. A3 N
swiTCh( jj )# a: s' l, [7 x; [6 P- Z
{
* [+ p' P# \; D6 n6 l' a/* Tool No. 1 */
7 K. G3 d5 y; d! D% n' p/* Add a 3.0 MM crad */
2 T0 L$ ^# g' Q* C case 1:6 q3 E1 s q4 K+ o
{
: r! p' ~+ d: C; `0 I" Q/ X UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, toolRad );
' L8 ^9 N6 a1 S0 H+ ] break;
2 H- ~" q4 \/ a. z }; f9 H9 m3 [! S, }2 Y4 E. ]- h4 e9 Y
/* Tool No. 2 */
j7 p+ P- j" q$ T/* Make this a Ball Nose */3 D& R& Y z3 e. N
case 2:7 h9 z* h( r5 H- k4 I; T
{" E5 u6 x0 k( H3 B. A4 l" b) x
UF_PARAM_ask_double_value( toolTag, UF_PARAM_TL_DIAMETER, &toolDia );$ c* D- i% x% w
UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, toolDia/2 );, J; ? E C" k
break;
: j1 f0 g, q- `) C3 e i! Q }
9 L# Z1 L& l+ i/ [; k/* Tool No. 3 */
* |9 k5 x4 J- q% l& B/* Define a smaller Ball Nose */9 w a; p* A4 q8 `: v7 F
case 3:! u v; f' F D* |& |7 M
{
8 e4 Y4 Y+ W, Q, c UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_DIAMETER, 25.0 );
% k, w8 T* }" ~) a8 G UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, (25.0/2) );: o5 G5 \% v/ V
break;2 x T8 e# B* H) H; ^$ j
}
7 q/ J8 K6 {" I8 A" L' P3 | default:. t$ q8 m& Z2 X
{
5 L. b( [& s! p3 k C printf( "Default...\n" ); S% @3 k# j; E. [ N! f
}
+ R4 p" w: u8 k }3 m+ {( ^- C! L$ L: s
return 0;
; e# f0 |, d% {8 t4 T}0 x7 M& _2 T, `9 c8 D
: L; ~1 W( R$ ~9 L5 K" }2 F
static int cav_mill_param( int numop, tag_t *operTag )6 I8 |) ]9 B |; \" k$ [
{
' A" B! h/ Y8 g* d/* int numop;*/
e& S/ Q5 W& N9 B. |$ v double depthPerCut;# k/ R t4 `5 }) e
double stockPart;
0 X% ?" \4 r* u( X% y/ L/ d/ H* ~0 g) o/ j5 P, u4 S7 G; {
UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, &depthPerCut);( \& @" b- C: w
printf(" Depth/Cut default is set to %f\n", depthPerCut );
7 O3 y4 \& d `; }9 J! n$ }* O9 G UF_PARAM_set_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, 12.000 );
6 X: B* O! E& v- g9 d1 ]2 q UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, &depthPerCut );, U r! Y. ~, ~7 y% | J& h5 T5 E' S
printf(" Verify Depth/Cut reset to %f\n", depthPerCut );0 k. ^( Z# I" m2 x; h, o' q
5 |& e0 p5 C9 ^ R. l
UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, &stockPart );
/ y5 }7 A' @' C6 z* o$ ` printf(" Part Stock default is set to %f\n", stockPart );- ^9 R3 e9 j7 q x" X$ i
UF_PARAM_set_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, 1.0 );* O3 O, f1 u6 y) D8 u
UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, &stockPart );8 l; D, q7 g8 A, j' T$ R
printf(" Verify Part Stock reset to %f\n", stockPart );, b0 c( U) U8 s" S9 U
/ W7 B0 m" L2 u7 N | UF_PARAM_set_int_value( operTag[numop-1], 327, UF_PARAM_cut_trace_method_tolerant );0 P$ S6 L2 w& e; c9 x( R7 _
UF_PARAM_set_int_value( operTag[numop-1], 328, UF_PARAM_cut_ctrl_trim_method_silhoutte );4 U# g; B) d$ _. X! n* B- a/ {) [
- e, l" m! I- k, W% y
return 0;1 i: I* p0 _' ~7 b# o
}
/ a5 z% p4 y1 w" a8 z$ }$ }7 i' p$ @$ [: z
static int flow_cut_param( int numop, tag_t *operTag )6 _; c5 _8 d7 z
{
8 N, F& n7 C: u/ z UF_PARAM_disp_tool_t display_data;
6 j E" p0 R! p* c display_data.type = 2; /* Type = 2 produces 3D tool display in tool path. */
" _' ^6 O( T4 Q$ `* C, F& v" R display_data.frequency = 10;
: S% @& w8 Q$ O4 k4 i8 G5 s3 P9 }0 R3 I1 u+ ?
UF_PARAM_set_subobj_ptr_value( operTag[numop-1], UF_PARAM_DISP_TOOL , &display_data );+ G5 Q% h& ~+ i# [
UF_PARAM_ask_subobj_ptr_value( operTag[numop-1], UF_PARAM_DISP_TOOL , &display_data );
7 C4 i. O+ l, n! D5 q4 Y+ n$ j printf("Display data for tool type returns %d\n", display_data.type );
" h% E g: H' Z9 R) @$ V printf("Display data for tool frequency returns %d\n", display_data.frequency );
* b$ A6 T# j. i# s5 e. H: K0 F6 [4 H
return 0;
7 K" b* X* C7 _( D M1 j9 h}
' c3 c, j; l: A+ j
% M" h, I+ i+ i R! qstatic int area_mill_param( int numop, tag_t *operTag )
+ T4 \5 M0 B1 q; J{
1 h7 o9 u! @* _ f9 B
) {/ k; L4 q" ] UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_CUT_EDGE_TRACE_REMOVAL,UF_PARAM_edge_trace_removal_on );* ~% h( x2 r2 E0 I! g# g1 j
. p, Z, i; n& b' y5 j8 J; D/ ?% g
/* 1 = Warning, 2 = Skip, 3 = Retract */ ) M! L' B c6 ~! Q
2 A" c) a" W' C. G
UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_AVOIDANCE,UF_PARAM_avoid_stepover );
7 W+ M- |" ^. q UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_CUT_FOLLOW_CHECK_STATUS,UF_PARAM_cut_follow_check_on );
, a8 P) F: A: L9 }1 z, o! W- @; M; w& o9 T* X4 O9 \- D' v. ~
return 0;
/ C" c! J: N0 X: B& b4 a- g7 C. g, B}/ Q. M& _9 {; V1 j5 q3 q3 P, E. \
; I4 M' @8 j" o1 E, |$ K |
|