楼下的网盘链接如失效,请复制以下ILOGIC代码。5 B" R2 I# G" ^( X9 Y8 Y' c
'thanks for Autodesk rocky God giving me help! The code comes from the official forum of Autodesk in the United States,by Curtis_W) O9 d8 Y& u3 d
6 x" t o, D. V# v. n# }; u
'获取当前的颜色方案名称
; F3 f% N; K, h- s% U8 X0 loColorScheme = ThisApplication.ActiveColorScheme.Name
3 X8 q0 \6 H5 G* j% t# Q7 `) g7 N
+ M% v$ i6 z% A'获取当前配色方案背景类型2 r2 F( i6 b$ v
oBackGroundType = ThisApplication.ColorSchemes.BackgroundType- N5 M% R' ]7 W# W" J
. `* _2 b$ K" S: F'更改为演示文稿(白色背景): @ ^; R" X, n/ o2 M
ThisApplication.ColorSchemes.Item("表达视图").Activate1 t. s3 k6 E. L5 ]2 [
4 {5 e/ D# v- w- | D'设置为使用一种颜色背景类型6 i, j: | d, T6 q1 b2 H
ThisApplication.ColorSchemes.BackgroundType =BackgroundTypeEnum.kOneColorBackgroundType
" Z$ L% Z. l* }# e2 k* XDim ooDoc=ThisDoc.Document
/ k# G+ I0 k7 z! T5 l+ w' X" t% W0 [If ooDoc.DocumentType= kPartDocumentObject Then GoTo AA
8 b' }* j" ?9 K: B. J: g# eDim oAsmDoc As AssemblyDocument' B6 h, Z& |" O) M
oAsmDoc = ThisApplication.ActiveDocument4 a$ w. P1 M6 ^ A* A
Dim oDoc As Document
4 q+ r# @; q9 g+ m! QDim oRefFile As FileDescriptor
' }7 p9 N S# K8 m. v% M0 Q, l( b# t2 C' G
3 V3 r, ?& X! n: ~1 c# l2 ^% X7 V
For Each oDoc In oAsmDoc.AllReferencedDocuments2 z1 M( q+ r: a! F# X! w6 G
ThisApplication.Documents.Open(oDoc.FullFileName, True) 6 h( _* f, ]7 p9 @0 B1 t
: L1 q% x) H' q$ Z$ ~8 ~- ]
For Each oSketch In oDoc.ComponentDefinition.Sketches, p3 [5 G9 O- {3 \$ Q7 y/ s: H7 O
oSketch.Visible = False2 R1 ~3 y Y: t; q3 Z8 r
Next1 P& }6 Y2 @4 q! M2 H' x9 a
5 B( l @. {, A7 w/ a! H1 ]. q '设置工作平面能见度8 _: ^; d) e g
For Each oWorkPlane In oDoc.ComponentDefinition.WorkPlanes
7 F& W3 i1 w( B. A oWorkPlane.Visible = False
% J& o+ v/ b% d8 l* L Next
- V, W( p( {, a+ f2 d / O3 F! O5 z* D3 _: k5 b
'设定工作轴能见度4 O6 T$ q# I) C; I( l
For Each oWorkAxis In oDoc.ComponentDefinition.WorkAxes$ f9 a0 B) [& l6 T
oWorkAxis.Visible = False5 J& r; }7 f% U- u) T- ^
Next9 o9 l$ U P* `4 d
: R4 u( P5 B! t1 f+ D" Q
'设定工作点可见性
' e4 b' _0 `& C* r For Each oWorkPoint In oDoc.ComponentDefinition.WorkPoints6 }+ y; J5 S6 {0 d
oWorkPoint.Visible = False
& K* t0 _6 k; V' p* ^1 n Next7 P& d, q: ^5 W9 N/ S1 S1 `
: W$ e, A4 j: |( z6 N3 ^5 z '设置iproperty在保存时使用ISO视图! y$ J7 e' z1 x; X% O f
oDoc.SetThumbnailSaveOption _% x4 Q* q' D2 w$ q
(ThumbnailSaveOptionEnum.kActiveComponentIsoViewOnSave)
' V: `7 V h! T# C& t3 w6 l
7 X, n. s% Z. o4 r '尝试保存$ F3 L7 O/ z) ]5 \8 l, j. l
Try& s4 I6 J; p( D$ }. @
oDoc.Save4 j+ u. S. S( L
Catch # p: ^1 h0 L. Z2 h* V% u
'捕获错误而不做任何事情
9 x+ y0 p( [ [) Q: w( c! I* z End Try5 Y( h0 y* ~; W6 S1 @
( I, K2 x% j& q6 x8 @/ y
'关闭文件0 B2 t" K" Q3 j( R7 c
oDoc.Close
. o4 s* C' e0 u+ ?Next/ S$ E6 J' d9 v! p, p: ^6 @
AA:For Each oSketch In ooDoc.ComponentDefinition.Sketches) Y2 i) n0 d2 F4 {" b3 C
oSketch.Visible = False# b; E$ n9 k6 `; N. R
Next- s% j( p5 J" {7 K7 L
9 E$ g' U4 D8 t3 t3 Y3 `
'设置工作平面能见度
6 |1 B& A! R$ k For Each oWorkPlane In ooDoc.ComponentDefinition.WorkPlanes
' F, V/ ]- O' b: _8 A* Z) v oWorkPlane.Visible = False3 \3 b) `( X V$ c: t
Next
" ]; X( U+ e7 A. |. K) l! j/ } X
7 T: K. O7 {9 D8 e3 T* n7 f '设定工作轴能见度* {8 F4 P) {4 D$ b) Q3 G: j
For Each oWorkAxis In ooDoc.ComponentDefinition.WorkAxes
0 E3 t- e( c( V4 b oWorkAxis.Visible = False8 l" v$ M E& v8 r+ c$ g
Next) D6 B! c2 X' @ E
1 E- s# o5 J0 n& X. s
'设定工作点可见性
/ `. b6 u. x: ?! l For Each oWorkPoint In ooDoc.ComponentDefinition.WorkPoints
4 T& E6 O+ d/ Y( C# Z( b oWorkPoint.Visible = False( o5 Q5 W9 t) d) s
Next
- Q- m, a7 ?$ S- }
7 r1 ^* L& H9 L( d. M '设置iproperty在保存时使用ISO视图
9 X: X2 q |/ c: t M2 c ooDoc.SetThumbnailSaveOption _
0 d+ Y9 B) A4 E3 K3 z (ThumbnailSaveOptionEnum.kActiveComponentIsoViewOnSave)
! V" [% x3 k) B + ]/ N$ H2 J9 Q
'尝试保存
4 U5 Y9 L& Q* k8 v, f( G# M Try% x3 {- s5 W0 B
ooDoc.Save
- A* x! p7 [ x! i+ L1 G5 _6 h- e Catch 0 t' ?: c9 S+ K6 B
'捕获错误而不做任何事情
2 G1 M( ]# ~; A( y, s, C4 ]8 x) G End Try! X8 P% a( m+ ~1 p* d7 }1 r
: [5 b4 [( W7 f
'关闭文件: h: t N3 z k8 B% w8 p
' ooDoc.Close
) K+ r% X0 Z5 [0 K$ L+ J
5 Q3 \3 \. C! c" h! Z* F& L'改回原来的方案
" R- R1 Z. i$ X- {ThisApplication.ColorSchemes.Item(oColorScheme).Activate
/ N* B5 B- l7 e
' A$ P" T3 Z" G+ l2 \'改变回原来的背景地面类型1 t9 H4 G: d, l& o& I; Z0 A
ThisApplication.ColorSchemes.BackgroundType = oBackGroundType
( p4 ]/ ^* R# L* [, g; w |