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

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

[复制链接]

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

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

admin 楼主

2018-3-4 09:15:06

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

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

x

( n* c, v0 `% l0 x- l主要是一个函数在CFI的头文件下,创建随机文件名
: T5 W# d, n0 F7 Y
; y' W0 Z6 n1 \2 B  s* L: h% `5 h
" E! @+ ]" i5 E2 O2 N# ~' L6 b7 Y9 `8 y- `. S

9 z( S3 }8 V6 _: ~5 Y/ L9 [[mw_shl_code=c,true]Function CreateNewTemporaryPartQuietly() As Part
  N- _( V3 X1 O1 f5 Y/ m    Dim theUFSession As UFSession = UFSession.GetUFSession(). x  Y2 m. s2 @! o( n
    Dim NXMan As Boolean = Nothing5 F  L7 T( z4 u2 y8 G' B
    theUFSession.UF.IsUGmanagerActive(nxMan)
5 y1 I" _( j: a3 Z# P7 K) A7 `8 C/ y1 Y
    Dim fileNew1 As FileNew = theSession.Parts.FileNew()
4 g$ v* t4 ^7 m- h1 x4 r    fileNew1.Application = FileNewApplication.Gateway. U! N2 H7 |" R  e; j' S$ {4 x4 }% Y" U
    fileNew1.Units = theSession.Parts.Work.PartUnits
! z  W, P$ h3 G6 J! o( U* @    Dim tpn As String = Nothing
' N8 U. h, I5 X! A! Q9 @    theUFSession.Cfi.GetUniqueFilename(tpn)$ l7 c/ R8 [! }( n' K0 |1 a
    If (nxMan) Then7 J6 @2 c$ H: ?+ b
        fileNew1.NewFileName = "@DB/" & tpn & "/A"
$ ?, J! G8 ~6 ?: j# u! f8 l9 K" W    Else, N! _& m! p6 P2 @+ F$ J: C
        Dim tmp_dir As String = Nothing
: I3 E% w+ d. `9 v  b- q- F4 K        theUFSession.UF.TranslateVariable("UGII_TMP_DIR", tmp_dir)
9 {# d0 O% n. L0 E) a: B        fileNew1.NewFileName = tmp_dir & "\" & tpn
; ~9 n& Q/ ^: {    End If; H0 G- m6 J  K- y7 C
    fileNew1.UseBlankTemplate = True
7 V& s; g+ k' o' J6 p    fileNew1.MakeDisplayedPart = False; M1 _* h- W% [/ K/ E* d1 R% h7 g
    CreateNewTemporaryPartQuietly = fileNew1.Commit()2 x- j1 S0 p" m$ G1 q/ I
    fileNew1.Destroy()
7 X" M" {: k+ e
1 T0 h9 Q# K( j2 i! ?6 ^End Function[/mw_shl_code]% a& [0 h. J& B5 N7 F
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了