检查多重引线样式
(defun c:FilletWeldBottL ()(InsertBlockExplode) ; I added this line to call the below function
(setvar "cmleaderstyle" "Fillet Weld Bott L")
(command "_mleader")
)
第一个defun在没有第二行的情况下工作得很好。我在模板图形中添加了15种多重引线样式(其中一种称为“角焊缝B-S”),因此,现在每次打开新图形时,我都有所有可用的引线样式。不幸的是,当我打开一个不是用当前模板创建的旧图形时,我没有那些多重引线样式。所以我想我会试着让Lisp来帮我,并想出了下面这个定义。我试图让lisp认识到,如果此图纸中不存在“角焊缝B-S”,则应加载“MW Leader Styles.dwg”
这不会发生。有人能帮忙吗??谢谢
(defun InsertBlockExplode ()
(if (= ("mleaderstyle" "Fillet Weld B-S") nil)
(command "_.insert" "MW Leader Styles" "0,0,0" 1 0))
) 考虑使用以下函数来测试是否在激活图形中定义了给定的多重引线样式:
(defun mleaderstyle-p ( mls / dic )
(and (setq dic (dictsearch (namedobjdict) "acad_mleaderstyle"))
(dictsearch (cdr (assoc -1 dic)) mls)
)
)
在您的代码中:
(defun InsertBlockExplode ( )
(if (not (mleaderstyle-p "Fillet Weld B-S"))
(command "_.-insert" "MW Leader Styles" nil)
)
)
(defun mleaderstyle-p ( mls / dic )
(and (setq dic (dictsearch (namedobjdict) "acad_mleaderstyle"))
(dictsearch (cdr (assoc -1 dic)) mls)
)
) 谢谢你,李,很有趣,很有帮助 不客气!
页:
[1]