明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 916|回复: 2

[讨论] 加载影像图插件,求大神给加一条批量打开的代码。

[复制链接]
发表于 2016-5-10 17:45 | 显示全部楼层 |阅读模式
(defun c:insg()
  
  (VL-LOAD-COM)

  (setq AcadObject(vlax-get-acad-object)

        AcadDocument(vla-get-ActiveDocument Acadobject)

        mSpace(vla-get-ModelSpace Acaddocument)
  )

  (setq imageName (getfiled "指定政区数据文件" "*.*" "jpg;tif" 2))

;;; 读取并计算tfw文件参数

  (setq tfwname (strcat (substr imageName 1 (- (strlen imageName) 3)) "tfw"))
   
  (setq fp (open tfwname "r"))  
  (setq reco (read-line fp) ii 1)
  (setq chat nil)                  
  (while reco
     (setq chat (append (list reco) chat))             
     (setq reco (read-line fp) ii (1+ ii))                     
   )  ;end while
  (close fp)

  (setq pt (list (atof (nth 1 chat)) (atof (nth 0 chat)) 0))
  (setq bl (atof (nth 5 chat)))

  (setq insertionPnt(vlax-make-safearray vlax-vbDouble '(0 . 2)))

  (vlax-safearray-fill insertionPnt pt )

;;; 在模型空间中建立一个光栅图像

  (setq RasterObj(vla-AddRaster mSpace imageName insertionPnt 1 0))

  (setq width (vla-get-Width RasterObj))
  (setq height (vla-get-height RasterObj))

  (vla-put-ImageWidth RasterObj (* width bl))
  (vla-put-Imageheight RasterObj (* height bl))
  (command "move" (entlast) "" (list 0 (* height bl)) (list 0 0))

  (command "zoom" "e" "zoom" "0.8x")

)

     
              
发表于 2016-9-24 23:36 | 显示全部楼层
不建议批量加载,因为影像文件一般都很大,如果批量加载可能会导致CAD崩溃。
发表于 2019-4-23 01:20 | 显示全部楼层
qq群114378090有fas的批量插入影像的插件.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-4-27 07:19 , Processed in 0.268274 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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