明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1942|回复: 2

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

[复制链接]
发表于 2005-7-12 20:05:00 | 显示全部楼层 |阅读模式
连续绘制的直线(非多段线),怎样才能点击其中任何一根线而全部被选中。主要目的是把电气电缆原理图的上的同一根电缆导通,并且用特殊颜色显示,各位有何建议??
发表于 2005-7-12 20:41:00 | 显示全部楼层

用下面的方法可以选择端点在已知点的直线,剩下的问题应该不难了吧

Sub tt()
    Dim ss As AcadSelectionSet
    Set ss = GetSel
    Dim ft(4) As Integer, fd(4)
    ft(0) = 0: fd(0) = "Line"
    ft(1) = -4: fd(1) = "<or"
    ft(2) = 10: fd(2) = CreatePoint(0, 0, 0)
    ft(3) = 11: fd(3) = CreatePoint(0, 0, 0)
    ft(4) = -4: fd(4) = "or>"
    ss.Select acSelectionSetAll, , , ft, fd
    MsgBox ss.Count
End Sub

Function GetSel(Optional ByVal Name As String = "TlsTest") As AcadSelectionSet
On Error Resume Next
    ThisDrawing.SelectionSets(Name).Delete
    Set GetSel = ThisDrawing.SelectionSets.Add(Name)
End Function

Function CreatePoint(Optional ByVal X As Double = 0#, Optional ByVal Y As Double = 0#, Optional ByVal Z As Double = 0#)
    Dim pnt(2) As Double
    pnt(0) = X: pnt(1) = Y: pnt(2) = Z
    CreatePoint = pnt
End Function

 楼主| 发表于 2005-7-18 11:08:00 | 显示全部楼层
good ,thank you  very much
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-27 12:48 , Processed in 0.173985 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表