- 积分
- 24557
- 明经币
- 个
- 注册时间
- 2004-3-17
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2004-12-7 19:21:00
|
显示全部楼层
Sub tt() On Error Resume Next Dim obj As AcadEntity, pnt, tm, d Dim oBigBlock As AcadBlock Dim oBlock As AcadBlock Dim ss As AcadSelectionSet Dim i As AcadEntity ThisDrawing.Utility.GetSubEntity obj, pnt, tm, d Set oBlock = ThisDrawing.ObjectIdToObject(obj.OwnerID) ThisDrawing.SelectionSets("Test").Delete Set ss = ThisDrawing.SelectionSets.Add("Test") Dim ft(0) As Integer, fd(0) ft(0) = 0: fd(0) = "Insert" ss.SelectAtPoint pnt, ft, fd Set oBigBlock = ThisDrawing.Blocks(ss(0).Name) p1 = ss(0).InsertionPoint For Each i In oBigBlock If i.Name = oBlock.Name Then p2 = i.InsertionPoint End If Next i p1(0) = p1(0) + p2(0) p1(1) = p1(1) + p2(1) p1(2) = p1(2) + p2(2) ThisDrawing.ModelSpace.InsertBlock(p1, oBlock.Name, 1, 1, 1, 0).Highlight True End Sub
没有考虑多层,三层或以上会出错,:)
块的缩放也没有考虑,自己改动一下吧
还有一种情况是如果该块包含两个同名块参照可能会错位 |
|