PLM之家PLMHome-国产软件践行者

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

[复制链接]

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

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

admin 楼主

2018-3-4 09:15:06

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

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

x

% s9 L5 Y$ ^; u& y; v主要是一个函数在CFI的头文件下,创建随机文件名
: [; k' u: d3 p2 K1 a
2 V9 `2 n0 L& y, j
# B/ S( ?3 R9 [# l  V/ M2 c; \1 D' z0 T+ {8 S

0 t4 j, N; c' D' C# \0 z[mw_shl_code=c,true]Function CreateNewTemporaryPartQuietly() As Part
  H2 b# l# k+ }* c& Y9 K    Dim theUFSession As UFSession = UFSession.GetUFSession()
; [" f: I2 ~" V" \. X4 j- `    Dim NXMan As Boolean = Nothing
& R/ V, w  s# L  j& ]" \" }/ p    theUFSession.UF.IsUGmanagerActive(nxMan)8 D! ~/ n3 c3 R  _0 b. Z( ?& P

# _# w( v& A: W6 z# z# B4 J    Dim fileNew1 As FileNew = theSession.Parts.FileNew()
' @/ h5 Q  k  ^/ j& ~9 I    fileNew1.Application = FileNewApplication.Gateway0 P1 L- W; h& P$ _2 a3 h8 @
    fileNew1.Units = theSession.Parts.Work.PartUnits
/ g+ l5 S, H+ O; q0 V4 e7 q% [    Dim tpn As String = Nothing
+ L0 z3 Z6 `$ |( K    theUFSession.Cfi.GetUniqueFilename(tpn)
7 e% z/ M3 b" ^6 j* h    If (nxMan) Then
# p' N* S; Y+ _4 g/ i2 x. {        fileNew1.NewFileName = "@DB/" & tpn & "/A"+ R" B% s6 {0 S
    Else5 U8 L6 D0 M6 j! k. F! P
        Dim tmp_dir As String = Nothing) M9 O: a' m+ X0 v
        theUFSession.UF.TranslateVariable("UGII_TMP_DIR", tmp_dir)2 w3 j  H; z" ~; s1 |
        fileNew1.NewFileName = tmp_dir & "\" & tpn
  l. ?* e7 @) v) J    End If- p4 I5 [) |; G; A/ B
    fileNew1.UseBlankTemplate = True% S, Q! e6 o+ g! l6 s
    fileNew1.MakeDisplayedPart = False
& ~2 a. U) X0 F# [) \8 A+ l    CreateNewTemporaryPartQuietly = fileNew1.Commit()
; {+ f! r2 k# G2 D: G+ Z, |    fileNew1.Destroy()
3 n  s1 U3 n1 `4 v/ v/ K/ J4 D7 o$ h- v' K
End Function[/mw_shl_code]
5 i% t9 r- Y4 d. `0 d
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了