Unload 方法 (ActiveX)
卸载菜单组或外部参照。 支持的平台:仅限 Windows 返回值 (RetVal)无返回值。 言论ExternalReference:从图形中卸载对象 (xref) 时,图形打开速度更快,占用的内存更少。未加载的外部参照不显示,并且与外部参照相关的符号表信息不会出现在绘图中。但是,可以通过使用该方法重新加载外部参照来恢复所有信息。ExternalReferenceReload 要卸载外部参照,必须卸载定义外部参照的模块。例如,以下 VBA 代码行卸载存储在变量中的外部引用:xrefInserted ThisDrawing.Blocks.Item(xrefInserted.name).Unload MenuGroup:从图形中卸载菜单组时,对该组内菜单和工具栏的任何引用都将失效。在卸载菜单组之前,请始终删除或设置对要卸载的菜单组中的工具栏和菜单的任何引用。NULL 例子VBA: Sub Example_Unload() On Error GoTo ERRORHANDLER ' Define external reference to be inserted Dim xrefHome As AcadBlock Dim xrefInserted As AcadExternalReference Dim insertionPnt(0 To 2) As Double Dim PathName As String insertionPnt(0) = 1 insertionPnt(1) = 1 insertionPnt(2) = 0 PathName = "c:/AutoCAD/sample/City map.dwg" ' Add the external reference Set xrefInserted = ThisDrawing.ModelSpace. _ AttachExternalReference(PathName, "XREF_IMAGE", _ insertionPnt, 1, 1, 1, 0, False) ZoomAll MsgBox "The external reference is attached." ' Unload the external reference definition ThisDrawing.Blocks.Item(xrefInserted.name).Unload MsgBox "The external reference is unloaded." Exit Sub ERRORHANDLER: MsgBox Err.Description End Sub 可视化 LISP: (vl-load-com) (defun c:Example_Unload() (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Define external reference to be inserted (setq insertionPnt (vlax-3d-point 1 1 0) pathName (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\STAIR1.dwg")) ;; Add the external reference to the block (setq modelSpace (vla-get-ModelSpace doc)) (setq xrefInserted (vla-AttachExternalReference modelSpace pathName "XREF_IMAGE" insertionPnt 1 1 1 0 :vlax-false)) (vla-ZoomAll acadObj) (alert "The external reference is attached.") ;; Unload the external reference definition (vla-Unload (vla-Item (vla-get-Blocks doc) "XREF_IMAGE")) (vla-Regen doc :vlax-true) (alert "The external reference is unloaded.") ;; Reload the external reference definition (vla-Reload (vla-Item (vla-get-Blocks doc) "XREF_IMAGE")) (alert "The external reference is reloaded.") ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2024-12-15 11:38
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.