明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1691|回复: 6

求助!怎样将某个图层的所有图形放到一个选择集中?

[复制链接]
发表于 2005-10-18 09:27:00 | 显示全部楼层 |阅读模式
本帖最后由 作者 于 2005-10-18 10:02:50 编辑

求助!怎样将某个图层的所有图形放到一个选择集中?lisp    vba都要,万分感谢!

要实现这样的功能:将某图层的所有图形历篇,将每一类完全一样的图形COPY到工作区的另一个地方,之后还要对COPY出来的图形进行编辑,可以吗?万分感谢!!

发表于 2005-10-18 21:15:00 | 显示全部楼层

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

Sub t()
Dim ss As AcadSelectionSet
Set ss = GetSel()

Dim ft(0) As Integer, fd(0)
LayerName = "0"
ft(0) = 8: fd(0) = LayerName

ss.Select acSelectionSetAll, , , ft, fd

End Sub

 

 楼主| 发表于 2005-10-19 12:46:00 | 显示全部楼层

谢谢版主!我回家试一下!

 楼主| 发表于 2005-10-23 14:51:00 | 显示全部楼层

Function GetSel(Optional Name = "TLSSEL") As AcadSelectionSet
On Error Resume Next
    ThisDrawing.SelectionSets(Name).Delete
    Set GetSel = ThisDrawing.SelectionSets.Add(Name)
End Function
Sub jh()
Dim p1(0 To 2) As Double
Dim ss As AcadSelectionSet
Set ss = GetSel()
'ss.SelectOnScreen
'For j = 0 To ss.Count - 1
   ' ms = ss.Item(j).ObjectID & Chr(10) + ms
'Next
'MsgBox ms

Dim ft(0) As Integer, fd(0)
LayerName = "c1"
ft(0) = 8: fd(0) = LayerName
ss.Select acSelectionSetAll, , , ft, fd
    For i = 0 To ss.Count - 1
    If i > ss.Count - 1 Then GoTo pp:
    gs = 0
    MsgBox ss.Item(i).ObjectName & Chr(10) & ss.Item(i).ObjectID & Chr(10) & i
    ss.Item(i).GetBoundingBox mind, maxd
    a = maxd(0) - mind(0)
    b = maxd(1) - mind(1)
        For k = 1 To ss.Count - 1
            If k > ss.Count - 1 Then GoTo kk:
            ss.Item(k).GetBoundingBox mindt, maxdt
            at = maxdt(0) - mindt(0)
            bt = maxdt(1) - mindt(1)
            If at = a And bt = b And ss.Item(k).ObjectID <> ss.Item(i).ObjectID Then
            'MsgBox ss.Item(k).ObjectID & Chr(10) & k
            ss.Item(k).Delete
            gs = gs + 1
            Set ss = GetSel()
            LayerName = "c1"
            ft(0) = 8: fd(0) = LayerName
            ss.Select acSelectionSetAll, , , ft, fd
            k = k - 1
            End If
        Next
kk: Dim sm As AcadMText
    pb = ThisDrawing.Utility.GetPoint(, "选择基点:" & Chr(10))
    ss.Item(i).Move mind, pb
    ss.Item(i).GetBoundingBox minda, maxda
    p1(0) = minda(O): p1(1) = minda(1) - 5: p1(2) = minda(2)
    w = a / 5
    Set sm = ThisDrawing.ModelSpace.AddMText(p1, w, gs + 1)
    sm.Layer = "t1"
Next
pp:

End Sub

不行呀!救救呀!

发表于 2005-11-10 20:11:00 | 显示全部楼层
请问怎样选择整个图层内的所有对象呢?
发表于 2005-11-10 20:14:00 | 显示全部楼层

还有版主的代码有点看不懂:

   ThisDrawing.SelectionSets(Name).Delete
    Set GetSel = ThisDrawing.SelectionSets.Add(Name)
为什么要删除后添加呢

发表于 2005-11-10 22:06:00 | 显示全部楼层

你在For循环里为什么要改变ss的值?

你要达到什么效果?

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-27 08:48 , Processed in 0.183853 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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