gaoping561 发表于 2005-7-12 20:05:00

[VBA]怎么样一次全选连续绘制的直线?

连续绘制的直线(非多段线),怎样才能点击其中任何一根线而全部被选中。主要目的是把电气电缆原理图的上的同一根电缆导通,并且用特殊颜色显示,各位有何建议??

雪山飞狐_lzh 发表于 2005-7-12 20:41:00

<P>用下面的方法可以选择端点在已知点的直线,剩下的问题应该不难了吧</P>
<P>Sub tt()<BR>&nbsp;&nbsp;&nbsp; Dim ss As AcadSelectionSet<BR>&nbsp;&nbsp;&nbsp; Set ss = GetSel<BR>&nbsp;&nbsp;&nbsp; Dim ft(4) As Integer, fd(4)<BR>&nbsp;&nbsp;&nbsp; ft(0) = 0: fd(0) = "Line"<BR>&nbsp;&nbsp;&nbsp; ft(1) = -4: fd(1) = "&lt;or"<BR>&nbsp;&nbsp;&nbsp; ft(2) = 10: fd(2) = CreatePoint(0, 0, 0)<BR>&nbsp;&nbsp;&nbsp; ft(3) = 11: fd(3) = CreatePoint(0, 0, 0)<BR>&nbsp;&nbsp;&nbsp; ft(4) = -4: fd(4) = "or&gt;"<BR>&nbsp;&nbsp;&nbsp; ss.Select acSelectionSetAll, , , ft, fd<BR>&nbsp;&nbsp;&nbsp; MsgBox ss.Count<BR>End Sub</P>
<P>Function GetSel(Optional ByVal Name As String = "TlsTest") As AcadSelectionSet<BR>On Error Resume Next<BR>&nbsp;&nbsp;&nbsp; ThisDrawing.SelectionSets(Name).Delete<BR>&nbsp;&nbsp;&nbsp; Set GetSel = ThisDrawing.SelectionSets.Add(Name)<BR>End Function</P>
<P>Function CreatePoint(Optional ByVal X As Double = 0#, Optional ByVal Y As Double = 0#, Optional ByVal Z As Double = 0#)<BR>&nbsp;&nbsp;&nbsp; Dim pnt(2) As Double<BR>&nbsp;&nbsp;&nbsp; pnt(0) = X: pnt(1) = Y: pnt(2) = Z<BR>&nbsp;&nbsp;&nbsp; CreatePoint = pnt<BR>End Function<BR></P>

gaoping561 发表于 2005-7-18 11:08:00

good ,thank youvery much
页: [1]
查看完整版本: [VBA]怎么样一次全选连续绘制的直线?