外部参照を図面にアタッチします。
サポートされているプラットフォーム: Windows のみ
VBA:
RetVal = object.AttachExternalReference(PathName, Name, InsertionPoint, XScale, YScale, ZScale, Rotation, Overlay [, Password])
タイプ: Block、ModelSpace、PaperSpace
このメソッドが適用されるオブジェクト。
アクセス: 入力のみ
タイプ: 文字列
参照される図面の絶対パスとファイル名。
アクセス: 入力のみ
タイプ: 文字列
作成される外部参照の名前。
アクセス: 入力のみ
タイプ: バリアント型(3 要素の倍精度浮動小数点数型配列)
図面内の ExternalReference インスタンスを挿入する点を指定する 3D WCS 座標。現在の図面内の挿入点は、参照ファイル内の AutoCAD システム変数 BASE により定義される点に位置合わせされます。
アクセス: 入力のみ
タイプ: 倍精度浮動小数点数型
外部参照インスタンスの X 方向の尺度。
アクセス: 入力のみ
タイプ: 倍精度浮動小数点数型
外部参照インスタンスの Y 方向の尺度。
アクセス: 入力のみ
タイプ: 倍精度浮動小数点数型
外部参照インスタンスの Z 方向の尺度。
アクセス: 入力のみ
タイプ: 倍精度浮動小数点数型
外部参照インスタンスの回転角度。この角度はラジアンで指定されます。
アクセス: 入力のみ
タイプ: ブール型
アクセス: 入力のみ; オプション
タイプ: バリアント型
; オプション
Block オブジェクトのように、アタッチされた ExternalReference オブジェクトはネストすることができます。別の人が、参照する図面を編集している場合、アタッチされた図面は最後に保存されたバージョンに基づいています。
参照ファイルが無かったり壊れている場合、データは現在の図面に表示されません。
VBA:
Sub Example_AttachExternalReference()
' This example displays all the blocks in the current drawing
' before and after adding an external reference.
'
' This example uses the "city map.dwg" found in the Sample
' directory. If you do not have this drawing, or if it is
' in a different directory, insert a valid path and file name
' for the PathName variable below.
Dim InsertPoint(0 To 2) As Double
Dim insertedBlock As AcadExternalReference
Dim tempBlock As AcadBlock
Dim msg As String, PathName As String
' Define external reference to be inserted
InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
PathName = "c:\program files\autocad\sample\city map.dwg"
' Display current Block information for this drawing
GoSub ListBlocks
' Add the external reference to the drawing
Set insertedBlock = ThisDrawing.ModelSpace.AttachExternalReference(PathName, "XREF_IMAGE", InsertPoint, 1, 1, 1, 0, False)
ThisDrawing.Application.ZoomAll
' Display new Block information for this drawing
GoSub ListBlocks
Exit Sub
ListBlocks:
msg = vbCrLf ' Reset message
For Each tempBlock In ThisDrawing.Blocks
msg = msg & tempBlock.name & vbCrLf ' Add Block to list
Next
MsgBox "The current blocks in this drawing are: " & msg
Return
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_AttachExternalReference()
;; This example displays all the blocks in the current drawing
;; before and after adding an external reference.
;;
;; This example uses the "STAIR1.dwg" found in the Sample
;; directory. If you do not have this drawing, or if it is
;; in a different directory, insert a valid path and file name
;; for the PathName variable below.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Define external reference to be inserted
(setq InsertPoint (vlax-3d-point 1 1 0))
(setq pathName (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\STAIR1.dwg"))
;; Display current Block information for this drawing
(setq msg "")
(vlax-for tempBlock (vla-get-Blocks doc)
(setq msg (strcat msg (vla-get-Name tempBlock) "\n")) ;; Add Block to list
)
(alert (strcat "The current blocks in this drawing are: " msg))
;; Add the external reference to the drawing
(setq modelSpace (vla-get-ModelSpace doc))
(setq insertedBlock (vla-AttachExternalReference modelSpace pathName "XREF_IMAGE" InsertPoint 1 1 1 0 :vlax-false))
(vla-ZoomAll acadObj)
;; Display new Block information for this drawing
(setq msg "")
(vlax-for tempBlock (vla-get-Blocks doc)
(setq msg (strcat msg (vla-get-Name tempBlock) "\n")) ;; Add Block to list
)
(alert (strcat "The current blocks in this drawing are: " msg))
)