PLM之家PLMHome-工业软件与AI结合践行者

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

[复制链接]

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

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

admin 楼主

2018-3-4 09:15:06

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

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

x

% ~: a+ X0 \+ o7 p: g+ j/ K主要是一个函数在CFI的头文件下,创建随机文件名/ R  t% p- e8 o& s, r
* a  j1 d$ i  H& E& R4 y( n
/ _# o0 m, V" T5 C) f! ^. T

0 G! T0 \2 [' q  t- m8 }+ U+ m8 ~# \
[mw_shl_code=c,true]Function CreateNewTemporaryPartQuietly() As Part1 \1 t0 E' J8 u! ]2 R3 D' A+ W) ~' @
    Dim theUFSession As UFSession = UFSession.GetUFSession()
- H6 T0 ^6 u: x: |( v+ X+ |    Dim NXMan As Boolean = Nothing* V$ J9 Y$ O  X( Q% Y
    theUFSession.UF.IsUGmanagerActive(nxMan)
9 ?; _9 i' g  c; r2 s8 Y0 j7 i8 j- f3 Y; v3 H& G
    Dim fileNew1 As FileNew = theSession.Parts.FileNew()- E, i! |& u2 f/ z
    fileNew1.Application = FileNewApplication.Gateway
9 s( ~3 |3 ^- J" G/ }( D1 U    fileNew1.Units = theSession.Parts.Work.PartUnits/ i* _( k4 M1 c% u) N& y/ s" Z
    Dim tpn As String = Nothing4 e, }1 I# y! j: M/ I5 ]$ A) }
    theUFSession.Cfi.GetUniqueFilename(tpn)6 ?. T, V) w4 r8 _
    If (nxMan) Then
, G! \$ E% U, V  @        fileNew1.NewFileName = "@DB/" & tpn & "/A". k9 K; ]7 N- e& P% _1 O
    Else  b8 j4 Q; q8 a
        Dim tmp_dir As String = Nothing
9 s. I/ |: }3 e( P1 P        theUFSession.UF.TranslateVariable("UGII_TMP_DIR", tmp_dir)5 p  Y# o# @, A# b: @  g: m" J4 y  _
        fileNew1.NewFileName = tmp_dir & "\" & tpn6 d* V- u5 M+ i7 X% x
    End If% ?% l9 T/ x3 [
    fileNew1.UseBlankTemplate = True
4 W) p& f0 v& @9 @    fileNew1.MakeDisplayedPart = False, N" z5 t  N& z& w
    CreateNewTemporaryPartQuietly = fileNew1.Commit()
6 W# U# p6 D6 \    fileNew1.Destroy()
% K. k1 D( c% J' h! U! B$ e, a7 z7 ~  u1 W  [1 |. z
End Function[/mw_shl_code]
" z. e7 u. J) \5 j+ t% E0 Y$ h
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了