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

[二次开发源码] NX二次开发源码分享:创建一个临时的prt文件

[复制链接]

2018-3-4 09:15:06 2236 0

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

积分
82162
QQ
发表于 2018-3-4 09:15:06 | 显示全部楼层 |阅读模式

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

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

x

" Y/ z" D: w; ~* G5 k8 O5 D主要是一个函数在CFI的头文件下,创建随机文件名! h: U+ Q. l( f6 D$ W9 Z/ E

! `% s% Z: ]: u# n  Y/ u8 L0 K: `  R( l# i9 c# ?1 C
4 V3 t+ m$ _8 z1 G

/ o8 z3 R& r7 F- v[mw_shl_code=c,true]Function CreateNewTemporaryPartQuietly() As Part
# u& _& z0 W* f+ p$ I& i    Dim theUFSession As UFSession = UFSession.GetUFSession()0 ]# D0 w: {/ q3 ]) G
    Dim NXMan As Boolean = Nothing
0 T$ ]* N. d! i1 ~2 e$ |) j- s( s    theUFSession.UF.IsUGmanagerActive(nxMan)6 p/ I& S. J' u5 q# @9 x& c  b
$ |$ q* p; J* |1 P; O0 D( G3 o! u
    Dim fileNew1 As FileNew = theSession.Parts.FileNew(), ^4 L9 j' j$ {. a$ C( y8 @3 K: E
    fileNew1.Application = FileNewApplication.Gateway
. \% ^1 k: |. J1 u' d; R3 Z    fileNew1.Units = theSession.Parts.Work.PartUnits
! x2 K4 i4 B8 ^+ s1 [+ a% F! Y$ Z: y* p; [    Dim tpn As String = Nothing
8 n" y6 m2 J. b+ X3 d    theUFSession.Cfi.GetUniqueFilename(tpn)# X% P7 g$ ]4 X( I$ d) D
    If (nxMan) Then' t8 D9 ~8 C9 Z7 @
        fileNew1.NewFileName = "@DB/" & tpn & "/A"- b, K4 Q# k$ Z0 l" d5 n
    Else8 n8 F( _$ C" F- q1 I1 W
        Dim tmp_dir As String = Nothing
" w9 u) s0 ]8 L        theUFSession.UF.TranslateVariable("UGII_TMP_DIR", tmp_dir)! L+ G% X7 r6 m- Q1 c
        fileNew1.NewFileName = tmp_dir & "\" & tpn6 V* D% U( P" X) ]0 }: h3 j# {' D  o
    End If5 B2 |+ M' v) [3 r! A% S6 G
    fileNew1.UseBlankTemplate = True: h. U5 {, z; |: X7 [5 ]6 q
    fileNew1.MakeDisplayedPart = False
- P7 f  K% t* Y( Z/ l; W* |    CreateNewTemporaryPartQuietly = fileNew1.Commit()4 Y# F& t$ O; V& L: n- Q
    fileNew1.Destroy()" q; k3 ~$ q3 h$ i+ X1 G
8 Q6 o# o7 M; K6 J
End Function[/mw_shl_code]
6 W, u, s2 \) `4 Z7 t
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了