从图形分离外部参照 (xref)。 支持的平台:仅窗口 返回值(RetVal)无返回值。 言论分离外部参照将从当前图形中删除外部参照。外部参照的所有副本都将拭除,外部参照定义将被删除。所有与外部参照相关的符号表信息(例如图层和线型)都将从当前图形中删除。 不能分离包含其他外部参照的外部参照。 例子工 务 局: Sub Example_Detach() 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." ' Detach the external reference definition Dim name As String name = xrefInserted.name ThisDrawing.Blocks.Item(name).Detach MsgBox "The external reference is detached." Exit Sub ERRORHANDLER: MsgBox Err.Description End Sub Visual LISP: (vl-load-com) (defun c:Example_Detach() (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 (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.") ;; Detach the external reference definition (setq name (vla-get-Name xrefInserted)) (vla-Detach (vla-Item (vla-get-Blocks doc) name)) (alert "The external reference is detached.") ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:36
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.