PLM之家PLMHome-工业软件践行者

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

[复制链接]

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

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

admin 楼主

2018-3-4 09:15:06

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

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

x
6 `* {" x# I$ F# G+ O$ |0 u
主要是一个函数在CFI的头文件下,创建随机文件名) [/ c4 e; K  r! a- p

# O) R0 ]5 \+ R: A
; {% i1 Y. Y5 X% k4 E- V
4 e% }! Z$ Y! F3 V! _4 z, T& Z
4 F5 A+ k& G; S, _[mw_shl_code=c,true]Function CreateNewTemporaryPartQuietly() As Part1 O( d" e7 v3 H' J2 Z
    Dim theUFSession As UFSession = UFSession.GetUFSession()& U% w/ V) m1 c
    Dim NXMan As Boolean = Nothing* M8 j4 i3 v. Y
    theUFSession.UF.IsUGmanagerActive(nxMan)
4 N- o' D$ h: |7 @. ?2 R' X+ R# s9 J4 l* s! K
    Dim fileNew1 As FileNew = theSession.Parts.FileNew()( Q# J5 o- p3 t4 x* Q# S/ C
    fileNew1.Application = FileNewApplication.Gateway
" F' [. P8 D/ V. u; F( r    fileNew1.Units = theSession.Parts.Work.PartUnits
# x  {5 ?& W1 p# t$ b2 Q) l. O    Dim tpn As String = Nothing
7 t% t3 \) D! `, |( z4 \1 O    theUFSession.Cfi.GetUniqueFilename(tpn)
  y0 Z/ g  j: r6 v5 s5 F    If (nxMan) Then7 j& j" K0 f5 r, O7 X4 N/ g
        fileNew1.NewFileName = "@DB/" & tpn & "/A"
) F: w( R+ k: ?( q$ I    Else
9 E" x) I# M, _# g7 t2 Z( Z. {/ s        Dim tmp_dir As String = Nothing" L- X  P6 f2 o) i) ?$ o% j
        theUFSession.UF.TranslateVariable("UGII_TMP_DIR", tmp_dir). m2 T% N& G" S
        fileNew1.NewFileName = tmp_dir & "\" & tpn/ h( @; V5 S& {
    End If3 E3 @/ }" t) L$ b
    fileNew1.UseBlankTemplate = True5 y/ i0 y: ^' t- ?* {5 w# B
    fileNew1.MakeDisplayedPart = False
) T3 D. V1 ~; v! ?) `# S6 S* }% |    CreateNewTemporaryPartQuietly = fileNew1.Commit()5 t- i7 b& C( s. n- z' y; V  l8 h7 C
    fileNew1.Destroy()  w# S. Z2 u1 |" I% `; _9 D

5 \, ]3 J1 D6 dEnd Function[/mw_shl_code]
: z7 K7 I- Y; A' b( d; U5 W
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了