wenwengg 发表于 2010-2-8 14:19:00

[讨论]请问如何恢复块定义

图纸中有很多块参照,但却没有块定义,请问如何才能恢复这些块参照的块定义

wenwengg 发表于 2010-2-8 15:20:00

[讨论]没想到竟这么简单

<p>Sub ReSetBlockReference()<br/>'恢复块定义<br/>&nbsp;&nbsp;&nbsp; On Error Resume Next<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; Dim blockEnt As AcadBlockReference<br/>&nbsp;&nbsp;&nbsp; Dim blkName As String<br/>&nbsp;&nbsp;&nbsp; Dim getobj As Object<br/>&nbsp;&nbsp;&nbsp; Dim p As Variant<br/>&nbsp;&nbsp;&nbsp; Dim i As Integer<br/>&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp; Dim ssetObj As AcadSelectionSet<br/>&nbsp;&nbsp;&nbsp; If Not IsNull(ThisDrawing.SelectionSets.item("Example")) Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set ssetObj = ThisDrawing.SelectionSets.item("Example")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ssetObj.Delete&nbsp;<br/>&nbsp;&nbsp;&nbsp; End If<br/>&nbsp;&nbsp;&nbsp; Set ssetObj = ThisDrawing.SelectionSets.Add("Example")<br/>&nbsp;&nbsp;&nbsp; ThisDrawing.Utility.InitializeUserInput 0,&nbsp;<br/>&nbsp;&nbsp;&nbsp; ssetObj.SelectOnScreen</p><p>&nbsp;&nbsp;&nbsp; For i = 0 To ssetObj.count - 1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set blockEnt = ssetObj(i)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; blockEnt.Name = blockEnt.Name<br/>&nbsp;&nbsp;&nbsp; Next<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ssetObj.Delete&nbsp;</p><p>End Sub</p>
页: [1]
查看完整版本: [讨论]请问如何恢复块定义