CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

关于卸载外部参照 (VBA/ActiveX)

2023-1-4 19:27| 发布者: admin| 查看: 527| 评论: 0|来自: AutoCAD

摘要: 要卸载外部参照,请使用卸载方法。

要卸载外部参照,请使用该方法。Unload

卸载当前图形中未使用的参照文件时,AutoCAD 性能将得到增强,因为不必读取和显示不必要的图形几何图形或符号表信息。在重新加载外部参照之前,外部参照几何图形和任何嵌套外部参照的外部参照几何图形都不会显示在当前图形中。

卸载外部参照定义

本示例附加一个外部引用,然后卸载该外部引用。此示例使用示例目录中的3D House.dwg文件。如果没有此映像,或者它位于其他目录中,请为变量插入有效的路径和文件名。PathName

Sub Ch10_UnloadingExternalReference()
 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:/Program Files/Autodesk/AutoCAD release/3D House.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

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-12 14:52

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部