|
; H) d m* a) i* M. I/ Q稍微修改了幫助文件里面的代碼代碼如下
$ m$ ~# v B7 T: J2 v& S" t6 G- Option Explicit
& y- i3 k V$ s- T* W - Dim swApp As SldWorks.SldWorks/ n c3 g; U4 \* a& ?5 y
- Dim swModel As SldWorks.ModelDoc2
W1 S7 J) Z* J( D - Dim swModelDocExt As SldWorks.ModelDocExtension" W$ N1 n, E& F; f, X1 B, X0 b
- Dim FileName As String
0 B& I$ q' X6 S - Dim NewName As String, ^7 [# i" U$ L! i q8 A% W$ k$ o
- Dim boolstatus As Boolean- }: b) E Q" k& F4 L9 s" C
- Dim longstatus As Long, longwarnings As Long9 V8 c+ @/ m, l, ]* N/ E
- Sub main()
) O5 i4 J. D+ J) Y+ m( d: r0 w - Set swApp = Application.SldWorks
2 Z& V5 x9 H; P$ S$ X - Set swModel = swApp.ActiveDoc
) ^+ T* s! w d" d* l - Set swModelDocExt = swModel.Extension
& o3 @' Q6 w4 j& F* P8 w+ U - FileName = swModel.GetPathName()
5 V+ a9 K0 F3 o, f4 M4 j - NewName = Left(FileName, Len(FileName) - 7) & ".dwg"
: }. z; d X. r - boolstatus = swModel.ExportFlatPatternView(NewName, swExportFlatPatternOption_None)
- h1 R' X6 }7 ?( |8 V# n2 g - swModelDocExt.SaveAs NewName, 0, 0, Nothing, longstatus, longwarnings. w! `0 B. G3 }& \: Z) Z1 Y
- End Sub
2 M4 C" r: }- d+ i2 U. E
復制代碼 + N }# F8 ?* S4 }0 ]0 }( b2 E6 }. Y
" M2 g7 y1 d' ?* `
|
|