|
响在江湖 发表于 2016-10-13 20:099 Y3 H# C1 g. L; `" i4 ~
首先感谢社友回复,不过你发的这个怎么复制到txt中呀?复制代码后只有“”ExportToDWG“这个。
, X; f9 c: b& h! A# S1 u% c" ~* H还有API ...
( Q! w! q1 ?1 f2 n+ Z% P稍微修改了帮助文件里面的代码代码如下
! m9 ^4 w( D2 q1 J2 \* s- Option Explicit
; o& n$ I. D3 s& E( Z( I - Dim swApp As SldWorks.SldWorks' I( S/ ^4 {# {
- Dim swModel As SldWorks.ModelDoc2
- j. I( e( Y" j; Y, }' T - Dim swModelDocExt As SldWorks.ModelDocExtension
% h3 t& B9 U1 o. E5 s - Dim FileName As String3 Z- k4 D. w5 {$ C/ |! k
- Dim NewName As String
/ W2 n, |( P7 e& D$ f) _/ u - Dim boolstatus As Boolean G$ `' G! u% d/ u- t& E8 E; ?& u
- Dim longstatus As Long, longwarnings As Long
R& l' V$ ?/ ~/ q# ^" C. G. a - Sub main()" ~% q! |: r/ V6 ?
- Set swApp = Application.SldWorks
; ]+ |0 f" G/ F& u& b - Set swModel = swApp.ActiveDoc4 i; `6 Z9 R+ L$ `4 g" }' b
- Set swModelDocExt = swModel.Extension' x; [9 j( ~2 U& I
- FileName = swModel.GetPathName()
9 K& b, Q. D5 c. X, |( z - NewName = Left(FileName, Len(FileName) - 7) & ".dwg"
% q6 j# S4 _3 d( p - boolstatus = swModel.ExportFlatPatternView(NewName, swExportFlatPatternOption_None); o5 J8 j4 C8 }) i
- swModelDocExt.SaveAs NewName, 0, 0, Nothing, longstatus, longwarnings
* g4 m; T2 m1 y! Z/ x5 O" _ - End Sub
% f- u, D0 m6 B4 P
复制代码 , T2 _3 H M0 [6 y
% l5 t' e2 Y) a, S/ e1 {* U: ~ |
|