关于AUTOCAD选择集问题
胖子不是我 2019-02-21 01:32:39 为什么只能运行到修改“电杆”图层,下个图层就不行并且报错
Sub test()
Dim sSet As AcadSelectionSet, Pnt As AcadPoint, blk As AcadBlockReference, Ent As AcadEntity
' On Error Resume Next
Set sSet = ThisDrawing.SelectionSets.Add("TEST")
sSet.Clear
sSet.SelectOnScreen
For Each Ent In sSet
Select Case Ent.Layer
Case "电杆"
Set Pnt = Ent
Set blk = ThisDrawing.Application.ActiveDocument.ModelSpace.InsertBlock(Pnt.Coordinates, "gc170", 1, 1, 1, 0)
blk.Layer = "GXYZ"
Case "路灯"
Set Pnt = Ent
Set blk = ThisDrawing.Application.ActiveDocument.ModelSpace.InsertBlock(Pnt.Coordinates, "097", 1, 1, 1, 0)
blk.Layer = "DLDW"
Case Else
End Select
Next
sSet.Delete
' MsgBox "OK"
End Sub