1993063 发表于 2012-10-15 22:13:13

本帖最后由 1993063 于 2012-10-15 04:16 编辑

1993063 发表于 2012-10-15 03:53 static/image/common/back.gif
(defun c:Dim2Layer (/ ss i ename err)
(vl-load-com)
(setq ss (ssget "_X" '((0 . "DIMENSION"))) ...
不会是没有"DIMENSION"实体吧根据提示是没有标注对象

lish 发表于 2012-11-13 15:30:15

看看!!!

ucuc2003 发表于 2012-12-24 00:42:34

本帖最后由 ucuc2003 于 2012-12-24 23:13 编辑

(defun C:bz1 (/ LayIn bz)
(princ "\n改变对象图层,或创建 尺寸标注 图层")
(setvar "cmdecho" 0)
;;这部分:确定是否建立"尺寸标注"图层
(setq LayIn (getvar 'clayer))
(if (tblsearch "layer" "标注") ""
      (progn
         (command "-layer" "new" "标注" "color" "2" "标注" "")
         (command "clayer" LayIn)
       )
   )
(setq s1 (ssget '((0 . "leader,dimension,arc_dimension"))))
(if (= s1 nil)
      (command "-LAYER" "S" "尺寸标注" "");改变当前图层
      (progn
         (command "change" s1 "" "P" "la" "0" "";改变对象图层
                         "_setbylayer" s1 "" "y" "y"      ;线型改为随层
                         "change" s1 "" "P" "la" "标注" "");改变对象图层
      )
    )
(princ)
);end

编的烂凑活着用,测试环境AutoCAD2008

ucuc2003 发表于 2012-12-24 00:48:15

本帖最后由 ucuc2003 于 2012-12-24 23:14 编辑

(defun C:bzc(/ s2)
   (setvar "cmdecho" 0)
;;这部分:确定是否建立新图层
   (if (and (tblsearch "LAYER" "尺寸标注"));and
       ""
       (command "-layer" "new" "标注" "color" "2" "标注" "")
    );if
;;;这部分主程序
   (setq s2 (ssget "X" '((-4 . "<or")(0 . "leader")(0 . "dimension")(0 . "arc_dimension")(-4 . "or>"))))
   (if (= s2 nil) (princ "")
       (progn
          (command "change" s2 "" "P" "la" "0" ""   ;改变对象图层
                        "_setbylayer" s2 "" "y" "y"      ;线型改为随层
                        "change" s2 "" "P" "la" "标注" "");改变对象图层
      );progn
    );if
   (princ "\n标注已置于“标注层”")
   (princ)
);end defun

xiabin68 发表于 2012-12-24 02:06:39

都不一样,,高手啊

无语且听吟 发表于 2012-12-30 20:53:05

ucuc2003 果然好用
学习中.......

无语且听吟 发表于 2012-12-30 21:10:28

将成仔的"DIM"改为"标注"
拿来一用
谢谢成仔
(defun c:tt ()
(if (= (tblsearch "Layer" "标注") nil)
    (command "Layer" "new" "标注" "color" "4" "标注" "")
)
(setq ss (ssget "X" '((0 . "DIMENSION"))))
(command "Chprop" ss "" "layer" "标注" "")
)

tm20038175 发表于 2012-12-31 09:54:45

没有考虑块中块标注情况,有一点遗憾。

00放飞梦想00 发表于 2020-8-10 23:51:37

成仔 发表于 2012-10-13 16:12
(defun c:tt ()
(if (= (tblsearch "Layer" "DIM") nil)
    (command "Layer" "new" "DIM" "color" "4 ...

如何自由选择不是强行全部归层呢

F4164789 发表于 2020-8-11 08:09:22

感谢明经,感谢原作者,感谢原作者,谢谢,我只是转了
;;;这样在没有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)
)
;;;一个手选,一个自动选全图,随便用吧
页: 1 [2] 3
查看完整版本: 朋友们请进,求助 标注归层