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

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

[复制链接]

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

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

admin 楼主

2018-3-4 09:15:06

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

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

x

4 m& d6 c, m$ C2 k, q7 `5 d6 G主要是一个函数在CFI的头文件下,创建随机文件名
7 S5 }) Z4 m8 n. z) C# R8 I% I( ~6 a6 Y, S3 S# G
) ]9 ~) N+ ]- t# N* S. }

2 r: s0 J- t& E& X* ^1 l; K3 U- J9 _7 k
[mw_shl_code=c,true]Function CreateNewTemporaryPartQuietly() As Part
/ r' L6 {: s8 r' w0 Z7 b+ _" R    Dim theUFSession As UFSession = UFSession.GetUFSession()
/ _" t. O- j. i. h& W- P- Z    Dim NXMan As Boolean = Nothing
* d0 o; e+ o" j  ]- n3 k( n    theUFSession.UF.IsUGmanagerActive(nxMan)
/ Q) B6 @3 {) y1 h$ H$ n' F' R: b( G8 p
    Dim fileNew1 As FileNew = theSession.Parts.FileNew()! {6 C/ J7 @0 l  d# c' G" l0 `3 B
    fileNew1.Application = FileNewApplication.Gateway3 b$ X+ d7 V6 ^# Y; t
    fileNew1.Units = theSession.Parts.Work.PartUnits% _/ |  {" {0 O7 ^5 w% g1 J7 D
    Dim tpn As String = Nothing
; ]  z- ~  W8 d! f/ Y% d    theUFSession.Cfi.GetUniqueFilename(tpn)
6 J: v5 t* J3 O6 C2 F5 \    If (nxMan) Then, P" w( ~) w$ B+ l7 e& J0 o* c
        fileNew1.NewFileName = "@DB/" & tpn & "/A"
1 R4 r+ f/ H0 n, k" g    Else
! Y0 D. e& x4 Q9 N        Dim tmp_dir As String = Nothing9 h: ?# ]" |! B$ h$ z; @8 v4 G
        theUFSession.UF.TranslateVariable("UGII_TMP_DIR", tmp_dir)  t0 Q" n8 _, n% `
        fileNew1.NewFileName = tmp_dir & "\" & tpn: m5 r9 D& J; k$ g9 C
    End If
# P: h4 f2 J0 J" @: M    fileNew1.UseBlankTemplate = True
4 s$ K% r- K0 {0 a- Q! P6 r    fileNew1.MakeDisplayedPart = False2 O- s9 S/ L7 i
    CreateNewTemporaryPartQuietly = fileNew1.Commit()2 [) k, L' P" y" E4 i* J; K1 ~& a
    fileNew1.Destroy()
+ y$ ^- ^; f7 E4 S  @% m7 u
  L2 m: |& v& [  E# SEnd Function[/mw_shl_code]; S$ F0 |1 {( J  V8 h
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了