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

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

[复制链接]

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

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

admin 楼主

2018-3-4 09:15:06

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

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

x
% S" C! z. b: L7 J
主要是一个函数在CFI的头文件下,创建随机文件名
/ O. k( A( J6 H1 \0 Q* g6 n$ x' O  q, F% v) v% l' w
, o* i; E  a4 Y: P: U0 b+ O
* K/ [( n/ {. ~9 S! I4 c* D5 O

( W$ U  X0 a6 E6 G) z/ J* {[mw_shl_code=c,true]Function CreateNewTemporaryPartQuietly() As Part
* j' _5 v( l4 _; x6 i( Z& ^' y    Dim theUFSession As UFSession = UFSession.GetUFSession(): h5 V; p7 P! m+ w  C  x4 g' \) l# D( m
    Dim NXMan As Boolean = Nothing/ n# y/ I/ ~' v* e# [+ n
    theUFSession.UF.IsUGmanagerActive(nxMan)
2 d6 B4 a( m/ C. L; X( I" d
! J8 [* J3 s8 Q; Y( c4 L! O0 s$ m, h    Dim fileNew1 As FileNew = theSession.Parts.FileNew()
7 }$ u$ l& t  {- d    fileNew1.Application = FileNewApplication.Gateway
) e+ b! n' E& \/ `    fileNew1.Units = theSession.Parts.Work.PartUnits
/ S& X# \+ h& i; |6 E    Dim tpn As String = Nothing* H* j5 e$ d& ?8 e
    theUFSession.Cfi.GetUniqueFilename(tpn)
3 @4 y1 K2 j) x3 s$ e- _    If (nxMan) Then
& c; h+ c: u$ `        fileNew1.NewFileName = "@DB/" & tpn & "/A"
9 ~% T* @5 G+ R; `7 v    Else- M; _  u3 T. h3 z0 h
        Dim tmp_dir As String = Nothing6 y3 l, j1 V+ ^! C6 F/ t* N
        theUFSession.UF.TranslateVariable("UGII_TMP_DIR", tmp_dir)3 E, q  X4 Y/ K7 n! z
        fileNew1.NewFileName = tmp_dir & "\" & tpn
$ |% G: j/ _: m) @% S    End If
% q. [2 v( h9 [2 s    fileNew1.UseBlankTemplate = True# W$ U' d8 }3 p2 }- ^1 n
    fileNew1.MakeDisplayedPart = False
6 L0 `8 n2 b3 e( i+ b    CreateNewTemporaryPartQuietly = fileNew1.Commit()
+ d1 P+ j6 @' o- a2 r0 [6 c2 q    fileNew1.Destroy()
5 e3 k% t/ X0 m9 w& X
, L8 M  C  H; O2 j! A3 M3 Q) QEnd Function[/mw_shl_code]0 }* f7 k, l/ A- _$ Y) 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二次开发专题模块培训报名开始啦

    我知道了