樓下的網盤鏈接如失效,請復制以下ILOGIC代碼。
; C( c1 y. S+ y5 J8 R'thanks for Autodesk rocky God giving me help! The code comes from the official forum of Autodesk in the United States,by Curtis_W
4 }# Q) g. ?; {; t; V( p Y4 C- o1 @) n8 D
'獲取當前的顏色方案名稱
# B h4 U6 ~. F- M+ j) koColorScheme = ThisApplication.ActiveColorScheme.Name+ x$ c: t# z1 T# y$ P$ d
/ s d) {# }) a9 J0 q7 j'獲取當前配色方案背景類型
; I( B6 D0 s1 M' U2 Q: T3 d6 AoBackGroundType = ThisApplication.ColorSchemes.BackgroundType8 U0 T6 E( E5 c& Q. _/ a
1 S; g5 w" }' |: V" v1 y: o'更改為演示文稿(白色背景)8 x2 S' h3 R' z' E; N" F
ThisApplication.ColorSchemes.Item("表達視圖").Activate
' D5 \% R) n$ ]; i- B1 T% [
( ?; b# N _& y/ ]6 j'設置為使用一種顏色背景類型
* M, c0 H, _7 m! {( CThisApplication.ColorSchemes.BackgroundType =BackgroundTypeEnum.kOneColorBackgroundType & D! I! S, \( c' g- _
Dim ooDoc=ThisDoc.Document
6 ^) N* o K. g! d. o- K0 {0 U5 rIf ooDoc.DocumentType= kPartDocumentObject Then GoTo AA
8 m3 I' n6 K+ y& J5 _: d3 aDim oAsmDoc As AssemblyDocument
( A- B# N& J* {. woAsmDoc = ThisApplication.ActiveDocument
; O! x4 X7 f* n9 `. qDim oDoc As Document/ M9 Z! b& `/ M+ v5 _
Dim oRefFile As FileDescriptor
( U1 }) o# H, [) P" s* g8 N: r% h: g( g I' c" a$ a0 t m9 y/ Q o
$ I) Y" ?+ i& m. C
For Each oDoc In oAsmDoc.AllReferencedDocuments* o! r6 j. f4 A2 `
ThisApplication.Documents.Open(oDoc.FullFileName, True)
" N; p9 g) ^& Q6 X
# m0 R: h) X1 z! V _/ ]1 a$ e For Each oSketch In oDoc.ComponentDefinition.Sketches9 o$ f e( D9 O1 w# Z6 x, ~, N. n" U
oSketch.Visible = False. V3 \9 k0 \9 S; b3 @) t
Next
) C/ t. K/ v! a p j- A
' E0 m2 Z2 w: Y- S3 u) ~. y '設置工作平面能見度
7 `% S2 P0 `1 G' O# x For Each oWorkPlane In oDoc.ComponentDefinition.WorkPlanes& L# v& m9 Z; V7 @7 G3 m+ j
oWorkPlane.Visible = False
5 i* _; T/ Z2 Y M Next8 p) U+ d0 R# Z7 f# a
* n# M Q6 B% m+ X" F4 u
'設定工作軸能見度/ F) a6 M$ z4 S2 J0 z: t. P
For Each oWorkAxis In oDoc.ComponentDefinition.WorkAxes+ O3 G: I* H; u
oWorkAxis.Visible = False
, S# S; C" q; v Next7 m$ D8 M) V' U$ Z# o# m( T
4 [: ~( e4 G. s# b9 o( _# E6 O
'設定工作點可見性% G2 H2 Q4 W" L# ^$ j J, Z: m
For Each oWorkPoint In oDoc.ComponentDefinition.WorkPoints: Q: {! F+ Y' H2 T8 n6 q. |
oWorkPoint.Visible = False
$ f. D3 V4 P# _1 N# G& Q Next
* c9 [. i2 x4 e3 E7 Y
* L- m1 K( s4 j6 D0 U '設置iproperty在保存時使用ISO視圖5 h( X$ [) g5 C! |% \2 h; b
oDoc.SetThumbnailSaveOption _
, Q: k! Q* X* [) H (ThumbnailSaveOptionEnum.kActiveComponentIsoViewOnSave)
) f; f9 a) O- q7 }& M4 C$ Y 7 P6 x% V* ^, f J" y$ b, C
'嘗試保存( H6 X3 n8 s: \0 P
Try' u' t& h. H' ~" N) C
oDoc.Save
/ U" D3 Q& |" W. M5 V2 @ Catch $ t5 k$ |. F: D+ \/ {' {! l+ N ^
'捕獲錯誤而不做任何事情2 E9 {* S) T: y
End Try; J3 h: P8 M7 r! ^2 h1 V
/ r. Z9 ~+ t0 V$ _ F '關閉文件
% U4 Z1 C# D6 ~. H oDoc.Close
9 D8 ?3 f; i2 N* h+ k7 A# ZNext9 {8 F3 D0 F$ D! x- j
AA:For Each oSketch In ooDoc.ComponentDefinition.Sketches7 n; ~; P) y; [& D) H% @+ X
oSketch.Visible = False
: R; A' Q7 d+ I. `- U; V Next$ o3 y* \9 ^ o" d- ^
& k7 L7 V* p Y" e/ Y '設置工作平面能見度5 T% b+ v1 j: n
For Each oWorkPlane In ooDoc.ComponentDefinition.WorkPlanes2 c( O2 u' O N& V# \& Y2 ?5 z
oWorkPlane.Visible = False) k# s2 o" {8 ^ X0 N6 [6 N3 U% d
Next
$ @2 I, ~# r5 o3 b' ?
* B+ N6 z- Q( w4 \- g '設定工作軸能見度" `5 B4 G& t0 s
For Each oWorkAxis In ooDoc.ComponentDefinition.WorkAxes
! W6 ?1 p7 H7 \3 C4 Z oWorkAxis.Visible = False+ @# y. r- ^: ~7 j
Next0 Z7 `+ A) h2 M. @
a0 d' I( @' e8 c( C" T' _
'設定工作點可見性
+ l6 ^2 m" A/ O- F( h1 s) ^ For Each oWorkPoint In ooDoc.ComponentDefinition.WorkPoints$ ~% u u7 v5 @
oWorkPoint.Visible = False/ k& y& l b2 ^ P1 g) ]
Next
& _/ s4 y# S* s! d- @( |4 j Z, T5 H; B0 i* C6 s$ s
'設置iproperty在保存時使用ISO視圖+ x5 K: T: p5 S! i: c" A
ooDoc.SetThumbnailSaveOption _/ z" q& R. H5 n4 g8 I
(ThumbnailSaveOptionEnum.kActiveComponentIsoViewOnSave) a1 N" Q8 K1 m; L$ H# R
* F) E( p+ @' o" f7 ^/ y '嘗試保存
8 L( N7 i+ a# }' G o2 ] Try9 P K. g: Y- U; |
ooDoc.Save3 C' ^( Q8 ]6 m- M
Catch
, z4 l8 \( E' Z '捕獲錯誤而不做任何事情 G5 Z, b6 r5 u( D, I/ C
End Try
8 [3 V9 ?: |4 p9 d% X8 m& h 6 l/ S% Y h% h! D- W# f
'關閉文件
0 V+ s @- b. u( o* s5 I' ooDoc.Close
* }8 h4 a1 t/ W6 e/ {2 g5 n8 R* z* `# C2 W: T3 ?1 Q$ C$ E
'改回原來的方案
) w4 ^( S- N6 ~3 M/ YThisApplication.ColorSchemes.Item(oColorScheme).Activate
/ w& W5 f/ N* e% Y0 s: S+ ^6 ]- j/ G1 u6 d+ a& i& E
'改變回原來的背景地面類型
5 B2 I3 u" d; r. [+ Z& n2 |ThisApplication.ColorSchemes.BackgroundType = oBackGroundType
. @7 x4 L: t/ ?, E5 u |