楼下的网盘链接如失效,请复制以下ILOGIC代码。5 V8 f/ }& k8 l4 b6 Z6 z
'thanks for Autodesk rocky God giving me help! The code comes from the official forum of Autodesk in the United States,by Curtis_W8 u7 L- e n3 a1 A6 x
. E6 Y% X1 o) D; Q" `; ~
'获取当前的颜色方案名称7 E4 ?' l6 ]$ ]! E- V7 a. J
oColorScheme = ThisApplication.ActiveColorScheme.Name
- W' \) h7 V7 L3 x* ~% k: L; g9 \; c/ k' }2 I# w9 j; j, ~2 f$ w7 U
'获取当前配色方案背景类型- [3 u% T' C; l& k
oBackGroundType = ThisApplication.ColorSchemes.BackgroundType0 e$ ^. ~$ Q, F. W2 z7 R
1 Z. W5 y& C( v2 ~7 n
'更改为演示文稿(白色背景)
8 \) @ n& u1 h- Z D EThisApplication.ColorSchemes.Item("表达视图").Activate
4 `' P5 T* t2 |. P. U) \ B3 E* ]
/ w; d W, B- T# @ Q8 x4 d'设置为使用一种颜色背景类型7 f: v( O$ ^ _1 T
ThisApplication.ColorSchemes.BackgroundType =BackgroundTypeEnum.kOneColorBackgroundType : j/ }& f- \) Z5 A
Dim ooDoc=ThisDoc.Document1 R5 c; @1 _" l" M! x+ C
If ooDoc.DocumentType= kPartDocumentObject Then GoTo AA
& M' A% N1 i; [Dim oAsmDoc As AssemblyDocument
( t* k% A. {4 E; NoAsmDoc = ThisApplication.ActiveDocument
2 h" |5 u' F( v3 l4 f$ \2 t3 @5 eDim oDoc As Document1 z+ G/ E0 P4 I) [1 O1 ~
Dim oRefFile As FileDescriptor
0 X6 k& z: B8 I) C0 D8 p, o, l
5 b C% }! g# m8 G, t* X( K% ^& H8 V
! _6 X3 b# q+ o$ N( k @For Each oDoc In oAsmDoc.AllReferencedDocuments
7 t. @& A* t9 J& F6 | ThisApplication.Documents.Open(oDoc.FullFileName, True) $ l( M+ C. {- s5 O9 h' `1 u
% S. c8 C3 N) |/ ]7 { For Each oSketch In oDoc.ComponentDefinition​.Sketches, {( p4 M ^4 v Q8 F; j
oSketch.Visible = False& W1 B5 h ~2 I- ? w* A- v8 c
Next
5 i/ n w( y8 L
8 f0 m' c) _! b; f+ P; T! h '设置工作平面能见度
! X* o# r; N) C For Each oWorkPlane In oDoc.ComponentDefinition.WorkPlanes
7 z8 N6 v2 ?* ], N+ S oWorkPlane.Visible = False; F* b: ^/ S2 g( E3 \
Next
g. M4 I( t% a+ f
5 g" s' _$ s/ C! D' F '设定工作轴能见度
, [: D0 `3 \5 l/ o- V/ W For Each oWorkAxis In oDoc.ComponentDefinition.WorkAxes/ k- E2 @0 m/ ?% N" l
oWorkAxis.Visible = False
E$ g$ J; l) j7 b, D& J9 w# z Next0 E- ?# T+ A7 ?* s- e$ o
. E. g" l% g( U# ^ '设定工作点可见性
, _$ R/ v9 S% M6 s. }3 u/ q# R For Each oWorkPoint In oDoc.ComponentDefinition.WorkPoints
]% ?3 q- U: m4 [2 g1 a oWorkPoint.Visible = False! H. ~) j2 v$ h5 T8 e9 q# h
Next
3 G2 A) s& U7 T3 f' g$ \# v
% w, `* J: o; l$ M' g '设置iproperty在保存时使用ISO视图
% |0 s+ {, A) h* x# z oDoc.SetThumbnailSaveOption _
! r" m) J5 W$ u4 |1 s6 A3 @1 E/ ~ (ThumbnailSaveOptionEnum.kActiveComponentIsoViewOnSave)
$ Y F4 w# f& {, S
9 E. k; I Z4 n7 }$ n- @4 N- p: e' @ '尝试保存
% ^9 D+ z/ a3 J& R( n Try
: d' q" |+ s0 {, p+ v3 p S9 a oDoc.Save7 k9 d0 L |7 z I, Y: E6 d
Catch 7 i2 Q( a; j; b5 B0 l! L3 F
'捕获错误而不做任何事情, U% N8 L( Z# c, F9 M8 K
End Try) F& s w4 k! f7 N2 h
& P2 k9 L. @2 ]8 u3 a$ ~ '关闭文件
7 Z! U/ @! T5 c. a oDoc.Close+ B% t8 q6 D% r( i1 z; g
Next
' u8 o. S" s' |+ tAA:For Each oSketch In ooDoc.ComponentDefinition​.Sketches
8 t2 e- l0 u) e( q. U1 V7 {8 i7 Y oSketch.Visible = False
+ ^) h8 y, ]+ x* f6 L0 }* |6 x Next
, b2 {" ?* j! c
1 w$ Y) u( m, P '设置工作平面能见度
: e/ n, _; p# u/ P For Each oWorkPlane In ooDoc.ComponentDefinition.WorkPlanes# F- H. o1 p. Z5 U
oWorkPlane.Visible = False
1 Z1 z) T/ }$ R Next
; K+ K9 R% U6 r1 @, H$ y 1 B/ U& p* ~0 x- g" k( O
'设定工作轴能见度
/ I6 ?9 L5 N: G& i+ Q For Each oWorkAxis In ooDoc.ComponentDefinition.WorkAxes
# ]: L/ V3 S3 e" a/ L8 Q- {8 R6 ~ oWorkAxis.Visible = False: W1 R% u& E( @: M, ]; B
Next
" R+ {- ]8 P1 k% [' V3 g 7 s" J/ d9 O) \* o2 I1 `
'设定工作点可见性% H, C& k& H. E! z: _, x
For Each oWorkPoint In ooDoc.ComponentDefinition.WorkPoints
% K+ \* B. @- o% c' e oWorkPoint.Visible = False
9 W# }8 K0 \* v: K4 b" X Next
; x4 N C& e( X7 T$ ~. f8 Y& o! }/ m
'设置iproperty在保存时使用ISO视图. w) ?8 ^% @, m* w; y
ooDoc.SetThumbnailSaveOption _' R5 g# \# y- s8 H* B! v
(ThumbnailSaveOptionEnum.kActiveComponentIsoViewOnSave): p, y0 G' U+ z% V) {
% \$ _( z# @+ Z7 s8 e$ \/ ~0 L; N
'尝试保存+ N$ r) O4 N% k
Try, r' ]6 t J. J
ooDoc.Save
5 Q. P& g% o' ^0 [: z' V# N% s' G Catch 0 D' q, T$ J/ g- W7 K$ j4 n( g
'捕获错误而不做任何事情' e* S1 k, ?6 `! \
End Try
% h) D6 A6 Q' Y, M 4 t1 b' E. M" K
'关闭文件. d9 p$ n& K2 f+ h9 a9 J r$ A3 i [
' ooDoc.Close
8 n3 ?' j8 y. \+ g% i0 I6 A# O% \) |! t: K, D+ U+ i
'改回原来的方案7 D8 ?' L) f+ u( k
ThisApplication.ColorSchemes.Item(oColorScheme).Activate 7 v* h9 {! K! k+ W7 R# g
9 K) U6 `9 T9 V6 z( s* X, F# R
'改变回原来的背景地面类型! C. R3 _ h# y8 Z" o
ThisApplication.ColorSchemes.BackgroundType = oBackGroundType
3 p1 W; }, |" `# A' t5 P |