将外部参照 (xref) 绑定到图形。 支持的平台:仅窗口 签名工 务 局: object.Bind bPrefixName
返回值(RetVal)无返回值。 言论将外部参照绑定到图形会使外部参照成为图形的永久部分,而不再是外部参照文件。外部引用的信息将变为块。更新外部参照图形时,绑定外部参照不会更新。此方法绑定整个图形的数据库,包括其所有从属符号。依赖符号是命名对象,例如块、标注样式、图层、线型和文本样式。绑定外部参照允许在当前图形中使用外部参照中的命名对象。 如果bPrefixName参数设置为 ,则外部参照图形的符号名称在当前图形中以 <blockname>$x$ 为前缀,其中 x 是自动递增以避免覆盖现有块定义的整数。如果将bPrefixName参数设置为 ,则外部参照图形的符号名称将合并到不带前缀的当前图形中。如果存在重复的名称,AutoCAD 将使用本地图形中已定义的符号。如果不确定图形是否包含重复的符号名称,建议将bPrefixName设置为 。FalseTrueFalse 例子工 务 局: Sub Example_Bind()
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."
' Bind the external reference definition
ThisDrawing.Blocks.Item(xrefInserted.name).Bind False
MsgBox "The external reference is bound."
Exit Sub
ERRORHANDLER:
MsgBox Err.Description
End Sub
Visual LISP: (vl-load-com)
(defun c:Example_Bind()
(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.")
;; Bind the external reference definition
(vla-Bind (vla-Item (vla-get-Blocks doc) (vla-get-Name xrefInserted)) :vlax-false)
(alert "The external reference is bound.")
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 14:57
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.