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

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

[复制链接]

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

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

积分
82162
QQ
发表于 2019-10-9 08:31:23 | 显示全部楼层 |阅读模式

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

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

x
8 F  b3 L" N4 q. [+ w
9 w# K" Q: ^, v/ H5 A
在进行相关文件和文件路径判断时候,ufun提供了内置的方法。9 y5 x" |, ^- @  ]; r( q
UC4560 通过设置第二个 参数为 100 可以判断文件夹,通过设置 为 0 可以查找文件。
% Y  g  U! g2 R
7 O0 O8 k  J( I# f, Q$ |$ r- [" P) \% v
7 _+ l! ?/ l5 A1 e% K3 a5 a
4 G0 c0 ^* B  p" k3 d, @
uc4560 (view source)' R* X/ Z, s0 E5 N- U
% W- {) d$ a  X8 J
Defined in: uf_cfi.h$ Y4 f% s( `" H2 X+ B9 \! K7 W
3 S' T: l& J1 }, u0 U: }

4 f5 ]" m9 f7 I7 |: P0 ^* \/ UOverview7 W( }/ Z. e2 _6 v5 z

. C  z$ f' I/ b3 \6 RChecks whether the specified file of the given type exists.
- C5 ~/ u! P, L) n9 t' ]' l% u* V, R# v( ^* }, V! ^. E$ T+ O
NOTE: Mixed or upper case file names may not be found if the8 X0 P( H& s3 F/ g+ z9 h
environment variable UGII_OPTION = LOWER is set.% e1 a5 m  ?8 B' j  x# ~

7 |9 }( K+ |3 S9 |4 U# hPassing an ftype of 0 will look for a file but does not work for a directory.- j  ]6 I+ P4 m( @* \5 P  ]5 N
To check for a directory the ftype must be set to 100., P2 H: E- m2 q+ Q) {, y

, X& x9 g3 b/ {% C2 ~8 j

! @' {0 a% j1 Q" h- Z' ]% x9 n9 MReturn1 ^* P7 m2 X  C
( @. L7 Z) h# Z+ H- ~& t
Return code:
) q5 ^3 Y8 }# `* n' h7 p1 [8 E, x< 0 = Error
( S# ?7 _; H5 C# j6 i- T" n8 |" R= 0 = File Exists" N" t+ P" D; s
= 1 = File Does Not Exist" k7 f8 w* S0 m+ g7 B& |
# p- Y8 c% b- J% ?+ d, k5 n. t

! h3 h. u3 y2 o. }( LEnvironment
' h7 V% m# y: s# u7 n  }& J

& l( c+ n0 K8 C$ j% {2 b  cInternal and External
$ H4 N; L, K6 A& u- A$ d1 {
; A+ I4 ~0 d7 z7 b: l& R4 h

: d) r1 C+ T/ S/ M- @7 MSee Also6 u( |; c% |  `
( |) l+ o8 c/ m. F! [2 `$ U
For description of file types see table
* p' `5 s6 V& |( J / j; k) C* n2 E4 U% @
. ~3 S3 t, O' P: f+ o
Required License(s)7 t# |8 m1 Y' ^$ c7 K
. g% _+ `( I% P* F. @
gateway
/ k; A, i# Z! X8 J/ j( z' u; Q2 C
7 r& t, g+ a5 p, S9 K6 l

, n, a% \' E5 z & g9 @9 j9 c; w) M2 E
int uc4560% n+ p0 |! E8 `
(# a9 U$ v! v6 ^+ Y9 X( v
const char * fspec,' s: H' l9 Z; P& j2 p
int ftype
( Q% q; K  V: H& _
/ Y7 J1 A! Q  T9 f0 U3 U)1 w  u3 t3 s8 e0 T& h) `; |
9 O' i# j# ~6 W7 S% y6 i
const char *fspecInputFile to check
intftypeInputFile type
6 Q" }" R+ N7 L6 ~: d/ h0 will check for files7 C$ v& W5 k' }3 C6 k# M" }
100 will check for directories
( I: P$ k' C- P; _2 g, Q

  m( T! g" X! I- b6 Q2 [2 ~4 ?# y) q2 h+ \( B
查找文件也可以通过UF_CFI_ask_file_exist8 z9 k- ]  m8 P. r

1 h7 E$ Z2 [6 o5 N; w1 n/ j6 R, q0 IUF_CFI_ask_file_exist (view source)" H" k7 Z  S- m; d
) t* Z+ ~5 A# t. G: g) v
Defined in: uf_cfi.h1 n8 t6 U9 }  o/ Y1 }. `, S, x
  G0 z2 r3 p8 l; e% S8 A  Q0 X' |. S

; w4 K" n+ D- q$ U$ V) Z* VOverview( u/ S1 O- V: w( I# W

( B" A- h5 k( o2 P+ oTest if a file exists.1 ]% |5 s3 \5 ?% B  e9 D
/ e4 A" k% ^% `
Note: This function only works with files - not directories. To check if a- h6 ?! n  A" d( H& U1 g
directory exists use uc4560 and pass a file type of 100.9 P& W3 h$ [- U  q* E3 Z
; C/ l! x& G/ N5 B7 Y+ g

7 T9 k  S8 P) a! Q+ a, Y8 kReturn. o0 n) [: S0 C* O8 m" L1 ~

7 [0 H0 k% [) Z! p0 - No error
) v! ?" f2 h7 x) v+ s9 O5 D' ]  xOtherwise - Error Code
$ o% v+ B& x% e  v4 K
7 J8 ?; Z5 z  F9 d) e

; [3 v. e. X% V, t% VEnvironment8 b! H. d% g9 ~" i/ I# x
5 s* \4 t/ p4 o# X# S3 K% M
Internal and External
: Y& q: Y3 w. z# n7 V8 u( W& D, S& ?: I: Q) P$ c( o8 b5 C/ ]1 x
, H! a" Z( L& l. _& ~# `/ V. K
History
# |- _! Q/ {' s7 R; \6 n: R& g

/ N4 M; m4 h/ T+ x- B4 zOriginally released in V16.0
* B& n# ~1 o( z7 z7 T
; k0 u2 q. K+ R( Z) E3 ^

. H; l' s& \' d2 W: n5 t8 URequired License(s); A3 E7 O2 [% J: ]! Q- ~9 U( z

, m" Q8 g+ ^7 Dgateway9 q4 H# E) @* i

0 B  _! n; o6 p  E" Y
* V- z1 O3 G5 L5 q3 m9 @
- y' ]; b% m  M7 c! }5 \int UF_CFI_ask_file_exist
: `! q/ {6 e, X1 b4 U/ l( o(2 Y; f/ u5 s- p% R  k9 E( G* m3 L
const char * file_spec,- v) O5 W. [# P  n6 c" G
int * status
+ S8 x/ w& t! H$ I  V* D9 m3 _
1 i/ Y+ w3 x) C5 F7 y% J& }0 T)
3 n5 T0 O1 g; t& v4 W0 F
& c3 p7 ?& O/ C$ w1 C) S  f6 Q$ Q2 j
const char *file_specInputThe file to check
int *statusOutputFile existence status.8 f# ~0 }; X: a5 V8 x8 L6 ]- q
0 - file exists
! ]  A+ \+ P4 H. `1 A4 k7 Q* F: C1 - file does not exist7 B3 ]7 x% t6 V, A7 j; \/ I8 C
# r5 r8 w3 ?0 a' ?% z. O

4 c/ e) Y1 o  X4 J( H, [
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了