|
Imports System
/ l: R4 b( l+ CImports NXOpen
, T8 Z6 X& x Y! e# HImports NXOpen.UF& D8 Z$ ]. P- `- L* t
, J& m8 ~, i8 F Sub ExportCurrentPng()
0 v+ A; j0 f3 T: Y Dim theSession As Session = Session.GetSession()# ?+ B# Y8 p! h' g, F
Dim theUI As UI = UI.GetUI()- C* ^! `% \2 Z
Dim theUfSession As UFSession = UFSession.GetUFSession()
* z0 Z/ Y o3 I, E$ L Dim workPart As Part = theSession.Parts.Work9 u1 k6 [8 e% r5 t( D
Dim displayPart As Part = theSession.Parts.Display" p5 b# x: A' x
Dim png_Path As String = workPart.FullPath# f j2 ]3 N& o" u/ @# S+ _4 {. g2 d
png_Path = png_Path.Substring(0, png_Path.LastIndexOf(".")) & "_Current_" & Format(Now, "yyyyMMddHHmmss") & ".png"
* K' @ i7 g* }/ n '设置适合窗口
: P/ d: V* A2 v4 w1 h1 o. l' Q$ O workPart.ModelingViews.WorkView.Fit()
" M9 K/ X2 j `1 C' B 'theUfSession.Disp.ExportWindowsMetafile(UFDisp.WmfOutput.WmfToClipboard, "d:\png2.png")/ s7 E$ ~5 R) T% S
theUfSession.Disp.CreateImage(png_Path, UFDisp.ImageFormat.Png, UFDisp.BackgroundColor.White)8 N1 r9 ^0 Q% p7 E: b" |& _8 z
End Sub
& p7 v7 j) I( q/ l |
评分
-
查看全部评分
|