如何多选不同扩展属性的实体
<p> Dim ssetObj As AcadSelectionSet <br/> Dim mode As Integer<br/> Dim gpCode(0) As Integer<br/> Dim dataValue(0) As Variant<br/> Dim groupCode As Variant<br/> Dim dataCode As Variant<br/> Dim obj As AcadLWPolyline<br/> <br/> On Error Resume Next<br/> If Not IsNull(ThisDrawing.SelectionSets("SSET")) Then<br/> Set ssetObj = ThisDrawing.SelectionSets("SSET")<br/> ssetObj.Delete<br/> End If<br/> Set ssetObj = ThisDrawing.SelectionSets.Add("SSET")<br/> <br/> mode = acSelectionSetAll<br/> gpCode(0) = 1000<br/> groupCode = gpCode<br/> dataValue(0) = "600601"<br/> dataCode = dataValue<br/> ssetObj.Select mode, , , groupCode, dataCode<br/> If ssetObj.Count <> 0 Then<br/> For Each obj In ssetObj<br/> obj.color=acRed<br/> obj.Update<br/> Next<br/> End If<br/>我还有一个扩展属性是600602,即 dataValue(0) = "600602"。如何同时进行选择修改,使600602颜色为其他颜色?</p> 对扩展属性作过滤选择只能通过应用程序名过滤,而不能通过具体属性值过滤选择! 本帖最后由 作者 于 2008-2-26 15:01:19 编辑 <br /><br /> <p>Sub b()<br/> Dim ssetObj As AcadSelectionSet<br/> Dim Pkobj As AcadEntity<br/> <br/> Dim i As Integer<br/> <br/> Dim mode As Integer<br/> Dim xType(0) As Integer<br/> Dim xData(1) As Variant<br/> <br/> Dim xTypeCode As Variant<br/> Dim xDataCode As Variant<br/> <br/> Dim dataValue(0) As Variant<br/> <br/> Dim obj As AcadLWPolyline<br/> <br/> Dim ObjCode As String</p><p> On Error Resume Next<br/> If Not IsNull(ThisDrawing.SelectionSets("SSET")) Then<br/> Set ssetObj = ThisDrawing.SelectionSets("SSET")<br/> ssetObj.Delete<br/> End If<br/> Set ssetObj = ThisDrawing.SelectionSets.Add("SSET")<br/> <br/> <br/> mode = acSelectionSetAll<br/> xType(0) = 1000<br/> xData(0) = "600601"<br/> xData(1) = "600602"<br/> <br/> On Error Resume Next<br/> For i = 0 To 1<br/> xTypeCode = xType<br/> <br/> dataValue(0) = xData(i)<br/> xDataCode = dataValue<br/> <br/> ssetObj.Select mode, , , xTypeCode, xDataCode<br/> <br/> For Each Pkobj In ssetObj<br/> <br/> ObjCode = xData(i)<br/> <br/> Set obj = Pkobj</p><p> If ssetObj.Count =0 Then<br/> exit sub<br/> else <br/> Select Case ObjCode<br/> Case "600601"</p><p> obj.ConstantWidth = 1</p><p> Case "600602"</p><p> obj.ConstantWidth = 0.5</p><p> End Select<br/> End If<br/> obj.Update<br/> <br/> Next<br/> <br/> Next<br/> <br/> MsgBox "结束!", vbInformation, "提示"<br/> <br/> End If<br/> <br/>End Sub<br/></p><p>版主,上面的程序我进行了修改,可是最终运行后的结果是两种实体的ConstantWidth都是0.5,在执行了第一个循环后继续执行第二个循环,然后就会将第一个的运算值变成由第二个值来赋予。如何在执行第一个case循环后再执行第二个case的时候不执行第一个case啊?即第一个的600601的扩展属性的实体的ConstantWidth不会再变化呢?</p> <p>你这样作选择集是不能得到预期的结果的:</p><p>ssetObj.Select mode, , , xTypeCode, xDataCode</p><p>对于扩展属性只能通过应用程序名作选择集!!</p> <p>对于扩展属性只能通过应用程序名作选择集这句话我不理解。不过,我已经弄好啦,还是谢谢版主。</p> <p>除<font color="#cc5233">优化多段线</font>外,扩展属性只能用1001码过滤</p>
页:
[1]