dchlmz 发表于 2007-9-3 09:12:00

VB使用选择集问题??

本帖最后由 作者 于 2007-9-3 9:33:58 编辑 <br /><br /> <p>&nbsp;&nbsp;&nbsp; Set acadApp = New AutoCAD.AcadApplication<br/>&nbsp;&nbsp;&nbsp; 'acadApp.Visible = False<br/>&nbsp;&nbsp;&nbsp; acadApp.Visible = True<br/>&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; acadApp.Application.Documents.Open FileName<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; acadApp.Application.ActiveDocument.PurgeAll<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; acadApp.Application.ZoomExtents<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; acadApp.Application.Update<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; '创建空白选择集<br/>&nbsp;&nbsp;&nbsp; Dim SetObj As AcadSelectionSet<br/>&nbsp;&nbsp;&nbsp; Set SetObj = CreateSelectionSet<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; '建立选择集过滤器<br/>&nbsp;&nbsp;&nbsp; Dim TypeArray(1) As Integer<br/>&nbsp;&nbsp;&nbsp; Dim DateArray(1) As Variant<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; BuildFilter TypeArray, DateArray, 8, "TK", 0, "LWPOLYLINE"<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; '过滤出所要选择的图元<br/>&nbsp;&nbsp;&nbsp; SetObj.Select acSelectionSetAll, , , TypeArray, DateArray<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; '显示选定的图块名称及数量<br/>&nbsp;&nbsp;&nbsp; MsgBox "数量为" &amp; SetObj.Count</p><p></p><p>利用上面方法SetObj.Count总是为空的(调试时SetObj.Count显示为对象变量或WITH块变量未设置,),不知道为什么??可是用VBA时又是正常的</p><p>还请各位指点,谢谢<br/></p>

dchlmz 发表于 2007-9-5 06:44:00

乍没有人回呀,

dchlmz 发表于 2007-9-7 10:56:00

只能自己顶一下了

dchlmz 发表于 2007-9-28 09:15:00

这么久,没有人回复,在顶一下...

烟雨.江南 发表于 2007-9-28 09:50:00

<p>&nbsp;Set SetObj = CreateSelectionSet</p><p>这一句,&nbsp;CreateSelectionSet 是你自己定义的一个函数吧?你调试一下,看看该语句之后,SetObj这个变量是否被赋值了。</p>

dchlmz 发表于 2007-10-10 09:10:00

多谢谢 <font face="Verdana" color="#61b713"><strong>烟雨.江南</strong>
                <font color="#000000">提醒,是我疏忽了</font></font>
页: [1]
查看完整版本: VB使用选择集问题??