|
Imports System: E1 N- p- t6 |2 s( B9 b4 C$ ~
Imports NXOpen% m- ^* B+ b$ Z, S2 z& e6 i1 S
Imports NXOpen.UF* a" l$ Z' U, `) T, N, r
1 \, X8 p6 ?, Q4 q% j# J Sub ExportCurrentPng()
! E {1 q7 m0 K, Q, I. o- { Dim theSession As Session = Session.GetSession()* t$ W1 z. u+ c! w" T6 d
Dim theUI As UI = UI.GetUI()# A9 A. R+ {/ X( Q# R/ B
Dim theUfSession As UFSession = UFSession.GetUFSession()+ D3 }) h4 C8 S8 `$ S: o
Dim workPart As Part = theSession.Parts.Work' G1 |4 t( }. L; x# c+ C9 S
Dim displayPart As Part = theSession.Parts.Display
& [- ]' G! W5 |% i0 {* S Dim png_Path As String = workPart.FullPath
4 q2 v$ E6 y' j4 P- Z png_Path = png_Path.Substring(0, png_Path.LastIndexOf(".")) & "_Current_" & Format(Now, "yyyyMMddHHmmss") & ".png"- A4 [7 n1 c6 @& k) s( Q
'设置适合窗口; [# G6 @( B- D; ?
workPart.ModelingViews.WorkView.Fit()) l& X: d9 M7 Q# N
'theUfSession.Disp.ExportWindowsMetafile(UFDisp.WmfOutput.WmfToClipboard, "d:\png2.png")
& H1 Y8 w. |# I& |$ w theUfSession.Disp.CreateImage(png_Path, UFDisp.ImageFormat.Png, UFDisp.BackgroundColor.White)
8 s( n2 F1 m0 _, a, u: W End Sub
: y3 v% S7 D O; B% H. A |
评分
-
查看全部评分
|