找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1624|回复: 3

[每日一码] VLISP中插入图像的代码

[复制链接]

已领礼包: 40个

财富等级: 招财进宝

发表于 2016-5-23 22:43:51 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
问题:
在AUTOCAD中如何用VLISP快速的插入图像?

解决方案:

Using Visual LISP, you can use the ActiveX Object model of AutoCAD. The
AcadModelSpace object has the method AddImage that makes it very easy to create
a new raster image entity.

The following code creates an image entity:


;; Insert a raster image using the
;; ActiveX inte**ce of AutoCAD
(defun c:insertimage ()
  (vl-load-com)
;; Get objects
(setq acadApp (vlax-get-acad-object)
    acadDoc (vla-get-ActiveDocument acadApp)
    mSpace    (vla-get-ModelSpace acadDoc)
)

;; Get some parameters for the new image
(setq name "c:/winnt/winnt256.bmp"
    pt (getpoint "\nSelect insert point: ")
    scale (getreal "\nEnter scale factor: ")
    rot   (getangle "\nEnter rotation angle: ")
)

;; Create a new raster image entity
(setq image-obj (vla-AddRaster mSpace name (vlax-3d-point pt) scale rot))
(setq image-ename (vlax-vla-object->ename image-obj))

;; image-obj is the newly created image entity ActiveX object.
;; image-ename contains the Lisp entity name of the new image.
;;
;; You can use further ActiveX methods/properties on image-obj
;; and the 'standard' Lisp functions on image-ename.

(princ "\nNew raster image entity:\n")
(princ (entget image-ename))

(princ)
)


论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 14个

财富等级: 恭喜发财

发表于 2016-5-24 11:47:37 | 显示全部楼层
一般都是用XR 学习下
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 1094个

财富等级: 财源广进

发表于 2021-8-28 07:50:51 | 显示全部楼层
感谢分享VLISP中插入图像的代码
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-5-11 11:40 , Processed in 0.373698 second(s), 35 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表