国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

solidworks二次開發--10--從example中尋找

2024-07-21 02:15:49
字體:
來源:轉載
供稿:網友

商業源碼熱門下載www.html.org.cn


solidworks的api幫助還是很全面的,里面有好多見簡單而有效的程序,成天在api幫助里泡著,現在做程序的速度是越來越快。好像當年成天在excel中錄制宏看代碼的感覺。下面的程序是api幫助里的,它用來顯示裝配體的所有零部件。我給我的同事們用,他們覺得不錯 :)。程序使用了一個簡單的遞歸方法遍歷了裝配體。
make all assembly components visible example (vb)
this example shows how to make all assembly components visible.

 

'---------------------------------------

'

' preconditions: an assembly document is open.

'

' postconditions: any hidden assembly components are made visible.

'

'---------------------------------------

option explicit

public enum swcomponentvisibilitystate_e

}}-->    }}-->swcomponenthidden = 0

}}-->    }}-->swcomponentvisible = 1

end enum

 

sub traversecomponent _

( _

}}-->    }}-->swcomp as sldworks.component2, _

}}-->    }}-->nlevel as long _

)

}}-->    }}-->dim vchildcomparr }}-->              }}-->as variant

}}-->    }}-->dim vchildcomp }}-->                 }}-->as variant

}}-->    }}-->dim swchildcomp }}-->                }}-->as sldworks.component2

}}-->    }}-->dim swcompconfig }}-->               }}-->as sldworks.configuration

}}-->    }}-->dim spadstr }}-->                    }}-->as string

}}-->    }}-->dim i }}-->                          }}-->as long

}}-->    }}-->

}}-->    }}-->for i = 0 to nlevel - 1

}}-->        }}-->spadstr = spadstr + " }}--> }}-->"

}}-->    }}-->next i

}}-->    }}-->

}}-->    }}-->vchildcomparr = swcomp.getchildren

}}-->    }}-->for each vchildcomp in vchildcomparr

}}-->        }}-->set swchildcomp = vchildcomp

}}-->        }}-->

}}-->        }}-->debug.print spadstr & swchildcomp.name2 & " <" & swchildcomp.referencedconfiguration & ">"

}}-->        }}-->

}}-->        }}-->if swcomponenthidden = swchildcomp.visible then

}}-->            }}-->swchildcomp.visible = swcomponentvisible

}}-->        }}-->end if

}}-->        }}-->

}}-->        }}-->traversecomponent swchildcomp, nlevel + 1

}}-->    }}-->next

end sub

 

sub main()

}}-->    }}-->dim swapp }}-->                      }}-->as sldworks.sldworks

}}-->    }}-->dim swmodel }}-->                    }}-->as sldworks.modeldoc2

}}-->    }}-->dim swassy }}-->                     }}-->as sldworks.assemblydoc

}}-->    }}-->dim swconf }}-->                     }}-->as sldworks.configuration

}}-->    }}-->dim swrootcomp }}-->                 }}-->as sldworks.component2

}}-->    }}-->dim bret }}-->                       }}-->as boolean

}}-->    set swapp = application.sldworks

}}-->    }}-->set swmodel = swapp.activedoc

}}-->    }}-->set swconf = swmodel.getactiveconfiguration

}}-->    }}-->set swrootcomp = swconf.getrootcomponent}}-->}}-->

}}-->    }}-->debug.print "file = " & swmodel.getpathname

}}-->    traversecomponent swrootcomp, 1

end sub
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 鲜城| 东兰县| 永靖县| 太白县| 城口县| 万安县| 通道| 牟定县| 和平区| 霍林郭勒市| 临海市| 余庆县| 固镇县| 临潭县| 通河县| 新密市| 松江区| 阜新市| 永昌县| 杭锦后旗| 西吉县| 阳曲县| 合阳县| 义乌市| 奉新县| 乌审旗| 隆安县| 五华县| 洛南县| 恩施市| 宝兴县| 庄河市| 平舆县| 阿瓦提县| 大埔县| 平利县| 龙州县| 荣成市| 西林县| 福清市| 富宁县|