torch 发表于 2004-7-23 10:56:00

帮我看看这段代码

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