块参照问题
Sub Example_Bind()<BR> On Error GoTo ERRORHANDLER<BR> <BR> ' Define external reference to be inserted<BR> Dim xrefHome As AcadBlock<BR> Dim xrefInserted1 As AcadExternalReference<BR> Dim xrefInserted2 As AcadExternalReference<BR> <BR> Dim insertionPnt(0 To 2) As Double<BR> Dim PathName As String<BR> <BR> insertionPnt(0) = 1<BR> insertionPnt(1) = 1<BR> insertionPnt(2) = 0<BR> PathName = "e:/lgs/ER1.dwg"<BR> <BR> ' Add the external reference<BR> Set xrefInserted1 = ThisDrawing.ModelSpace. _<BR> AttachExternalReference(PathName, "XREF_IMAGE", _<BR> insertionPnt, 1, 1, 1, 90, False)<BR> <BR> Set xrefInserted2 = ThisDrawing.ModelSpace. _<BR> AttachExternalReference(PathName, "XREF_IMAGE", _<BR> insertionPnt, 1, 1, 1, 0, False)<BR> ZoomAll<BR> MsgBox "The external reference is attached."<BR> <BR> ' Bind the external reference definition<BR> ThisDrawing.Blocks.Item(xrefInserted1.Name).Bind False<BR> 'ThisDrawing.Blocks.Item(xrefInserted2.Name).Bind False<BR> MsgBox "The external reference is bound."<BR> <BR> Exit Sub<BR>ERRORHANDLER:<BR> MsgBox Err.Description<BR>End Sub
为什么不要ThisDrawing.Blocks.Item(xrefInserted1.Name).Bind False就可以在一个CAD窗口多次运行程序?
但采用ThisDrawing.Blocks.Item(xrefInserted1.Name).Bind False却不能在同一个CAD窗口多次运行程序,是不是该CAD图块文件被独占打开,而没有关闭。有什么办法不去掉该语句并能解决这个问题吗?
先谢谢大侠!
页:
[1]