指定光栅图像文件的完整路径和文件名。 支持的平台:仅窗口 属性值只读:不 类型:字符串 光栅图像文件的完整路径和文件名。 言论此属性类似于属性,不同之处在于此属性包含路径信息,而属性不包含。NameName 可以使用此属性将新的光栅图像加载到现有光栅对象中。 例子工 务 局: Sub Example_ImageFile()
' This example inserts a raster image and then finds the
' ImageFile for the image.
' This example uses the "2d Projected Polylines.jpg" found in the Sample
' directory. If you do not have the image, or if it is located
' in a different directory, insert a valid path and name for the
' imageName variable below.
Dim insertionPoint(0 To 2) As Double
Dim scalefactor As Double
Dim rotAngleInDegree As Double, rotAngle As Double
Dim imageName As String
Dim raster As AcadRasterImage
imageName = "C:\AutoCAD\sample\2d Projected Polylines.jpg"
insertionPoint(0) = 2#: insertionPoint(1) = 2#: insertionPoint(2) = 0#
scalefactor = 1#
rotAngleInDegree = 0#
rotAngle = rotAngleInDegree * 3.141592 / 180#
On Error Resume Next
' Creates a raster image in model space
Set raster = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotAngle)
If Err.Description = "File error" Then
MsgBox imageName & " could not be found."
Exit Sub
End If
' Find the current ImageFile
ThisDrawing.Regen True
MsgBox "The ImageFile is currently set to: " & raster.ImageFile, vbInformation
End Sub
Visual LISP: (vl-load-com)
(defun c:Example_ImageFile()
;; This example inserts a raster image and then finds the
;; ImageFile for the image.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; This example uses the "2d Projected Polylines.jpg" found in the Sample
;; directory. If you do not have the image, or if it is located
;; in a different directory, insert a valid path and name for the
;; imageName variable below.
(setq insertionPoint (vlax-3d-point 5 5 0)
imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
scalefactor 1
rotAngle (/ (* 0 3.141592) 180))
;; Creates a raster image in model space
(if (/= (findfile imageName) nil)
(progn
(setq modelSpace (vla-get-ModelSpace doc))
(setq raster (vla-AddRaster modelSpace (findfile imageName) insertionPoint scalefactor rotAngle))
(vla-ZoomExtents acadObj)
)
(alert (strcat imageName " could not be found."))
)
;; Find the current ImageFile
(vla-Regen doc :vlax-true)
(alert (strcat "The ImageFile is currently set to: " (vla-get-ImageFile raster)))
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-27 10:11
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.