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

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

[复制链接]

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

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

admin 楼主

2018-3-4 09:15:06

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

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

x
' k1 a- ~3 m! M) @4 y/ X
主要是一个函数在CFI的头文件下,创建随机文件名
, Y, Y7 g5 f; W4 E3 }/ V% _3 }; _  U: a' S2 k2 [$ f: ~$ L

1 C: Y1 g$ \) p+ _# G- S4 \
7 F5 c% x) z5 R0 @; x; l( t" @/ k  V, c4 x" x+ C
[mw_shl_code=c,true]Function CreateNewTemporaryPartQuietly() As Part+ f) o) x" {, s1 I4 p! R
    Dim theUFSession As UFSession = UFSession.GetUFSession()5 F! b" E. o5 ^+ e. z1 o' V
    Dim NXMan As Boolean = Nothing
6 P, i+ T: k" e' g! D* v    theUFSession.UF.IsUGmanagerActive(nxMan). L& w+ z: `8 V6 e& M3 C. F  s

8 m. N& \! T; f4 n+ Y, s2 x    Dim fileNew1 As FileNew = theSession.Parts.FileNew()2 h# m4 `4 F1 V) c+ k+ |
    fileNew1.Application = FileNewApplication.Gateway
' Q' x# i1 E1 m, N/ L    fileNew1.Units = theSession.Parts.Work.PartUnits
7 O2 A: {. F8 g/ u& b4 {1 }    Dim tpn As String = Nothing
# ]( D) H4 W" R! s; V    theUFSession.Cfi.GetUniqueFilename(tpn)1 ?  n3 \, F: ?$ C% n3 P8 I7 W: [
    If (nxMan) Then- X+ E# x2 o7 Z+ G/ a) a
        fileNew1.NewFileName = "@DB/" & tpn & "/A"$ f2 x7 T! I% G% K) l  u1 A* X
    Else. Q- w3 r) b! A6 n) F* h, [$ [- Q
        Dim tmp_dir As String = Nothing" Y5 M4 J! a' s7 z
        theUFSession.UF.TranslateVariable("UGII_TMP_DIR", tmp_dir)
1 s' ^7 |: ?$ Z! w        fileNew1.NewFileName = tmp_dir & "\" & tpn
0 N/ R+ g  M" t& T( S& c) X; d- `9 M. j    End If5 |6 y& A7 y6 v% F8 U
    fileNew1.UseBlankTemplate = True7 ~+ s+ A) j3 Y- j% a/ J$ k
    fileNew1.MakeDisplayedPart = False6 B, p5 F1 @8 h* h
    CreateNewTemporaryPartQuietly = fileNew1.Commit()
! @9 k, }) q+ n    fileNew1.Destroy()
" J3 Q$ t4 Y9 }5 M3 k5 n  \) g3 X  W7 y7 d9 T5 l; q/ }! ^! g
End Function[/mw_shl_code]. ]) L' o  n7 w/ \( S# A0 s
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了