lisp语言问题
(defunc:tt()(setqacmCol(vla-getinterfaceobject(vlax-get-acad-object)(strcat"AutoCAD.A...
(defun c:tt()
(setq acmCol (vla-getinterfaceobject
(vlax-get-acad-object) (strcat "AutoCAD.AcCmColor." (substr (getvar "ACADVER") 1 2))))
(vlax-for x (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
(cond
((= (vla-get-name x) "DIM") (vla-setrgb acmCol 255 0 255) (vla-put-TrueColor x acmCol))
((= (vla-get-name x) "DIM_1") (vla-setrgb acmCol 255 0 255) (vla-put-TrueColor x acmCol))
((= (vla-get-name x) "DIMS") (vla-setrgb acmCol 255 0 255) (vla-put-TrueColor x acmCol))
((= (vla-get-name x) "DIMS_1") (vla-setrgb acmCol 255 0 255) (vla-put-TrueColor x acmCol))
((= (vla-get-name x) "SCS_1_DIM") (vla-setrgb acmCol 255 0 255) (vla-put-TrueColor x acmCol))
((= (vla-get-name x) "SWAY_1") (vla-setrgb acmCol 255 0 255) (vla-put-TrueColor x acmCol))
((= (vla-get-name x) "TLTBLCK_TEXT") (vla-setrgb acmCol 255 0 255) (vla-put-TrueColor x acmCol))
((= (vla-get-name x) "BARS_1") (vla-setrgb acmCol 255 0 255) (vla-put-TrueColor x acmCol))
)
)
)
这个语言我不懂,但能添加到cad里,也能运行,只是有个问题,我想实现 像“ "DIM_1")
"DIMS-1") 和 "SCS_1_DIM") 和 "SWAY_1") 这些下划线后面数字从1到任何数字都能通过这个程序实现,不知道怎么写能实现,不是具体某个数字,可能是20,也可能是55 展开
(setq acmCol (vla-getinterfaceobject
(vlax-get-acad-object) (strcat "AutoCAD.AcCmColor." (substr (getvar "ACADVER") 1 2))))
(vlax-for x (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
(cond
((= (vla-get-name x) "DIM") (vla-setrgb acmCol 255 0 255) (vla-put-TrueColor x acmCol))
((= (vla-get-name x) "DIM_1") (vla-setrgb acmCol 255 0 255) (vla-put-TrueColor x acmCol))
((= (vla-get-name x) "DIMS") (vla-setrgb acmCol 255 0 255) (vla-put-TrueColor x acmCol))
((= (vla-get-name x) "DIMS_1") (vla-setrgb acmCol 255 0 255) (vla-put-TrueColor x acmCol))
((= (vla-get-name x) "SCS_1_DIM") (vla-setrgb acmCol 255 0 255) (vla-put-TrueColor x acmCol))
((= (vla-get-name x) "SWAY_1") (vla-setrgb acmCol 255 0 255) (vla-put-TrueColor x acmCol))
((= (vla-get-name x) "TLTBLCK_TEXT") (vla-setrgb acmCol 255 0 255) (vla-put-TrueColor x acmCol))
((= (vla-get-name x) "BARS_1") (vla-setrgb acmCol 255 0 255) (vla-put-TrueColor x acmCol))
)
)
)
这个语言我不懂,但能添加到cad里,也能运行,只是有个问题,我想实现 像“ "DIM_1")
"DIMS-1") 和 "SCS_1_DIM") 和 "SWAY_1") 这些下划线后面数字从1到任何数字都能通过这个程序实现,不知道怎么写能实现,不是具体某个数字,可能是20,也可能是55 展开
1个回答
展开全部
(defun c:tt()
(if (setq DIM(getstring"输入需要改色的图层名称:"))
(progn
(setq acmCol (vla-getinterfaceobject
(vlax-get-acad-object) (strcat "AutoCAD.AcCmColor." (substr (getvar "ACADVER") 1 2))))
(vlax-for x (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
(cond
((= (vla-get-name x) DIM) (vla-setrgb acmCol 255 0 255) (vla-put-TrueColor x acmCol))
)
)
)
)
(princ)
)
改了改代码 看看是不是你想要的!
追问
非常感谢您的帮助,我试了下,这个代码需要手动输入所有需要改动的图层名字,我需要的是能把之前那个代码里的 如图所示的这些所有的1-24用一个比如1-100的代码或所有的数字来代替,而不用输入这么多。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询