ファイルから図面または保存された画層設定のグループを読み込みます。
サポートされているプラットフォーム: Windows のみ
VBA:
RetVal = object.Import(FileName, InsertionPoint, ScaleFactor)
タイプ: Document
このメソッドが適用されるオブジェクト。
アクセス: 入力のみ
タイプ: 文字列
読み込まれるファイルの名前。
アクセス: 入力のみ
タイプ: バリアント型(3 要素の倍精度浮動小数点数型配列)
読み込まれたファイルが配置される現在の図面内の 3D WCS 座標位置。
アクセス: 入力のみ
タイプ: 倍精度浮動小数点数型
読み込まれたファイルの配置に使用される尺度。
VBA:
object.Import FileName
タイプ: LayerStateManager
このメソッドが適用されるオブジェクト。
アクセス: 入力のみ
タイプ: 文字列
画層設定の読み込み元のファイルの名前。
タイプ: Object
WMF ファイルを読み込む場合は、BlockReference オブジェクトが返されます。その他の場合はすべて、戻り値は NULL です。
戻り値はありません。
追加の注意はありません。
VBA:
Sub Example_Import()
' This example will create a new drawing. Be sure to save
' your work and start a new drawing before running this example.
' This example creates a circle. It then exports the drawing
' to a file called DXFExport.DXF. It then opens a new drawing
' and imports the file.
' Create the circle for visual representation
Dim circleObj As AcadCircle
Dim centerPt(0 To 2) As Double
Dim radius As Double
centerPt(0) = 2: centerPt(1) = 2: centerPt(2) = 0
radius = 1
Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)
ZoomAll
' Create an empty selection set
Dim sset As AcadSelectionSet
Set sset = ThisDrawing.SelectionSets.Add("TEST")
' Export the current drawing to the file specified above.
Dim exportFile As String
exportFile = "C:\AutoCAD\DXFExport" ' Adjust path for your system
ThisDrawing.Export exportFile, "DXF", sset
' Open a new drawing
Dim Acad As AcadApplication
Dim newdoc As AcadDocument
Set Acad = ThisDrawing.Application
Set newdoc = Acad.Documents.Add("acad.dwt")
' Define the import
Dim importFile As String
Dim InsertPoint(0 To 2) As Double
Dim scalefactor As Double
importFile = "C:\AutoCAD\DXFExport.dxf" ' Adjust path for your system
InsertPoint(0) = 0#: InsertPoint(1) = 0#: InsertPoint(2) = 0#
scalefactor = 2#
' Import the file
ThisDrawing.Import importFile, InsertPoint, scalefactor
ZoomAll
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_Import()
;; This example will create a new drawing. Be sure to save
;; your work and start a new drawing before running this example.
;; This example creates a circle. It then exports the drawing
;; to a file called DXFExport.DXF. It then opens a new drawing
;; and imports the file.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Create the circle for visual representation
(setq centerPt (vlax-3d-point 2 2 0))
(setq radius 1)
(setq modelSpace (vla-get-ModelSpace doc))
(setq circleObj (vla-AddCircle modelSpace centerPt radius))
(vla-ZoomAll acadObj)
;; Create an empty selection set
(setq sset (vla-Add (vla-get-SelectionSets doc) "TEST"))
;; Export the current drawing to the file specified above.
(setq exportFile "C:\\AutoCAD\\DXFExport") ;; Adjust path for your system
(vla-Export doc exportFile "DXF" sset)
;; Define the import
(setq insertPoint (vlax-3d-point 0 0 0))
(setq importFile "C:\\AutoCAD\\DXFExport.dxf" ;; Adjust path for your system
scalefactor 2)
;; Import the file
(vla-Import doc importFile insertPoint scalefactor)
(vla-ZoomAll acadObj)
(vla-Delete sset)
)