|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- c% N9 |& F) [. C6 w3 s
一些关于使用ufun进行CAM加工设置参数的简单函数示例
! z7 k" Z' U6 F- ?! [可以参考下,常用的方式!
: y6 j4 t# K2 j# ~* [6 I; w# f! a
static int set_tool_param( int jj, tag_t toolTag )
* O9 S1 @ M# |& I{
; k2 d0 S1 \9 ?! P% n double toolDia = 0, toolRad = 3;! O. O6 `, u4 U, |
. B5 ?: M1 B: k# t% O; V9 V. g
/* Modify the default 5-Parameter Milling Tool */ }3 z* x8 }5 ?6 l4 c
) ~5 N( l- A6 N4 P
swiTCh( jj )
' M: {) n8 A8 o6 U- k7 ?4 }; s! q {# K2 @5 v$ J) l f( `0 [* I
/* Tool No. 1 */6 L. I, y: U6 ]1 b! I/ D
/* Add a 3.0 MM crad */
) X" F L+ g0 j3 O' [1 {6 G case 1:
* d* g: Y ]' ~! Z& g {/ E- j: [: i" G- B2 m* I$ m4 _" C
UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, toolRad );
3 ?& k3 N& L! Z& ~) o break;: i2 i/ H" _2 s, B
}/ I9 @" T1 b1 y# q N3 \6 h* Q6 P2 ?
/* Tool No. 2 */
9 w' `. F- E: G* R. a9 A9 v/* Make this a Ball Nose */5 {* L/ x0 X( L k: T
case 2:- [( `- X2 D! q3 l7 H0 d
{+ N- d2 H$ i* I& [" }( J2 d
UF_PARAM_ask_double_value( toolTag, UF_PARAM_TL_DIAMETER, &toolDia );+ A0 i! w5 f: h4 d" v+ b+ Y( I0 J& U
UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, toolDia/2 );
2 j% r6 f; _+ q2 z break;
7 c2 x+ P& g4 q/ Q( l. @ }0 N; s3 F, C* \ z
/* Tool No. 3 */
, V% C+ ?" ~# w/* Define a smaller Ball Nose */
- K" K- ~5 ]: b' T: a9 K8 l7 Z case 3: Z M/ |7 q$ N1 r; d x5 ]9 f
{
0 w. D% H* h3 } UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_DIAMETER, 25.0 );
1 j! j/ _. n* w, h UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, (25.0/2) );7 v4 R2 `( R, S; q
break;6 ~' S& ]+ K% l5 j
}( R5 y$ B2 u% y' o
default:. V0 g5 ^# p8 h8 G1 `& c! O" b
{1 q3 a8 Q2 O# y/ ?; K+ Y A' ~9 V
printf( "Default...\n" );
9 R. B8 U2 m( C* x }
5 \. c, s* S9 T9 \, X$ |6 T! V }
! v0 e0 H" Q3 _ return 0;: m% {1 C& G, D
}
" Q5 T+ b- c& a' F: E" u1 A
0 _; g$ M! i/ {7 Z6 ?static int cav_mill_param( int numop, tag_t *operTag ): h& E1 m4 Q) ]3 h. C2 a
{
0 H2 S# Z' A; v. r: _/* int numop;*/
* K4 T7 k5 J: D% v double depthPerCut;
3 g8 f6 ]! f8 @ double stockPart;
0 h* K ]% h, i' _% |, g: J9 J O& Y
7 p% M: ~; A" Z6 U/ b UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, &depthPerCut);/ ~) U# x0 @# `3 H6 Y- [
printf(" Depth/Cut default is set to %f\n", depthPerCut );% F) a. i$ c. W+ u5 n
UF_PARAM_set_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, 12.000 );
, t4 j( E2 P& k7 `' U UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, &depthPerCut );& b, Z4 f0 Y$ P5 z6 d+ F
printf(" Verify Depth/Cut reset to %f\n", depthPerCut );2 D! p% K6 D% }
: E m+ {; a2 F; t) V n
UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, &stockPart );- p3 I- c" u W9 r: J
printf(" Part Stock default is set to %f\n", stockPart );
# ]7 J2 H8 b& V5 U. V6 H! ]) Q) E UF_PARAM_set_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, 1.0 );
2 k7 [6 E: L0 f; Q: S UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, &stockPart );
/ ?/ u V, Q ~ printf(" Verify Part Stock reset to %f\n", stockPart );9 j) P/ U3 ^4 U3 s( I9 V2 m
; ]4 K6 n& D/ `4 [4 l UF_PARAM_set_int_value( operTag[numop-1], 327, UF_PARAM_cut_trace_method_tolerant );; x* s# Y9 u* z9 o* Y7 Q' j) U8 i
UF_PARAM_set_int_value( operTag[numop-1], 328, UF_PARAM_cut_ctrl_trim_method_silhoutte );1 N2 w9 j' M: b: z
8 w0 t' y9 c' q4 y- |. f return 0;0 ~4 w# G$ ?; S6 `4 g6 ]& i+ g2 ^
}
7 Q1 { @! N3 M. a/ J7 |! x+ h( `# ~: a2 ~
static int flow_cut_param( int numop, tag_t *operTag )
3 u1 m2 c* R( V{
6 ]& q. q' z4 e- B9 A; W UF_PARAM_disp_tool_t display_data;
; v& I/ R# Y$ `* N9 a display_data.type = 2; /* Type = 2 produces 3D tool display in tool path. */+ |$ V: N8 Y# n- X
display_data.frequency = 10;8 L& Q, j. Y- M# {) ^( g( T3 V, t# M
7 i6 _! q+ Q! F- x+ c
UF_PARAM_set_subobj_ptr_value( operTag[numop-1], UF_PARAM_DISP_TOOL , &display_data );6 F$ {+ @5 e" m0 t4 w! f7 _
UF_PARAM_ask_subobj_ptr_value( operTag[numop-1], UF_PARAM_DISP_TOOL , &display_data );
. b# |* _' o2 \; T6 H+ a& I3 f6 X printf("Display data for tool type returns %d\n", display_data.type );
; f c7 ?$ w% { printf("Display data for tool frequency returns %d\n", display_data.frequency );
7 |; B5 @9 j7 k- @' m2 O
) j: @# e6 d, r0 G: p5 Q7 o& S return 0;
' `3 e p/ E3 i$ W9 I}
# ?+ q8 _) i6 F6 K5 F$ O0 [0 R
) [7 G5 C4 h- ]' j7 Tstatic int area_mill_param( int numop, tag_t *operTag )
$ I# K6 c% Q% J$ M) C; p# L. q{
6 t; o, b" y/ q9 q
9 S* A( Q4 J) B6 j UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_CUT_EDGE_TRACE_REMOVAL,UF_PARAM_edge_trace_removal_on );5 o# `$ d& Z# l
: ^7 f7 E3 P3 u4 R
/* 1 = Warning, 2 = Skip, 3 = Retract */ 1 z$ |4 @; I, f. v5 M
! @$ {' Q# ~, }! o
UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_AVOIDANCE,UF_PARAM_avoid_stepover );
y% u' q P4 `- \* Y UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_CUT_FOLLOW_CHECK_STATUS,UF_PARAM_cut_follow_check_on );2 w9 E; V, s, I [/ ]4 U
+ r- A4 m( t) l7 U; A
return 0;6 B" `, i L: G3 H8 }
}
3 M" \, y$ A) y. {& Q7 F7 z! _" m# Q
|
|