楼下的网盘链接如失效,请复制以下ILOGIC代码。! c$ ?, I9 n7 ^8 E7 u
'thanks for Autodesk rocky God giving me help! The code comes from the official forum of Autodesk in the United States,by Curtis_W% c( i( i0 m, s- _/ [2 `
3 q' j+ o$ [" \4 x
'获取当前的颜色方案名称- o7 ]% ~1 h5 f! b3 o6 }4 w7 M
oColorScheme = ThisApplication.ActiveColorScheme.Name8 o5 Y3 `- D0 I. D
" F7 q; c9 U- U% J# N6 t3 M
'获取当前配色方案背景类型
; u, o# c. b4 D% T+ qoBackGroundType = ThisApplication.ColorSchemes.BackgroundType* V2 h- e+ y2 D+ I* W5 W
# G) G- T. r* E7 @# M1 z( K'更改为演示文稿(白色背景)
3 W5 h6 x* f3 Q, d9 jThisApplication.ColorSchemes.Item("表达视图").Activate2 T# }$ l9 c; |) i; K7 i- |
! R* Z: L: E3 x3 f( _% y
'设置为使用一种颜色背景类型
0 q4 g0 n( Z9 t, g5 k9 t3 t% @4 kThisApplication.ColorSchemes.BackgroundType =BackgroundTypeEnum.kOneColorBackgroundType , g p) i' \, @7 ^3 Y0 b$ @7 r( t
Dim ooDoc=ThisDoc.Document
) O4 A" J9 ^ ^6 Q* o0 NIf ooDoc.DocumentType= kPartDocumentObject Then GoTo AA3 @, J- o6 F8 k+ d6 A" f
Dim oAsmDoc As AssemblyDocument* R' k: E* T5 V. O7 [
oAsmDoc = ThisApplication.ActiveDocument9 Z2 F' N: {/ `1 C4 x+ {, p. v
Dim oDoc As Document
. F, n! Y' [0 q- lDim oRefFile As FileDescriptor
0 ?" t6 g& K* j4 k" Z! T0 \3 \5 h3 i6 E- Q, M
* n# k9 A' N3 b# p; P+ u/ @For Each oDoc In oAsmDoc.AllReferencedDocuments
2 v$ j7 F% J$ _! y+ i/ G) Y ThisApplication.Documents.Open(oDoc.FullFileName, True) 1 H; h, O& s" }2 {$ }' [8 k
5 N. p4 |- g, _6 k, q5 s9 Z$ W
For Each oSketch In oDoc.ComponentDefinition.Sketches! p8 y2 i% E9 G3 @% V/ b
oSketch.Visible = False
9 |) r$ }8 H& @" Z Next6 i# S! i+ F4 M5 x4 F
6 W" N4 o& X7 E) r3 S. I) O '设置工作平面能见度2 Y+ S) {: c. p- [1 p
For Each oWorkPlane In oDoc.ComponentDefinition.WorkPlanes: c `* }: X. m4 c3 P
oWorkPlane.Visible = False
% [+ {* E% c) p! {# P( h& P Next
+ T: n: z5 Q" o, s, Q% t
$ b2 | f0 o( J8 F9 i6 s '设定工作轴能见度
2 B _" `. Z! Y- T5 T/ ? For Each oWorkAxis In oDoc.ComponentDefinition.WorkAxes
4 J* @2 ^' d: C4 e6 O5 F oWorkAxis.Visible = False
; V. V" r0 f" B! n# a0 F Next; y4 `1 Q2 Z# j! i
4 o5 ?7 y; {. ~1 O" w; U+ e5 X& t9 |
'设定工作点可见性2 b* y( g! j. c( z! ]% p
For Each oWorkPoint In oDoc.ComponentDefinition.WorkPoints
- ?. ]* E$ h; i+ Z- h! j oWorkPoint.Visible = False
( G& X4 B) w3 u) R1 N' v4 h Next, r; R, b& Y7 Q: b) T
7 ]) L; O& h. V. b$ J '设置iproperty在保存时使用ISO视图0 @+ H) ?0 D! I; x1 C; `
oDoc.SetThumbnailSaveOption _7 ]. P5 }/ f: P( J5 d9 k7 W% ^
(ThumbnailSaveOptionEnum.kActiveComponentIsoViewOnSave)
2 _6 v# D$ L8 ^( U* |! [ % j. g! s5 [" b0 B! q% p( ?
'尝试保存
9 F; S$ [4 S! | Try
0 `+ U* S- Y# T { oDoc.Save6 a" ]" S" F+ V2 ?/ a* J: _4 M
Catch " H9 O# {- L, }- w$ o
'捕获错误而不做任何事情9 j: F3 @1 t1 N7 S0 i
End Try
% N; [8 y5 r! \8 M
& `% U/ y6 q$ O! Q '关闭文件$ Y) B0 G7 S ]6 j+ [
oDoc.Close% Y" J! n' ?% g6 e4 B$ L# ]! A# v$ z% ^
Next
7 H) I7 s% A" I/ C; I( n! HAA:For Each oSketch In ooDoc.ComponentDefinition.Sketches
/ p( }; T# R- g5 J1 q& D oSketch.Visible = False
3 z1 N: h7 y9 S% G Next
# K8 S# B1 s8 p( G5 Z( i! }0 ~) y
7 T$ x6 V3 V9 N1 S, k) q$ r# i '设置工作平面能见度
$ l+ D3 j3 L; C For Each oWorkPlane In ooDoc.ComponentDefinition.WorkPlanes
* ]2 W& w8 b9 i0 l oWorkPlane.Visible = False& W) T& e! }& r, z8 P4 | e
Next2 O* w. ?- O/ E! m, I$ l; h0 ~
% [+ R( T4 R0 x
'设定工作轴能见度
6 V: W! m. ]; Q( }8 R+ a1 V% v0 K For Each oWorkAxis In ooDoc.ComponentDefinition.WorkAxes9 w1 V! N3 s4 _4 \
oWorkAxis.Visible = False
D/ c9 p! q) ^ Next$ V+ |, T2 B( p: E8 T# Z X+ P) V# c7 I
; w2 V/ L7 o! P% b3 r '设定工作点可见性
* M/ f; F5 G* u For Each oWorkPoint In ooDoc.ComponentDefinition.WorkPoints
" B2 v6 ]7 w+ x2 O( E0 ` oWorkPoint.Visible = False
2 C& f7 t- H9 i: H# |, K, N Next! n1 p- k2 F: z3 ]! z) o* C
! _6 p$ j8 A0 S" t. `* m
'设置iproperty在保存时使用ISO视图 X& S6 N. Q! X: B% L
ooDoc.SetThumbnailSaveOption _7 }0 j8 @# P; G* X9 _
(ThumbnailSaveOptionEnum.kActiveComponentIsoViewOnSave); w) p+ c& K, B
# a7 M0 ?1 |) h# J, C7 f '尝试保存
% _! l2 Q; }+ Q2 m8 W8 ` Try
: z7 N# b4 a6 G: b" k3 v, h9 p ooDoc.Save
/ ^+ j8 C/ H8 i, E Catch j) |3 @8 `. G' i
'捕获错误而不做任何事情& S6 Y+ Q+ S, H% i8 q
End Try. _3 }* y. A$ M3 l6 _
- w" h. r! U$ ^* l. d
'关闭文件
7 ]% L1 t" g) \0 ~4 G' ooDoc.Close* L0 m9 D: i6 e7 S
3 p/ Y* f) i7 c9 k8 @' I- G; K( t'改回原来的方案
5 v% k5 Y* d- d! Y7 JThisApplication.ColorSchemes.Item(oColorScheme).Activate + M7 K& U% V2 x8 E) q3 q0 p
2 [4 L6 |; U2 F0 X: T
'改变回原来的背景地面类型3 _% B4 ?9 d4 } J0 X2 B
ThisApplication.ColorSchemes.BackgroundType = oBackGroundType
2 E# m3 n; [! B, o8 Z |