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

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

[复制链接]

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

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

积分
82170
QQ
发表于 2018-3-4 09:15:06 | 显示全部楼层 |阅读模式

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

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

x
- ]2 g9 J" a/ _
主要是一个函数在CFI的头文件下,创建随机文件名
9 e' D: j+ N: j& H7 T5 P4 G% h/ j  m0 T* W
( f, K2 U$ C* y0 \
( ?4 \% q8 Z* C/ l( f/ c
: ~0 P& z2 B; b% F2 P& f+ |5 y
[mw_shl_code=c,true]Function CreateNewTemporaryPartQuietly() As Part
; a& [: ^; j8 G3 A; z4 d1 _) ]    Dim theUFSession As UFSession = UFSession.GetUFSession()
: F9 Z# }" L1 w9 B    Dim NXMan As Boolean = Nothing/ k) O1 v6 U) ?4 Q- ^8 L4 ~8 o
    theUFSession.UF.IsUGmanagerActive(nxMan)
* k: `, E, C( j- c/ @
% e4 }8 I, {: `* g- t% c    Dim fileNew1 As FileNew = theSession.Parts.FileNew()+ f9 \2 @; `, Q" {2 P' q9 K; T
    fileNew1.Application = FileNewApplication.Gateway/ T& J) X7 \2 L# r5 q
    fileNew1.Units = theSession.Parts.Work.PartUnits7 U) t! u% e1 y0 P( Q; ^& m
    Dim tpn As String = Nothing
: A9 f8 W/ i1 a: k* t- S    theUFSession.Cfi.GetUniqueFilename(tpn)  S& ?2 S9 Y6 E
    If (nxMan) Then
  Y' V- \" l) @" y: C3 Z        fileNew1.NewFileName = "@DB/" & tpn & "/A"$ F# f9 O+ V6 i& I% R% R
    Else0 t* h  L  ^9 L" v& w0 h
        Dim tmp_dir As String = Nothing: u5 `' }& N( }0 M1 J8 @
        theUFSession.UF.TranslateVariable("UGII_TMP_DIR", tmp_dir)
! v8 [( u1 |9 o' L        fileNew1.NewFileName = tmp_dir & "\" & tpn% }! Y, y+ G6 o+ i! M  N. G
    End If
. Y: x: t8 t( h, W  C* [4 b. M( j1 e) D    fileNew1.UseBlankTemplate = True
( M8 [0 c8 T( H- n5 C, a( [    fileNew1.MakeDisplayedPart = False
' j8 F7 e1 i6 G& M- O' U% U3 w    CreateNewTemporaryPartQuietly = fileNew1.Commit()
9 F$ V& Q# j" y. ^3 G' Q    fileNew1.Destroy()9 U# L1 o3 ~, [1 v$ q7 v
+ J) X- Q9 {2 z, H
End Function[/mw_shl_code]
, a! z9 M( \5 u
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了