如何选择块中的块,并让其高亮?
我遇到一个难题,如何选择块中的块,并让其高亮?并且不能采用炸开块的方法。
请高手指点 只能获得块中块的子实体,块中的块没办法获得,高亮显示好像也不好办
Sub tt()<BR>Dim obj As Object<BR>ThisDrawing.Utility.GetSubEntity obj, pnt, tr, c<BR>MsgBox obj.ObjectName
End Sub<BR> 那就难办了,程序编不下去了。 <b>把块中的块COPY出来再让其高亮即可!</b>
<BR> Sub tt()<BR>On Error Resume Next<BR> Dim obj As AcadEntity, pnt, tm, d<BR> <BR> Dim oBigBlock As AcadBlock<BR> Dim oBlock As AcadBlock<BR> Dim ss As AcadSelectionSet<BR> Dim i As AcadEntity<BR> <BR> ThisDrawing.Utility.GetSubEntity obj, pnt, tm, d<BR> Set oBlock = ThisDrawing.ObjectIdToObject(obj.OwnerID)<BR> <BR> ThisDrawing.SelectionSets("Test").Delete<BR> Set ss = ThisDrawing.SelectionSets.Add("Test")<BR> Dim ft(0) As Integer, fd(0)<BR> ft(0) = 0: fd(0) = "Insert"<BR> ss.SelectAtPoint pnt, ft, fd<BR> Set oBigBlock = ThisDrawing.Blocks(ss(0).Name)<BR> p1 = ss(0).InsertionPoint<BR> For Each i In oBigBlock<BR> <BR> If i.Name = oBlock.Name Then<BR> p2 = i.InsertionPoint<BR> End If<BR> <BR> Next i<BR> p1(0) = p1(0) + p2(0)<BR> p1(1) = p1(1) + p2(1)<BR> p1(2) = p1(2) + p2(2)<BR> ThisDrawing.ModelSpace.InsertBlock(p1, oBlock.Name, 1, 1, 1, 0).Highlight True<BR> <BR>End Sub<BR>
没有考虑多层,三层或以上会出错,:)
块的缩放也没有考虑,自己改动一下吧
还有一种情况是如果该块包含两个同名块参照可能会错位
页:
[1]