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

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

[复制链接]

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

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

admin 楼主

2018-3-4 09:15:06

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

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

x

& u3 e, \% `6 s2 i5 Y主要是一个函数在CFI的头文件下,创建随机文件名
  ~+ Y& e1 r2 z
& h: m. g: _9 U1 @/ y0 @2 b+ s# C& f$ m4 |

8 i$ y9 Z3 H$ N1 P1 k0 T4 [( I3 ]
[mw_shl_code=c,true]Function CreateNewTemporaryPartQuietly() As Part
  D+ N- B& p* L    Dim theUFSession As UFSession = UFSession.GetUFSession()5 S+ y4 v' E: u6 G: U6 ]
    Dim NXMan As Boolean = Nothing
8 a. O4 Y. o$ C( a    theUFSession.UF.IsUGmanagerActive(nxMan)
% k! V  f) h6 l1 l/ j# H% j- Y
1 ^7 _6 D( l! h5 p/ X    Dim fileNew1 As FileNew = theSession.Parts.FileNew()
/ c7 ~- f3 E* |( j    fileNew1.Application = FileNewApplication.Gateway* B. Y2 o8 @) W* E; ^. S& Y  U7 v  [
    fileNew1.Units = theSession.Parts.Work.PartUnits# E# D- y$ k5 o' e# V  w# ~' X7 r
    Dim tpn As String = Nothing6 _. J5 n! h8 [9 w
    theUFSession.Cfi.GetUniqueFilename(tpn)" ?4 k  x7 @: S2 I. u; d
    If (nxMan) Then
6 L  _# c3 _- k( u  a% r+ ?  Z        fileNew1.NewFileName = "@DB/" & tpn & "/A"1 u: S1 W6 y1 E) u
    Else  g7 J# M& ~- W4 Z3 N
        Dim tmp_dir As String = Nothing0 R5 g4 c0 ^: R! U7 F
        theUFSession.UF.TranslateVariable("UGII_TMP_DIR", tmp_dir)* L2 h! r! d% h: ^5 S, E
        fileNew1.NewFileName = tmp_dir & "\" & tpn( q/ u5 F. `" U' B' u: D
    End If0 Q) r: Z8 F$ e, A: t0 ?6 U4 K
    fileNew1.UseBlankTemplate = True$ ]( `1 N% R( Y! x
    fileNew1.MakeDisplayedPart = False" W, M& b  i8 ~( X' o) N! n6 c
    CreateNewTemporaryPartQuietly = fileNew1.Commit()
4 i/ \2 P7 l6 m" m7 R    fileNew1.Destroy()4 B/ T2 P& Y% t
8 W8 k5 i, T$ [; _  q/ d
End Function[/mw_shl_code]! u" U  D8 t& O' {2 i% M
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了