楼下的网盘链接如失效,请复制以下ILOGIC代码。
' q0 s$ ^: y9 U1 u$ q [* l+ Y5 w1 K'thanks for Autodesk rocky God giving me help! The code comes from the official forum of Autodesk in the United States,by Curtis_W0 t' o3 p5 D- r! R
' A# A! A+ t2 s' [1 b, [! o7 F' q: M
'获取当前的颜色方案名称) n# T9 S0 ~# f7 O
oColorScheme = ThisApplication.ActiveColorScheme.Name9 n" n" U7 O5 Z! O) F' j3 |# |& D
; W0 @; \ B; ~'获取当前配色方案背景类型
4 |0 E2 U, ], f1 K! J0 d7 r CoBackGroundType = ThisApplication.ColorSchemes.BackgroundType+ d" o1 s p# s& N% P
* q: `0 M0 z9 W'更改为演示文稿(白色背景)0 {2 |+ b7 a( M4 F, K! h/ `
ThisApplication.ColorSchemes.Item("表达视图").Activate3 {0 [ g/ `( n) d6 C6 [
& R% _( f1 X+ X1 h7 ]; s& s4 X
'设置为使用一种颜色背景类型6 R( \0 y4 F9 |* s. L
ThisApplication.ColorSchemes.BackgroundType =BackgroundTypeEnum.kOneColorBackgroundType 0 a$ C- @, u# `( k1 |5 h
Dim ooDoc=ThisDoc.Document4 w6 F/ i, _1 \7 G# M
If ooDoc.DocumentType= kPartDocumentObject Then GoTo AA" _) u) @1 z' u2 z' h1 L/ P
Dim oAsmDoc As AssemblyDocument
" N) Q* g/ z v( A$ _: ToAsmDoc = ThisApplication.ActiveDocument: J" O. v7 ^+ i2 z7 k T
Dim oDoc As Document" a3 ?) M: o; O8 q) @) y$ m8 {
Dim oRefFile As FileDescriptor. m* H; u( l `8 H
1 p {# Z' K" X/ R6 D. @8 ?% [; w
$ G6 }3 V( ]5 G8 p2 s+ y
For Each oDoc In oAsmDoc.AllReferencedDocuments. V7 `0 t6 k5 c( h6 v7 u
ThisApplication.Documents.Open(oDoc.FullFileName, True) & j. t# g D+ M/ I4 ]; X/ H1 ]
5 `. a% m* Y" n- R For Each oSketch In oDoc.ComponentDefinition.Sketches- ~& z# Q* H9 ^
oSketch.Visible = False
3 v+ S! f v: e' P" X$ N( W5 f0 k Next
4 ?1 a' R S, O9 f; k7 Q4 [ U& x. s0 J( k5 c5 u' w
'设置工作平面能见度 _' \& ]( X" R4 h9 Y3 l
For Each oWorkPlane In oDoc.ComponentDefinition.WorkPlanes# B1 ]: l# k9 A" v; D1 \- L( H
oWorkPlane.Visible = False- i/ ~+ @7 L7 i; I2 R# U4 r
Next
/ ?; ?( G0 }1 s- K) X7 Y
( Y* C! `2 g# t) V$ ^ '设定工作轴能见度7 Q# n! v( \! c$ z) Y& D* }
For Each oWorkAxis In oDoc.ComponentDefinition.WorkAxes
- X# |2 a7 m) r" ?% ?2 P oWorkAxis.Visible = False) R g0 ?8 F' p0 } A& g
Next
h" D6 b% u2 C( k' S; }4 f: b 2 p5 T6 w/ H f" c a
'设定工作点可见性
6 o- i7 |: H& ` For Each oWorkPoint In oDoc.ComponentDefinition.WorkPoints* V. [3 r) D& ?% K
oWorkPoint.Visible = False0 l% e) B. ~7 u9 w
Next
$ `6 u8 k2 ?; l( G c8 r
- F& ]0 d$ @0 z( v4 k! _( L" |" K/ ? '设置iproperty在保存时使用ISO视图
7 f# G; C" [4 R1 b& i oDoc.SetThumbnailSaveOption _
, I& ]) T4 L f* G% Z (ThumbnailSaveOptionEnum.kActiveComponentIsoViewOnSave)
+ W6 v! x: X. A% @1 v5 A- g* D3 b 8 U- |! d1 u- ?6 u5 _, ~
'尝试保存- g8 o- W k2 q% M( Y
Try# I; ~3 O$ K3 v% A" [: `/ q
oDoc.Save
" `! A- a# @# e6 R! ` Catch
* |6 f6 s3 Z- }6 u* | '捕获错误而不做任何事情& g5 [! d6 ?9 W `
End Try
2 i+ x9 i; H( M, _/ a9 H7 a, v " e* {/ t7 F2 h
'关闭文件
+ i( A* `! g" x" l oDoc.Close( Y, R' T6 }; E
Next
5 J7 k2 n0 j" B5 S( SAA:For Each oSketch In ooDoc.ComponentDefinition.Sketches/ |, n7 `7 M% A6 G. o
oSketch.Visible = False7 i5 G& r0 f1 Z$ F
Next
9 S. o8 P* e J8 O6 a. j& `0 r
+ y7 |/ O x3 f2 z '设置工作平面能见度
0 U: N2 W S- t3 A; A) J* N2 c For Each oWorkPlane In ooDoc.ComponentDefinition.WorkPlanes k& x/ b3 \( [3 ?/ Y% }5 e
oWorkPlane.Visible = False
+ x/ `& x7 H K2 G0 _7 Y1 g2 | Next: u' e0 j/ u2 B5 l+ W
- x$ B* y3 d4 h, t- E+ T: s6 f '设定工作轴能见度
. S& B$ X1 u: e* T# ~ For Each oWorkAxis In ooDoc.ComponentDefinition.WorkAxes
6 M. ~% J' E" A" {0 T* d3 ` oWorkAxis.Visible = False9 {4 @$ {+ k. o
Next
8 X5 V; j& J1 v, J 0 \8 }, M9 k) q5 K1 \4 C/ a9 R
'设定工作点可见性
* V/ I. p& e d' o5 \ For Each oWorkPoint In ooDoc.ComponentDefinition.WorkPoints, Y/ t3 F$ x" Z* l
oWorkPoint.Visible = False
0 X* c2 \: j; V- f( N Next
) S- e3 Q" y& P2 l
/ Z. ~0 o6 r5 P% e* e5 c/ ?4 v '设置iproperty在保存时使用ISO视图$ J( X9 }- g" E; {. n. M# R
ooDoc.SetThumbnailSaveOption _
: u5 B: x: d0 z7 `: W, T2 h (ThumbnailSaveOptionEnum.kActiveComponentIsoViewOnSave)) p2 z& `" l0 f
7 ]8 ]3 L: _* A. { '尝试保存4 B0 U3 U% u3 M- L' E( q
Try
H0 G8 i$ e% G8 U& F/ G% s4 n ooDoc.Save
4 Q* Z- D. k4 Z: Z( E. t* O! s Catch
) Z- v/ G" D- d9 L '捕获错误而不做任何事情
# m1 Q( f2 n, \( K End Try
; f! n& s( Y' b; O. I% }8 Q " P+ x: K& @6 v; z' |" F0 N$ g
'关闭文件
c( T* [8 {6 s' a6 k' ooDoc.Close
7 n: f4 d8 f/ h4 s+ _6 x9 f; c% |3 q0 j# U) A1 r3 ~' C, H2 j
'改回原来的方案
0 f' }, \: I: LThisApplication.ColorSchemes.Item(oColorScheme).Activate ; N- d, a/ }) o$ V* h3 H7 e
3 v+ g3 [0 n& S2 ]& @
'改变回原来的背景地面类型% b) f8 F. ?; `6 Z$ M Y2 R3 k: V: L
ThisApplication.ColorSchemes.BackgroundType = oBackGroundType6 W+ H" f& c" f- v( Y3 T I% e4 f0 D
|