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

首頁 > 開發 > 綜合 > 正文

solidworks二次開發-02-用來訪問特征的兩個API

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

solidworks二次開發-02-用來訪問特征的兩個api
來學習兩個api:

selectbyid2和getselectedobject5。這兩個函數,第一個通過給出對象的name選擇對象。第二個通過啟用程序前已經選擇的索引得到對象。

看下面程序:

option explicit

dim swapp as sldworks.sldworks

dim model as modeldoc2

dim feature as feature

dim boolstatus as variant

 

sub main()

 

set swapp = application.sldworks

set model = swapp.activedoc

 

' 選擇叫"拉伸1"的特征

boolstatus = model.extension.selectbyid2("拉伸1", "bodyfeature", 0, 0, 0, false, 0, nothing, swselectoptiondefault)

 

'主要就是這一句話,在寫option explicit后函數的最后一個參數swselectoptiondefault可以使用0來代替

' if the selection was successful, that is, "extrude1" was

' selected and it is a "bodyfeature", then get that feature; otherwise,

' indicate failure

if boolstatus = true then  '如果有“拉伸1”這個特征下面的代碼將其選中

    dim selmgr as selectionmgr

    set selmgr = model.selectionmanager

    set feature = selmgr.getselectedobject5(1) '此處使用一個索引來得到特征

    debug.print feature.name

else

    debug.print "error"

end if

 end sub

最后列出這兩個函數的vb語法:

modeldocextension::selectbyid2



 



description



this method selects the specified entity.



 



syntax (ole automation)



retval = modeldocextension.selectbyid2 ( name, type, x, y, z, append, mark, callout. selectoption )




input:



(bstr) name



name of object to select or an empty string



input:



(bstr) type



type of object (uppercase) as defined in swselecttype_e or an empty string



input:



(double) x



x selection location or 0



input:



(double) y



y selection location or 0



input:



(double) z



z selection location or 0



input:



(variant_bool) append



if...



and if entity is...



then...



true



not already selected



 



the entity is appended to the current selection list



already selected



the entity is removed from the current selection list



false



not already selected



the current selection list is cleared, and then the entity is put on the list



already selected



the current selection list remains the same



 



input:



(long) mark



value that you want to use as a mark; this value is used by other functions that require ordered selection



input:



(lpcallout) callout



pointer to the associated callout



input:



(long) selectoption



selection option as defined in swselectoption_e (see remarks)



output:



(variant_bool) retval



true if item was successfully selected, false if not




selectionmgr::getselectedobject5



  



description



this method gets the selected object.



 



syntax (ole automation)



retval = selectionmgr.getselectedobject5 ( atindex )




input:



(long) atindex



index position within the current list of selected items, where atindex ranges from 1 to selectionmgr::getselectedobjectcount



output:



(lpdispatch) retval



pointer to the dispatch object as defined in swseltype_e; null may be returned if type is not supported or if nothing is selected




也可以通過com使用vc來訪問。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 阳泉市| 湖南省| 滦平县| 石林| 容城县| 布拖县| 内丘县| 澎湖县| 辽宁省| 永丰县| 杭锦后旗| 襄樊市| 玛曲县| 伊宁县| 兴隆县| 米易县| 祥云县| 清水县| 梁河县| 江西省| 冀州市| 岳阳县| 都江堰市| 化州市| 合肥市| 叙永县| 毕节市| 临汾市| 宝山区| 宜城市| 电白县| 汝州市| 元朗区| 九寨沟县| 喜德县| 临安市| 子洲县| 界首市| 临澧县| 长沙市| 吉首市|