chen_0801 发表于 2008-11-30 16:59:00

[求助] 请教高手,关于把全部多段线加入选择集

<p>把文件中的所有多段线都加入到选择集中。前面的语句是建立一个选择集,然后根下面的语句</p><p>fType(0) = 0: fDate(0) = "Polyline": fType(1) = 8: fDate(1) = "*"<br/>&nbsp;&nbsp;&nbsp; sset.Select acSelectionSetAll, , , fType, fDate</p><p>运行以后选择集里面没有加入任何对象。请问这是怎么回事?</p><p>我用sset.selectonscreen 就能把对象加入到选择集中</p><p></p>

dianbotang 发表于 2009-3-25 18:11:00

<p>Private Sub SelectLWPOLYLINE()<br/>&nbsp;&nbsp;&nbsp; Dim SSet As AcadSelectionSet<br/>&nbsp;&nbsp;&nbsp; Set SSet = CreateSelectionSet<br/>&nbsp;&nbsp;&nbsp; Dim fType(1) As Integer&nbsp;&nbsp; ' 过滤器规则<br/>&nbsp;&nbsp;&nbsp; Dim fData(1) As Variant&nbsp;&nbsp; ' 过滤器参数<br/>&nbsp;&nbsp;&nbsp; fType(0) = 0: fData(0) = "LWPOLYLINE": fType(1) = 8: fData(1) = "*"<br/>&nbsp;&nbsp;&nbsp; SSet.Select acSelectionSetAll, , , fType, fData<br/>&nbsp;&nbsp;&nbsp; MsgBox SSet.Count<br/>End Sub<br/>Public Function CreateSelectionSet(Optional ssName As String = "ss") As AcadSelectionSet<br/>&nbsp;&nbsp; '返回一个空白选择集<br/>&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; Dim ss As AcadSelectionSet<br/>&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; On Error Resume Next<br/>&nbsp;&nbsp;&nbsp;&nbsp; Set ss = ThisDrawing.SelectionSets(ssName)<br/>&nbsp;&nbsp;&nbsp;&nbsp; If Err Then Set ss = ThisDrawing.SelectionSets.Add(ssName)<br/>&nbsp;&nbsp;&nbsp;&nbsp; ss.Clear<br/>&nbsp;&nbsp;&nbsp;&nbsp; Set CreateSelectionSet = ss<br/>End Function<br/>建议将fDate改为fData。</p><p>Polyline是二维多段线,通常用pline画出来的是LWPOLYLINE即轻量多段线。</p>
页: [1]
查看完整版本: [求助] 请教高手,关于把全部多段线加入选择集