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

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

[复制链接]

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

admin 发表于 2018-3-4 09:15:06 |阅读模式

admin 楼主

2018-3-4 09:15:06

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

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

x

7 p$ K3 L, d: M/ W8 o4 M主要是一个函数在CFI的头文件下,创建随机文件名
4 M) H' I1 B6 D0 u* M( k5 Z8 l/ b
7 P0 S; G3 Y! I0 u1 k4 p9 D" @" {6 X3 h9 k9 ]. s
' X. i1 I8 T. z5 G2 c

; B6 R4 E. `, t) {6 P. W, \[mw_shl_code=c,true]Function CreateNewTemporaryPartQuietly() As Part! o- M; k& H8 w" p, K1 t
    Dim theUFSession As UFSession = UFSession.GetUFSession()
8 b% O- L5 B% @    Dim NXMan As Boolean = Nothing
  q) I2 ^7 j6 E( w$ U3 B/ S    theUFSession.UF.IsUGmanagerActive(nxMan). z+ g7 F* L( l* y8 o: q& K1 k

2 Q$ D7 _" ?$ z  k, Z    Dim fileNew1 As FileNew = theSession.Parts.FileNew()0 u( ]" e3 f* d1 h& P; S9 f; I
    fileNew1.Application = FileNewApplication.Gateway+ [( n3 k1 ]. _/ B  t. n5 Y
    fileNew1.Units = theSession.Parts.Work.PartUnits4 [( b: @* ?9 }3 G* E0 Q
    Dim tpn As String = Nothing
0 X; [7 _% t* h  h/ l    theUFSession.Cfi.GetUniqueFilename(tpn)
+ c6 G4 T' z2 g' T    If (nxMan) Then2 L  _2 b/ g4 w4 P' `
        fileNew1.NewFileName = "@DB/" & tpn & "/A"
; @" Y2 l) z5 M  l. F' {& C    Else) t6 C# S# f' I
        Dim tmp_dir As String = Nothing0 W5 `& B1 ]! A2 }" `0 }/ F3 x6 [) e
        theUFSession.UF.TranslateVariable("UGII_TMP_DIR", tmp_dir)
) I0 k9 H$ h# x) W! d        fileNew1.NewFileName = tmp_dir & "\" & tpn6 m& z+ X" o7 d1 N+ A" \: \* P
    End If
" k5 u8 i) s' Z) J6 ]# l+ S    fileNew1.UseBlankTemplate = True8 a8 }" _' B% a$ ^7 R
    fileNew1.MakeDisplayedPart = False5 E- y. j6 L. d6 G
    CreateNewTemporaryPartQuietly = fileNew1.Commit()9 U, Y; h" d  H( Y0 t
    fileNew1.Destroy()8 P" F  J' T1 `9 h4 x, O7 ^1 |& S
# T4 ~8 ^( L* L, u9 w, S8 C
End Function[/mw_shl_code]: P4 U7 Z9 o+ w: _* \2 V
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了