ghxh22 发表于 2013-1-11 00:31:18

求帮忙编一个Lisp程序

本帖最后由 ghxh22 于 2013-1-11 00:39 编辑

要求实现如图一的功能求帮忙 谢谢   图一:

下面的lisp只能实现尺寸线变成箭头(如图二)
(defun c:bjt(/ ss ds dims n)
(vl-load-com)
(setq ss (ssget '((0 . "DIMENSION"))) n 0)
(setq ds (getvar "dimscale"))
(while (< n (sslength ss))
    (setq obj (vlax-ename->vla-object (ssname ss n)))
    (vla-put-Arrowhead1Type obj 0)
    (vla-put-Arrowhead2Type obj 0)
    (setq n (1+ n))
)
)

图二:

yxp 发表于 2013-1-11 04:25:30

本帖最后由 yxp 于 2013-1-11 04:35 编辑

试试这个,你可以自己加入循环或多重标注对象处理

(defun c:ChangeD()
(setvar "cmdecho" 0)
(setq oldDS (getvar "dimstyle"))
(setq ss1 (entsel))
(command "dimstyle" "R" (cdr (assoc 3 (entget(nth 0 ss1)))))
(setvar "dimblk" ".")(setvar "DIMPOST" "D=<>")
(command "dimstyle" "APPLY" ss1 "" "dimstyle" "R" oldDS)
(princ)
)

ghxh22 发表于 2013-1-11 09:09:32

本帖最后由 ghxh22 于 2013-1-11 13:55 编辑

yxp 发表于 2013-1-11 04:25 static/image/common/back.gif
试试这个,你可以自己加入循环或多重标注对象处理

(defun c:ChangeD()

这个程序实现了绝大部分我想要的,非常感谢,还差一步,就是同时隐藏或者关闭尺寸界线,YXP大神再帮忙修改一下?十分感谢,还有您说的同时选择多个标注对象进行批量处理也加上去。谢谢   (PS:我是菜鸟,上面的lisp是我看到一个类似的程序自己稍微改了下参数得到的)这个程序可以实现这些
我想要实现的功能,输入命令之后,先选择标注一,标注一由左边变成右边式样;回车选择标注二,标注二由左边变成右边式样。感谢~

yxp 发表于 2013-1-14 02:17:49

没有D3了? 不麻烦
(defun c:ChangeD()
(setvar "cmdecho" 0)
(setq oldDS (getvar "dimstyle"))
(setq ss1 (entsel) Def (if (or (null Def) (= Def 2)) 0 Def))(if ss1 (progn
(command "dimstyle" "R" (cdr (assoc 3 (entget(nth 0 ss1)))))
(setvar "dimblk" ".")(setvar "DIMPOST" (strcat "D" (itoa (setq Def (1+ def))) "=<>"))
(setvar "DIMSE1" 0)(setvar "DIMSE2" 0)
(command "dimstyle" "APPLY" ss1 "" "dimstyle" "R" oldDS)))
(princ)
)
页: [1]
查看完整版本: 求帮忙编一个Lisp程序