PLM之家PLMHome-工业软件践行者

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

[复制链接]

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

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

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

x
9 f9 x3 ?* k8 q3 M; f
一些关于使用ufun进行CAM加工设置参数的简单函数示例
) v9 |4 ^. c% z7 v1 R& `可以参考下,常用的方式!
$ l3 Z8 ?8 R7 f4 X0 r2 R  r& [: t& w5 z# ^, u
static int set_tool_param( int jj, tag_t toolTag )5 G" |" l0 K! P( @# d
{- a. H$ T2 r/ ?* J3 _4 b! O2 c
    double toolDia = 0, toolRad = 3;/ x- p0 L3 C+ X

+ S8 x( Z, B; O- L/*                 Modify the default 5-Parameter Milling Tool         */- c" t# |0 `# }) {

" _& C: w4 t9 P; c2 z% }        swiTCh( jj )
- X( F4 Z3 O3 p        {
0 w" S/ r4 W3 @! j" X/*                               Tool No. 1                            */
9 M  H7 y1 T9 s. U/*                             Add a 3.0 MM crad                       */) P0 y( J) j( N
        case 1:$ ]* D& M1 [- M2 E4 {
            {
4 c  ^" f) P  O- `            UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, toolRad );
. f$ R+ k2 I" t            break;
/ Q3 P: E% L  b. D( ^$ K- c            }
( a+ t9 K. [3 w. G* t" a/*                               Tool No. 2                            */1 F: e0 Z' i& z1 y" U$ |: T2 G
/*                             Make this a Ball Nose                   */
, d; d: O: H- U0 C" c, {% w) z        case 2:
1 M) r/ ]! Q7 D! m* D5 z) e& i            {8 N' w  @7 m2 R7 b8 C4 b0 T: G
            UF_PARAM_ask_double_value( toolTag, UF_PARAM_TL_DIAMETER, &toolDia );0 t7 w' n' V: ?
            UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, toolDia/2 );8 `2 \' u. D7 Q  X+ m2 ^9 w
            break;6 ]" Q$ Y% g9 W
            }) v5 c+ @, M5 t" M
/*                               Tool No. 3                            */
/ P! D* d& k+ Z. ?/*                           Define a smaller Ball Nose                */3 g, B, p3 j8 d+ L% N% U
        case 3:
) s* x4 k8 R: J4 L" ?            {( U" Y8 L4 P+ P+ q  ~
            UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_DIAMETER, 25.0 );
" M/ _) I; E; _$ Q7 @            UF_PARAM_set_double_value( toolTag, UF_PARAM_TL_COR1_RAD, (25.0/2) );
3 T$ c3 [+ r& a. ?4 G9 o) c            break;8 h+ j* d, [. I4 X2 X( N
            }) {* d* z: w( u( f5 d) [
        default:
6 [( ~( ^3 F' I            {
' [- R8 k$ X7 ^$ a% _" ?; O            printf( "Default...\n" );
$ O& n  Q7 C: L7 g            }8 ~/ n* V' n) ~7 ^" q
        }; T% F7 N4 M% x. x# Z9 d; j
        return 0;
4 S4 f  x# C7 H1 F2 j}& s( }1 s" N# A  A3 Z; a# I
$ s% }% s' ?5 _- {5 {: A
static int cav_mill_param( int numop, tag_t *operTag )
6 I4 s, R' A+ C" k, I{0 y6 `% M5 _% |$ n
/*   int    numop;*/8 @2 _1 {3 j2 i. Z
   double depthPerCut;
" w" s% Q# o2 l5 {9 G# Q1 R/ K   double stockPart;
, h. q; Y2 D, M6 n' R$ t) t4 d. p! R9 Q5 Y
    UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, &depthPerCut);
) t+ n2 g2 r1 w! H. N, `, t    printf(" Depth/Cut default is set to %f\n", depthPerCut );6 |2 d+ D8 P3 `. r; ~- i9 x; u
    UF_PARAM_set_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, 12.000 );+ h$ c/ t/ W- |1 h8 d
    UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_CUTLEV_GLOBAL_CUT_DEPTH, &depthPerCut );
8 p) c1 `$ v/ N# B9 A    printf(" Verify Depth/Cut reset to %f\n", depthPerCut );: p( D) g4 g1 l7 t- `- p

* d4 u! y7 s8 n, u3 s4 l$ C$ R    UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, &stockPart );1 M! l- `0 [- f  p: W/ J4 ?
    printf(" Part Stock default is set to %f\n", stockPart );
! S- Q* f4 F$ X    UF_PARAM_set_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, 1.0 );5 V8 `# c" d4 V( z$ z& H
    UF_PARAM_ask_double_value( operTag[numop-1] , UF_PARAM_STOCK_PART, &stockPart );
# ~8 K! F% n( X4 }; K    printf(" Verify Part Stock reset to %f\n", stockPart );( K4 T- y* g' Q" A% p+ K0 O3 E
& w, i1 _1 x4 s/ a( O0 W% @
    UF_PARAM_set_int_value( operTag[numop-1], 327, UF_PARAM_cut_trace_method_tolerant );. t: k$ e+ r, G7 `
    UF_PARAM_set_int_value( operTag[numop-1], 328, UF_PARAM_cut_ctrl_trim_method_silhoutte );2 n& N1 ^' V) h

( H; s, {; B/ U2 P) D9 d9 L    return 0;
, f* [0 \' t- X3 X2 v) M5 w& J; ^}
6 V& w* Z8 P- S" x& v* T1 `& Y$ c4 a. [' w
static int flow_cut_param( int numop, tag_t *operTag )+ v0 }) q  f  |% f- [9 u
{
, Q* H& f5 t7 M+ b; R3 N    UF_PARAM_disp_tool_t display_data;
" B$ X! k2 o) [( U7 o' ^4 }! t, f; O    display_data.type = 2;             /* Type = 2 produces 3D tool display in tool path. */) O6 c, y3 F, r3 U. q: U; j
    display_data.frequency = 10;
5 T; {" c" s) Y6 x' W+ v- ^2 ~) K% j. g+ Z/ b% f; t
    UF_PARAM_set_subobj_ptr_value( operTag[numop-1], UF_PARAM_DISP_TOOL , &display_data );
0 [% V4 ?2 F+ i8 |    UF_PARAM_ask_subobj_ptr_value( operTag[numop-1], UF_PARAM_DISP_TOOL , &display_data );6 h8 k1 m" ^) O, |+ m
    printf("Display data for tool type returns %d\n", display_data.type );  I) Z) y# W1 x2 X- b" o
    printf("Display data for tool frequency returns %d\n", display_data.frequency );
' X% u% r' b% p. N$ o8 s
8 P- W1 e; i' Z# Q3 c! ?    return 0;  r+ t+ m& U9 c$ Y  `) W( s
}$ w9 s" Q; h$ {3 ~! a, Z
2 r9 F+ Z4 K1 w8 W/ w0 N$ d3 `
static int area_mill_param( int numop, tag_t *operTag )
# @6 R$ V8 Q& {: F2 F  ^6 Y) J{" f" }  }/ H) V. [- e
: x8 E; b5 V: F& s+ h3 d
    UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_CUT_EDGE_TRACE_REMOVAL,UF_PARAM_edge_trace_removal_on );) V' w/ j/ R) f) R) u: R7 m
* q$ W5 W! W2 _5 B1 m/ M
/*                                           1 = Warning, 2 = Skip, 3 = Retract  */
& v& N4 A0 z0 B+ |% Z- b
- I% `  q1 s$ k. r    UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_AVOIDANCE,UF_PARAM_avoid_stepover ); : T/ }% f1 l6 z
    UF_PARAM_set_int_value( operTag[numop-1],UF_PARAM_CUT_FOLLOW_CHECK_STATUS,UF_PARAM_cut_follow_check_on );
2 B' B3 i6 M( ?* Z
+ [, B2 e9 j) I( J& M8 y5 |; u# X    return 0;
$ @$ y, k8 E6 l2 g6 [}
+ w! w7 J. F% f6 }8 J; X9 @
" p9 C$ [9 n7 z+ u. A+ U; i" B2 K
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了