PLM之家PLMHome-工业软件与AI结合践行者

[资料] 使用Ufun的CFI函数直接判断文件夹和文件等操作

[复制链接]

2019-10-9 08:31:23 1503 0

admin 发表于 2019-10-9 08:31:23 |阅读模式

admin 楼主

2019-10-9 08:31:23

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

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

x
0 G4 K5 P" Y& J: z) y2 |& j" E

2 a% V5 u; D* U4 V$ r7 G7 M( Q7 C8 y在进行相关文件和文件路径判断时候,ufun提供了内置的方法。
. i' X5 R& j/ pUC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。8 r3 N2 r0 Q. M8 U) X
. Q8 Z  l: ~$ ~8 ~, U3 c
" m% L) T: Q# O/ ^

' F; O, P$ }- \: |+ y3 ?. B- B% t! g! d8 a
uc4560 (view source)' ^2 [3 X) w. i' z# z( v

# L: e" X0 z7 @+ B9 w; FDefined in: uf_cfi.h6 C8 n3 Y4 z$ q

1 Q: H$ y" R4 g, g: B
) z, ?( [1 r  a5 M7 I5 u
Overview, P) k; @1 l. _/ s

+ R4 l9 }) k& p3 x; }6 @- s7 c7 V. NChecks whether the specified file of the given type exists.7 x( A7 x  @! l) O, U# y, ]6 I. Q& i

9 W2 @7 O" ?/ q. Y' N4 jNOTE: Mixed or upper case file names may not be found if the
1 h3 R) y/ v2 V+ U( m7 L2 _environment variable UGII_OPTION = LOWER is set.
: T4 s& Q: \/ d8 i- R
  T# W5 I4 w2 y- u/ s+ ~+ H7 H& o; p3 uPassing an ftype of 0 will look for a file but does not work for a directory.
1 w" x8 k% Q: ~2 P& ?% gTo check for a directory the ftype must be set to 100.
! M0 u+ x6 d: g$ u/ ^1 u- B, M" D' }0 h; e3 s. h: D+ T3 x

" K; E) f' H: H" TReturn
  \/ D, q- P) ^
" \* P, B, C; X2 J$ K; u
Return code:9 a- U) }& D- L) @
< 0 = Error# G, E1 N2 M. u; W
= 0 = File Exists4 A( R1 z# m1 E$ h
= 1 = File Does Not Exist
2 S7 g7 r& a" G
8 W; q+ A2 c, }. n2 \' h
  `9 K! z8 X- h
Environment
8 ~) u  ^+ O( j5 f! }1 j6 @

/ C! ?. o4 ~0 f( ]  XInternal and External
! i1 d6 N  x; i
; F; d- g& z' b$ N( u! L% I: _3 K0 q

: J' E% _2 F6 K( j8 W" oSee Also, l6 R/ z: U: @4 A+ k

4 l$ o- y& A% ?7 @For description of file types see table3 a( i5 J, ~9 A
# q7 A+ L4 \# q* V

" z4 p# Y8 Y: U( p/ GRequired License(s)
% g& X" u9 G: {- P- f

/ b& ^* p" z: k  o7 D6 G/ ugateway
: f, {0 h0 E5 |
+ \, m8 \, s) R9 n
* n, z8 h4 B" l0 _+ t
1 Y: }- z" F4 N6 w3 [: b
int uc45602 S* ^4 [, q5 g6 E/ L( S
(
- I; O* y# r. |# }const char * fspec,5 W" i  H' C) _* B
int ftype. T+ L, S# Y, h1 u; Y/ @, `0 T
; E. g: {# k1 Y( Z. c
)" B7 A/ `/ C- O1 a: v, M0 O1 q
" c, \8 j# ^% O2 ?( w; l
const char *fspecInputFile to check
intftypeInputFile type
+ ]% y* O' {' t, S3 `8 [/ G) n0 will check for files
, _, f; D' h# U6 I100 will check for directories

& C/ Z* h- ~: N( \7 g( d% O+ |) J; B1 [8 p
$ o! n: ?8 R& w. G6 L9 m$ u
查找文件也可以通过UF_CFI_ask_file_exist. {3 t7 X+ d, ?
- w' k# g, S1 W# Z
UF_CFI_ask_file_exist (view source)
# N/ Y+ C+ T$ }: |* R 6 U0 q0 d. ]# I* c' N* j* C6 G
Defined in: uf_cfi.h
# @1 D  P" }2 Q& m' B# ?  Y' A
3 E, M% J' d5 d& P/ R- f
) {5 o7 C6 b1 j' |6 T
Overview
/ Z& B! M/ J; H4 P
6 ]) u- V5 n+ g) T. g
Test if a file exists.! V0 J0 G6 y3 |2 r

7 F0 ~/ G( l5 i* b* c2 J; W- x+ W9 [Note: This function only works with files - not directories. To check if a- j' m% t$ ~: \" }
directory exists use uc4560 and pass a file type of 100.) l* i: L" `" k' i
) L" j# y- r3 }, e  k( M4 L9 x
( j8 W0 J5 P( z  s3 B2 y
Return
6 K; u0 `( z! ~1 {- o# K' ^* G

( S5 P, ^  P' Q1 a8 I( B5 t7 j0 - No error0 @) S; b0 B& F% d# @& |" N* X
Otherwise - Error Code- u& Q/ _2 [/ Q
" u# V0 L+ s6 q& |$ S0 Z8 c/ }) S$ V% P. t

9 d/ }' p3 C/ f( i7 LEnvironment
1 [. V9 k6 z9 \8 H- Q& Z& e0 ^
8 @' @1 m! I8 V& E. O& X& M
Internal and External
5 n* _7 D2 F4 J( g
" U( {; h$ N2 I) N" y% x
, p1 x% S8 U* A# ~% u
History/ }2 h; U- G; m; W7 f2 _9 g
! M* L2 ]9 i8 o, X5 H& A" I5 N
Originally released in V16.0
% S# k6 D$ [" s1 t ! ]/ a: w$ ?! [: _$ Q! I

% m" {) f1 j6 M! M2 `6 BRequired License(s)& c+ T2 n! Y  N& Y

' [1 H" B" v" j, ~# l% U3 |gateway
$ z. l$ ~- p2 e+ S( Z" m3 S( }
- C8 U( ~6 U4 Q; n% a( I

) |: f( M, s) {5 g+ m
% U( n( |* o7 @/ k- Mint UF_CFI_ask_file_exist
" {& C, |$ \" d& H! @* m; x(5 v. q8 ?( Y1 J2 a
const char * file_spec,1 ~0 Z& a, e9 O) w
int * status
1 I5 h$ b/ J" i# X7 l8 Z* X/ K0 q- M. W5 w+ M
)
6 s+ V" z1 B% l

! Y* L2 A! u& x
const char *file_specInputThe file to check
int *statusOutputFile existence status.1 T/ R& v0 e% k* J) T/ O  k5 F9 T
0 - file exists
  S, ]% b8 G; h' p/ P4 p0 S1 - file does not exist
* g# O. T& B% w- ^' \
6 J: T' D5 r) Y3 [, h. M* Q

9 T! l7 ?. {- }: [! p1 c  H0 J- e" D9 {
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了