|
Imports System
8 G9 u, f3 y9 T, ]$ uImports NXOpen
* X B6 V: \% c8 Z1 fImports NXOpen.UF
. P9 S6 P' O' Z( j
2 b1 H# Z0 y% ?9 R; a# U Sub ExportCurrentPng()+ ?# s0 |. ~9 ]
Dim theSession As Session = Session.GetSession()4 Z8 m; |% L9 t8 G9 u
Dim theUI As UI = UI.GetUI()2 L1 I- Y' G! J+ H3 e
Dim theUfSession As UFSession = UFSession.GetUFSession()
4 N0 {; Z2 x( w! X2 b Dim workPart As Part = theSession.Parts.Work
2 @" k0 w% U5 |1 c. L5 ^$ t Dim displayPart As Part = theSession.Parts.Display
; _3 Q+ t# Y/ y; `: T/ h5 X* b Dim png_Path As String = workPart.FullPath1 `4 g0 H0 k& P. {. ?: j+ C
png_Path = png_Path.Substring(0, png_Path.LastIndexOf(".")) & "_Current_" & Format(Now, "yyyyMMddHHmmss") & ".png"& @3 k# N/ _6 c& Y
'设置适合窗口1 }+ d7 w/ c% ^( K1 S6 B% m
workPart.ModelingViews.WorkView.Fit()* G t) D. R" e/ t
'theUfSession.Disp.ExportWindowsMetafile(UFDisp.WmfOutput.WmfToClipboard, "d:\png2.png")
- k9 d8 s4 c9 s theUfSession.Disp.CreateImage(png_Path, UFDisp.ImageFormat.Png, UFDisp.BackgroundColor.White)
0 X: m0 D# Z; U' a+ j; D End Sub
+ Z+ m" ^; {: e; X* ? r |
评分
-
查看全部评分
|