求:若不存在,则插入图块,若存在则忽略代码
如题,若图纸中存在,XYZ图块的话,则忽略,若还没有,则插入他。求段代码。。。。
tblsearch 使用tblobjname或tbjsearch检索块是否存在。 我这么作成功了,
(if (null (ssget "x" (list (cons 0 "insert")(cons 2 "dimblk"))))
(progn
(setq pt1 (nth 1(grread 5)))
(command "insert" "dm-blk" pt1 "" "" "")
(command "erase" "l" "")
(command "dim" "dimblk" "dimblk" "exit"))
)
(while (setq d (tblnext "block" (null d)))
(setq lst (cons (cdr (assoc 2 d)) lst))
)
(if (and (not (member "XYZ" lst)) (setq a (findfile "xyz.dwg")))
(command "insert" a '(0 0) "" "" "")
)
页:
[1]