|
Imports System
* w& I2 K. Q) t3 D1 k; a0 FImports NXOpen
, L# c6 {0 D6 F4 ^Imports NXOpen.UF
0 D! R2 l1 M, Y$ `
! _7 m0 \. t) E& a! g- N- k+ V Sub ExportCurrentPng()7 {% q1 M7 I& J' M
Dim theSession As Session = Session.GetSession()
8 O: l# Q$ n8 }' `+ o6 D Dim theUI As UI = UI.GetUI()$ V0 t& d) t6 @) T
Dim theUfSession As UFSession = UFSession.GetUFSession()
; @( h, n; `+ P* N, w/ F7 p3 P Dim workPart As Part = theSession.Parts.Work
( b+ G: H( z$ _ Dim displayPart As Part = theSession.Parts.Display
# r; p" B5 ]* O/ P! Y$ L Dim png_Path As String = workPart.FullPath
- |0 @9 X1 P$ _- \ png_Path = png_Path.Substring(0, png_Path.LastIndexOf(".")) & "_Current_" & Format(Now, "yyyyMMddHHmmss") & ".png"% _" Y9 w" K3 a1 k K
'设置适合窗口
% U, @ H; r' L; u$ g9 s workPart.ModelingViews.WorkView.Fit()
& N4 I: Q7 O0 O& `0 @$ K0 m% ^9 r7 ]! k 'theUfSession.Disp.ExportWindowsMetafile(UFDisp.WmfOutput.WmfToClipboard, "d:\png2.png")
8 F: t; g7 D. Y; G: y; P5 q theUfSession.Disp.CreateImage(png_Path, UFDisp.ImageFormat.Png, UFDisp.BackgroundColor.White)
3 |. W( T- @0 {; K' {. s End Sub
0 g5 B9 X. X2 e( L3 u' C |
评分
-
查看全部评分
|