国产探花免费观看_亚洲丰满少妇自慰呻吟_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來訪問。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 久治县| 明溪县| 建水县| 临江市| 房山区| 舟山市| 睢宁县| 江津市| 集贤县| 监利县| 合川市| 博客| 吴川市| 金川县| 松阳县| 丰宁| 天镇县| 汕头市| 岐山县| 稷山县| 青州市| 牙克石市| 平塘县| 呈贡县| 汝阳县| 于都县| 大田县| 克拉玛依市| 广州市| 游戏| 丘北县| 青冈县| 库尔勒市| 积石山| 将乐县| 浦东新区| 广灵县| 得荣县| 金川县| 滨州市| 邓州市|