PLM之家PLMHome-国产软件践行者

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

[复制链接]

2015-4-20 19:42:50 3885 0

admin 发表于 2015-4-20 19:42:50 |阅读模式

admin 楼主

2015-4-20 19:42:50

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

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

x
( ^: N5 Y3 @$ i5 A. l. Y0 p/ ^$ G
一些关于使用ufun进行CAM加工设置参数的简单函数示例
% b- `2 ^' a. _* h: |可以参考下,常用的方式!0 [8 ~; ^& \: L- s1 `
8 O  G- r& B. Y7 L+ l
static int set_tool_param( int jj, tag_t toolTag )8 F& c6 _# M; D& {) K
{
$ g$ ?! d3 t  L! {8 i+ n    double toolDia = 0, toolRad = 3;
, I+ C- T3 m, t$ y  A. |" n) l8 @; y- b' R  c1 o- P2 i4 b& H+ Z
/*                 Modify the default 5-Parameter Milling Tool         */4 B! b% U& G9 P! _# i
! s6 Z8 E. i) {$ u7 K& [
        swiTCh( jj )
0 _1 F/ D) F! Q        {' ^. I: @; ]. N2 o- W
/*                               Tool No. 1                            */
, x# C6 M3 Y( Z& l/*                             Add a 3.0 MM crad                       */
' V# D/ @8 b  |6 z+ M" W/ c' w) E        case 1:
& ]0 S4 }& y7 P7 {            {' \5 b6 |3 u6 {' [) q
            UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, toolRad );. j& a/ [. L# B& R+ g9 F, S. u
            break;1 E2 G7 K1 n$ T: e0 f
            }
, H" P! x2 m: }3 a/*                               Tool No. 2                            */
$ n* l& m6 O, o1 |6 [$ r6 K% ]* Q" w/*                             Make this a Ball Nose                   */& d$ N9 p5 e6 f& b
        case 2:
2 v4 S( x" o8 F            {1 R. b7 T6 U1 E# w' X. H
            UF_PARAM_ask_double_value( toolTag, UF_PARAM_TL_DIAMETER, &toolDia );
3 x1 S$ d& c9 H7 c- [# Y' h            UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, toolDia/2 );4 p2 @1 w, p% C/ H( ~
            break;
) B$ v6 {3 O3 @9 @            }) g( q8 g8 H1 N7 y, ^; B$ F
/*                               Tool No. 3                            */4 [8 q! Q8 A; u4 g/ K- L* W
/*                           Define a smaller Ball Nose                */1 }: I4 u# V: B; s% N) h
        case 3:
( t, n8 d4 R/ u9 T( D6 v4 o            {& F& q! w( C5 d7 e
            UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_DIAMETER, 25.0 );
1 D% k# ^3 {- ?5 \: X/ R0 X            UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, (25.0/2) );. l: N; }# X) e: t) R% D
            break;
9 w. e- o4 Q- `' y            }* i: a0 n& J- C+ X% J
        default:
# H1 t3 w% v8 v* A9 Z+ ]! F            {
$ t5 _  S5 O0 Q& W            printf( "Default...\n" );
! T0 ]4 }0 r. _8 ~, r            }. D( |$ D4 Q# _: B' y+ h
        }
/ o  K( w4 d3 M- e        return 0;1 y, r, Z; ^: J
}
5 ^7 z0 h( \# g7 c+ |3 Z+ u
7 `& ]( P9 J& U3 f3 Ostatic int cav_mill_param( int numop, tag_t *operTag )
1 O% p0 y# x+ A+ i" W' H{. S6 C4 e- C4 @" {6 w
/*   int    numop;*/
5 S0 ~0 E% L' B4 q   double depthPerCut;
, P. G2 G. I+ G) C) b5 R  l   double stockPart;
4 `) G% L, n7 m" k2 m, j8 d$ x( L2 I
    UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, &depthPerCut);" d! G, w0 }5 k% D8 ?
    printf(" Depth/Cut default is set to %f\n", depthPerCut );* X9 ^, U4 o# j" l8 v' O
    UF_PARAM_set_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, 12.000 );7 b/ S+ H: ?( N3 K$ p
    UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, &depthPerCut );0 ^( d, A3 f/ n
    printf(" Verify Depth/Cut reset to %f\n", depthPerCut );" ~( d' \" C8 p& b9 _% {

& J% m; x7 y) a  e  D3 r! V    UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, &stockPart );& D+ x( n/ o( `6 g) u
    printf(" Part Stock default is set to %f\n", stockPart );' q! O" S  U; J4 c  j
    UF_PARAM_set_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, 1.0 );' V' _( l- A1 f2 v' K& q. C* B
    UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, &stockPart );
2 ]+ |$ M# d* V2 W, q( g    printf(" Verify Part Stock reset to %f\n", stockPart );; r4 ^$ u" _5 f2 L, [

. \: O9 W5 U: i  @8 N    UF_PARAM_set_int_value( operTag[numop-1], 327, UF_PARAM_cut_trace_method_tolerant );4 L- H: K- t8 w- H! ~) p) R
    UF_PARAM_set_int_value( operTag[numop-1], 328, UF_PARAM_cut_ctrl_trim_method_silhoutte );$ }0 X3 ?0 \: U; @; Y7 o5 j
6 P5 G1 E8 [( C  j1 M
    return 0;
+ p8 U2 G) J2 W: c0 m8 |4 i1 R}
! @4 y; }/ ^5 C2 D) K' a5 M8 W& ^' Q2 v: w- ?: {# R( ]2 ]* x, ]9 Y
static int flow_cut_param( int numop, tag_t *operTag )( L( F) R* K* r
{
- r; H9 ]0 P% ?# Y* i7 C    UF_PARAM_disp_tool_t display_data;7 A* o3 u5 y9 n) Y1 _1 X
    display_data.type = 2;             /* Type = 2 produces 3D tool display in tool path. */
$ {: Z3 U2 b/ V* i( H3 L! u6 R    display_data.frequency = 10;) q3 O  K, f8 I5 U9 g* g" u( F
% Q# C5 F+ w1 A% H% x
    UF_PARAM_set_subobj_ptr_value( operTag[numop-1], UF_PARAM_DISP_TOOL , &display_data );
) H9 o# F( Z0 Q* M+ g    UF_PARAM_ask_subobj_ptr_value( operTag[numop-1], UF_PARAM_DISP_TOOL , &display_data );, U8 o+ J! Y* O9 |5 }5 N; {
    printf("Display data for tool type returns %d\n", display_data.type );! S- G3 c# j7 W% a
    printf("Display data for tool frequency returns %d\n", display_data.frequency );
2 C4 D7 c+ W5 ^7 H% q' B! i2 Q' B* [
8 x/ m! R6 G& {8 `8 W! t- ?    return 0;% I) s. E$ n' @* S
}
/ Y9 i4 R- O; n+ N6 i  R4 w$ D+ T. t3 J* v# }- X
static int area_mill_param( int numop, tag_t *operTag )8 K. T# t8 h) E3 n% s! D4 Z6 P
{- G0 `# k& K3 d, M

! W4 t' f- O/ L7 A" W    UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_CUT_EDGE_TRACE_REMOVAL,UF_PARAM_edge_trace_removal_on );0 v! e$ m# m2 @
3 ?* z0 C. r- m- K9 u/ t5 N
/*                                           1 = Warning, 2 = Skip, 3 = Retract  */
2 }% J& u2 s) s
6 n2 U( p7 h/ r' j' U    UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_AVOIDANCE,UF_PARAM_avoid_stepover ); ' J8 p( R! ^+ i" C% Z
    UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_CUT_FOLLOW_CHECK_STATUS,UF_PARAM_cut_follow_check_on );
6 Y; v" W+ n( w3 H4 \0 J* {4 i, ^) A0 Y
    return 0;0 u/ x: }0 ~% ?4 z* b% e+ s
}! m) L) Q9 Q9 V' W7 O

& s/ ?& F. Z8 w8 l0 E! ~
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了