查看: 4254|回复: 0

[资料分享] 一些关于使用ufun进行CAM加工设置参数的简单函数示例

[复制链接]

2477

主题

1280

回帖

8万

积分

管理员

PLM之家站长

积分
82265
QQ
发表于 2015-4-20 19:42:50 | 显示全部楼层 |阅读模式

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

×
/ o9 R3 W. Y  K/ a" O% X3 S
一些关于使用ufun进行CAM加工设置参数的简单函数示例: ]4 ?: \( W+ B$ t  g4 p
可以参考下,常用的方式!' t: F0 I$ _- f/ h2 r4 u
/ b% S1 a# B3 h% g; s+ O# R. }* w
static int set_tool_param( int jj, tag_t toolTag )
) S1 Q# E6 E$ w+ l{& |. a- V" c0 j9 r4 C* i/ F
    double toolDia = 0, toolRad = 3;! i: E4 t7 h: \

, d& m1 V6 C4 |' L1 n6 j# J1 P/*                 Modify the default 5-Parameter Milling Tool         */0 r! t7 l; ]3 E) F

" g6 Z# l- V5 y; d8 [& E  i        swiTCh( jj )
( d1 I7 y! {- {8 S$ I        {* T+ K2 \  J& j/ w6 G- S
/*                               Tool No. 1                            */
( ^3 I# O& p3 n; }* {9 h2 m3 Z4 F/*                             Add a 3.0 MM crad                       */- s# E* t( U7 b! e3 C* L
        case 1:
, {' d( l+ j' |% A9 E3 @1 Q, r            {
% S# ]' l- j9 g% p2 q  w            UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, toolRad );
) H$ s& c7 d4 x3 b0 H/ p            break;
( q! l, N. @7 E2 I; o/ s: N            }
9 d/ b# O8 \! c& p3 \! r/*                               Tool No. 2                            */
; I/ [* k' Z7 H/*                             Make this a Ball Nose                   */3 Y* E9 {3 B% M3 o7 d- g  n# {
        case 2:6 |, o5 m# s/ ]  N0 t; C
            {
- _+ x4 O1 ^7 ~! E: j$ y            UF_PARAM_ask_double_value( toolTag, UF_PARAM_TL_DIAMETER, &toolDia );/ S0 V1 y7 X% z% Y, T
            UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, toolDia/2 );
! m5 I3 O" d( u6 J            break;* o/ c- y, P6 U
            }
* W! q  |. A  @/ W/*                               Tool No. 3                            */
+ A5 i2 t# L5 D/ s& y/*                           Define a smaller Ball Nose                */8 I, }( B! g! {' U  H
        case 3:. ~* |) k# m( h7 b
            {6 y: g2 |* Y( G8 z, {
            UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_DIAMETER, 25.0 );
3 c6 S6 f" E% S9 o/ \8 o5 |! e            UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, (25.0/2) );3 ?& l6 n1 v1 n3 |# n" T! T
            break;( g# H5 S( n! Q6 \, a( m& p! T1 Y
            }
9 B# Y- t: g! V, Y5 D* ]" ~  X" C        default:
8 v5 U2 P/ b: j( M' u! j- s            {
3 Q# ]" i4 M; M4 v            printf( "Default...\n" );
) \" X* u! u* g& {            }
' X1 }& u. O$ _3 e9 v; N        }0 u/ O, u, }0 H; ]
        return 0;" B; w) Y* B; k! |1 Z
}
# H' ]0 M3 |' w
- Y7 @3 v  y1 V6 f7 zstatic int cav_mill_param( int numop, tag_t *operTag )* P; F) ]8 {- [8 {9 Z, B
{1 B" u) o, b% d$ j* i& b; i
/*   int    numop;*/
2 E( B4 s9 q' g/ L* m, T0 u   double depthPerCut;  g1 e4 @/ J& v+ X+ N5 @
   double stockPart;
+ h0 W8 I% I' K- [, ~
% Q' ~4 F8 @' C; G! G4 X' m7 @    UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, &depthPerCut);$ ~- ~4 Q/ C& @! w
    printf(" Depth/Cut default is set to %f\n", depthPerCut );* m) z$ K3 L4 q/ ^
    UF_PARAM_set_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, 12.000 );
0 T" h- i1 V# ~. Z# H1 E    UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, &depthPerCut );( W( Y4 R$ l/ t: E( c' x6 \
    printf(" Verify Depth/Cut reset to %f\n", depthPerCut );
$ `, R6 S, T- n0 [; y; I) ~+ [/ y' n- t- i! j
    UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, &stockPart );  c4 ^& E. D9 v2 y: @# }
    printf(" Part Stock default is set to %f\n", stockPart );# C1 ?6 G; p; d
    UF_PARAM_set_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, 1.0 );8 X0 a$ E- I. I8 b8 w; [
    UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, &stockPart );1 F6 O6 Z7 f& z& t( B
    printf(" Verify Part Stock reset to %f\n", stockPart );9 Z8 z$ c& K$ P) O) Y) @) J$ Q

& i8 q; \% M; v3 e/ W9 S    UF_PARAM_set_int_value( operTag[numop-1], 327, UF_PARAM_cut_trace_method_tolerant );. q. e' I! f& |9 [. H0 }7 V
    UF_PARAM_set_int_value( operTag[numop-1], 328, UF_PARAM_cut_ctrl_trim_method_silhoutte );% j& P* R( B% O+ I- ]

- K$ U' `! J7 b    return 0;
/ F! O* y& h( ?! ^% @0 d0 h}$ R' W; w9 l+ p: o$ h7 Q: J
2 c) h! Y: ~  l
static int flow_cut_param( int numop, tag_t *operTag )
' }+ C1 N' H" Y9 H9 H" L{
. m: N) k- h' m1 Z    UF_PARAM_disp_tool_t display_data;
' F5 x9 }. e  T7 `* n# z    display_data.type = 2;             /* Type = 2 produces 3D tool display in tool path. */7 P6 B  l! X2 A
    display_data.frequency = 10;
0 d  Y4 L% B$ Q7 y3 A( M7 \8 o6 O+ o& r/ N
    UF_PARAM_set_subobj_ptr_value( operTag[numop-1], UF_PARAM_DISP_TOOL , &display_data );
9 K3 e& G& T/ H    UF_PARAM_ask_subobj_ptr_value( operTag[numop-1], UF_PARAM_DISP_TOOL , &display_data );$ R' w4 X& L+ q% f2 n( j5 i
    printf("Display data for tool type returns %d\n", display_data.type );
. h; w  ^; q: g3 S0 Z% b$ w9 A! g    printf("Display data for tool frequency returns %d\n", display_data.frequency );
4 L; W0 d% H2 Y2 d: c
: {! t0 }+ R( ^& m    return 0;
4 H6 {7 T, n1 C7 o1 R}
' J0 p- Z3 F. f7 H
: x1 i6 j. x7 x8 R2 \static int area_mill_param( int numop, tag_t *operTag )
5 G. t# v, }1 r8 \' H  @{3 L7 M# p& w4 G; y
% r4 {- f& c0 w
    UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_CUT_EDGE_TRACE_REMOVAL,UF_PARAM_edge_trace_removal_on );; L8 k! o  L8 T
# y1 O2 F' u- Z* B
/*                                           1 = Warning, 2 = Skip, 3 = Retract  */ ' @1 E" D$ l# U6 ~$ z% J

& L2 n9 ]" f* N* h" x: e- V    UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_AVOIDANCE,UF_PARAM_avoid_stepover ); ! r1 b' K6 I) I! y  C- r" f
    UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_CUT_FOLLOW_CHECK_STATUS,UF_PARAM_cut_follow_check_on );
8 I- L6 S/ b. n
9 n# v5 {8 ~7 ^6 h% f" z" j    return 0;6 y, m9 k# y6 @- |- Y8 o
}4 \/ L% c& P& A& c; R* }. y

' w  X1 e( ?( C* }/ X" P0 P
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

在本版发帖
关注公众号
QQ客服返回顶部