![]() |
【转帖】solidworks二次开发
solidworks二次开发
www.dimcax.com 各位大侠: 0 c; o& p f5 ?8 ^* ]; n4 b 我要用vb编写程序打开solidworks零部件,程序如下: # r0 d2 e5 q9 s* [option explicit 8 c. z% z( x2 x7 ?const filedir as string = "f:\solidworks\"& ^# @% o l1 l2 t" a% r dim withevents swapp as sldworks.sldworks0 {% v! z0 m7 h$ s" w$ q2 t) d dim withevents swmodel as sldworks.modelview & d, o4 q/ n& [; f: e8 m& l5 l$ a. fprivate sub cmdsldworks_click() # i/ v7 b0 k& t$ v) m" z set swapp = createobject("sldworks.application")9 u. t- {; }& `0 }4 a5 [- h/ d4 t. ^ if chkopen.value = true then8 s& n$ j, ~4 |% m+ x- s% q dim fileerror as long 8 l; r, ]. v# h4 q dim filewarning as long : i( f2 u8 z( p( s# j swapp.opendoc6 filedir + textbox1.text, _3 |2 \0 }" r# v+ n7 e v swdocpart, swopendocoptions_silent, _7 b. t# l! t# s0 y6 c1 r "", fileerror, filewarning0 u( n5 z0 o b6 l4 g- ^. }4 f end if / b8 _9 x. q/ h' \% lend sub$ d- u: j" x& k, v8 s7 z. o 但是无法打开,不知道为什么。哪为给指点指点,在线急等!!!! 1.检查一下solidworks的路径 ! [) ^5 j( f& g( m% d2.如果用vb,看一下vb对象有没有勾选sldworks type librery。 ; a4 u! u6 d7 w t$ n) y2 a / u+ {% l3 @' d: j+ x: z# h其实你先录制宏,打开之后保存下来就行了……………… dim withevents swmodel as sldworks.modelview 7 b7 y0 t; e, smodelview改modeldoc2: v) {* ^* d; u$ j2 a$ v/ g+ e 建议楼主先看看sw的api对象模型 |
| 所有的时间均为北京时间。 现在的时间是 05:59 PM. |