朋友们请进,求助 标注归层
请教,LSP,效果:输入命令后,所有标注改到"标注"层(如图纸中无"标注"层,则创建“标注"层)
PS:“标注"层名为固定值,无需输入确认 感谢明经,感谢原作者,感谢原作者,谢谢,我只是转了
;;;这样在没有DIM图层的情况下自动加一个
;;;提取所有标注,最好顺便自动将过滤出来的标注转换到dim层
(defun c:ttd(/ ss)
(command "layer" "M" "DIM" "C" "3" "" "LT" "CONTINUOUS" "" "");设置一个标注图层
(princ "\n框选标注归到DIM层")
(setq ss (ssget ":s" '((0 . "DIMENSION"))))
(command "_.chprop" ss "" "LA" "DIM" "")
(gc)
)
(defun c:ttc(/ ss)
(command "layer" "M" "DIM" "C" "4" "" "LT" "CONTINUOUS" "" "");设置一个标注图层
(princ "\n标注全部归到DIM层")
(setq ss (ssget "X" '((0 . "DIMENSION"))))
(command "_.chprop" ss "" "LA" "DIM" "")
(gc)
)
;;;一个手选,一个自动选全图,随便用吧 成仔 发表于 2012-10-13 16:12
(defun c:tt ()
(if (= (tblsearch "Layer" "DIM") nil)
(command "Layer" "new" "DIM" "color" "4 ...
如何自由选择不是强行全部归层呢 谢谢楼主分享 就没个悬赏? 这太TM简单了,你学一点LISP,就会编一个 这太TM简单了,你学一点LISP,就会编一个 本帖最后由 成仔 于 2012-10-15 20:11 编辑
(defun c:tt ()
(if (= (tblsearch "Layer" "DIM") nil)
(command "Layer" "new" "DIM" "color" "4" "DIM" "")
)
(setq ss (ssget "X" '((0 . "DIMENSION"))))
(command "Chprop" ss "" "layer" "DIM" "")
) 经测试,不行啊
命令: dim
标注:
键入 EXIT,返回命令提示。 本帖最后由 adc 于 2012-10-14 15:12 编辑
xman00 发表于 2012-10-13 18:28 static/image/common/back.gif
经测试,不行啊
命令: dim
标注:
刚老大不是说了函数名与命令重名了,你把c:dim里的dim改成你想要的其他命令就行了 呵呵,不好意思,函数名与命令重名,上面已更改 (defun c:Dim2Layer (/ ss i ename err)
(vl-load-com)
(setq ss (ssget "_X" '((0 . "DIMENSION"))))
(setq i -1)
(while (setq ename (ssname ss (setq i (1+ i))))
(setq err (vl-catch-all-apply
'vla-put-layer
(list (vlax-ename->vla-object ename) "DIM")
))
(if (vl-catch-all-error-p err)
(print (vl-catch-all-error-message err))
)
)
(princ)
)