批量插入光栅图
(defun c:tt(/ )(setq i 1)
(setq ang 0)
(setq n 0)
(main)
(prin1)
)
(defun main( / pt)
(setq dcl_id (load_dialog (make-dcl)))
(new_dialog "gst" dcl_id)
(set_tile "kzkd" "100")
(setq kd(atof(get_tile"kzkd" )))
(set_tile "zjjl" "20")
(set_tile "mxgs" "10")
(setq jl(atof(get_tile"zjjl" )))
(action_tile "dkwj" "(done_dialog 1)")
(setq dd(start_dialog))
(if (= dd 1)
(progn
(find_file)
(if(not pt) (setq pt(getpoint"\n插入点")))
(setq pt: pt)
(foreach f filelist
(inpic (strcat path"\\" f)pt)
(setq las(entlast))
(setq bx(box las))
(setq wh(mapcar 'abs (mapcar '- (car bx)(cadr bx))))
(command "SCALE" las"" "non" pt (/ kd (car wh)) )
(setq i(1+ i))
(if (/= (remi 11 )1)
(setq ang 0)
(progn(setq ang (* 0.5 pi))
(setq i 1)
(setq n(1+ n))
(setq pt(polar pt: ang (* n(* 2 kd))))
)
)
(setq pt(polar pt ang (+ jl kd)))
)
)
)
)
(defun inpic (path::pta /)
(vla-AddRaster
(vla-get-modelspace(vla-get-activedocument(vlax-get-acad-object)))
path::
(vlax-3d-point pta
)
1
0
)
)
(defun box (ss0 / ptmi ptma)
(vla-getboundingbox
(vlax-ename->vla-object ss0)
'ptmi
'ptma
)
(mapcar 'vlax-safearray->list (list ptmi ptma))
)
(defun find_file ()
(setq FILE: (getfiled "选择文件夹内一个文件"
""
""
4
)
)
(setq path (vl-filename-directory FILE:)
filelist (vl-directory-files path "*.jpg")
))
(defun make-dcl(/ lst_str str file f)
(setq lst_str '(
"gst:dialog"
"{ "
" label = \"批量插入光栅图\";"
" :row"
" { "
" :button"
" { "
" key = \"dkwj\";"
" label = \"打开文件夹\";"
" width = 12.15;"
" height = 1.875;"
" fixed_height = true;"
" fixed_width = true;"
" } "
" } "
" :row"
" {"
" :text"
" {"
" "
" label = \"图片宽度\";"
" fixed_height = true;"
" fixed_width = true;"
" } "
" :edit_box"
" { "
" key = \"kzkd\";"
" width = 12.15;"
" height = 0.938;"
" fixed_height = true;"
" fixed_width = true;"
" } "
" } "
" :row"
" { "
" :text"
" { "
" "
" label = \"之间距离\";"
" fixed_height = true;"
" fixed_width = true;"
" } "
" :edit_box"
" {"
" key = \"zjjl\";"
" width = 12.15;"
" height = 0.938;"
" fixed_height = true;"
" fixed_width = true;"
" } "
" } "
" :row"
" { "
" :text"
" { "
" "
" label = \"每行个数\";"
" fixed_height = true;"
" fixed_width = true;"
" } "
" :edit_box"
" { "
" key = \"mxgs\";"
" width = 12.15;"
" height = 0.938;"
" fixed_height = true;"
" fixed_width = true;"
" }"
" }"
" ok_cancel;"
"} "
)
)
(setq file (vl-filename-mktemp "DclTemp.dcl"))
(setq f (open file "w"))
(foreach str lst_str
(princ "\n" f)
(princ str f)
)
(close f)
file
)
(princ)
本帖最后由 jun353835273 于 2023-7-26 19:02 编辑
可以加个列表框,不需的给移除
DCL搞好了,大佬们来驱动他吧
jun353835273 发表于 2023-7-26 18:19
可以加个列表框,不需的给移除
没有看到图片不知道是否移除的 谢谢楼主分享,有批量插入PDF页面的方式吗 xcmdos 发表于 2023-7-26 23:59
谢谢楼主分享,有批量插入PDF页面的方式吗
(command "._-pdfattach" PDFFile 页码 坐标比例 "0")
页码识别参考http://bbs.mjtd.com/thread-187420-1-1.html jun353835273 发表于 2023-7-27 08:18
(command "._-pdfattach" PDFFile 页码 坐标比例 "0")
页码识别参考http://bbs.mjtd.com/thread-18742 ...
不太懂代码 有整合到一起的代码吗批量插入PDF 程序不能用 大佬,程序用不了,输入的列表有缺陷ssget 列表值错误
页:
[1]