明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 930|回复: 9

宏命令更改标注,字体颜色

[复制链接]
发表于 2020-3-16 12:26:44 | 显示全部楼层 |阅读模式
请教大佬们一个问题,万分感谢!!!

我想通过宏命令更改图纸里很多的标注系列,字体的颜色,现有一段语句,但是不会合并,比如从"DIMS_2"到"DIMS_200"这种,各位大神有办法帮我修改下么,再次谢过

(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 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIM_1") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIM_3") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_1") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_2") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_4") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_3") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_5") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_6") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_7") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_8") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_9") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_10") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_11") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_12") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_13") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_14") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_15") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_16") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_17") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_18") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_19") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_20") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_21") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_22") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_23") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_24") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_25") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_26") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_27") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_28") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_29") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_30") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_31") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_32") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_33") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_34") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_35") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_36") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_37") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_38") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_39") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "DIMS_40") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_1_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_2_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_3_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_4_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_5_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_6_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_7_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_8_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_9_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_10_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_11_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_12_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_13_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_14_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_15_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_16_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_17_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_18_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_19_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_20_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_21_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_22_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_23_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_24_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_25_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_26_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_27_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_28_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_29_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_30_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_31_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_32_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_33_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_34_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_35_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_36_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_37_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_38_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_39_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_40_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_41_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_42_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_43_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SCS_44_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_1_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_2_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_3_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_4_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_5_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_6_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_7_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_8_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_9_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_10_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_11_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_12_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_13_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_14_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_15_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_16_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_17_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_18_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_19_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_20_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_21_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_22_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_23_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_24_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_25_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_26_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_27_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_28_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_29_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_30_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_31_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_32_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_33_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_34_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_35_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_36_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_37_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_38_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_39_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "CCS_40_DIM") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_1") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_2") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_3") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_4") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_5") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_6") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_7") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_8") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_9") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_10") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_11") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_12") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_13") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_14") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_15") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_16") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_17") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_18") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_19") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_20") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_21") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_22") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_23") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_24") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_25") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_26") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_27") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_28") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_29") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_30") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_31") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_32") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_33") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_34") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_35") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_36") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_37") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_38") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_39") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "SWAY_40") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "TLTBLCK_TEXT") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_1") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_2") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_3") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_4") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_5") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_6") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_7") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_8") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_9") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_10") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_11") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_12") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_13") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_14") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_15") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_16") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_17") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_18") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_19") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_20") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_21") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_22") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_23") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_24") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_25") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_26") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_27") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_28") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_29") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_30") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_31") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_32") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_33") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_34") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_35") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_36") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_37") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_38") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_39") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "BARS_40") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE1") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE2") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE3") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE4") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE5") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE6") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE7") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE8") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE9") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE10") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE11") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE12") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE13") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE14") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE15") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE16") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE17") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE18") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE19") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE20") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE21") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE22") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE23") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE24") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE25") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE26") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE27") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE28") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE29") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE30") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE31") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE32") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE33") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE34") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE35") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE36") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE37") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE38") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE39") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE40") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))
    ((= (vla-get-name x) "INTDRIVE41") (vla-setrgb acmCol 0 255 0) (vla-put-TrueColor x acmCol))


  )
  )
  )
发表于 2020-3-17 16:12:57 | 显示全部楼层
上面的 prog 应该是 progn 丢了个字母 n
回复 支持 1 反对 0

使用道具 举报

 楼主| 发表于 2020-3-16 13:49:49 | 显示全部楼层
顶起来下,大佬请帮帮忙哦!!!!
发表于 2020-3-17 10:16:10 | 显示全部楼层
如果将是这些项,合并不合并,好像也没太大的区别。一定要合并,可以把它们罗列在一起建一个大表,然后检索是否在表中,在的话,修改颜色。
如果不只是这些,比如那些序号会一直延伸下去,DIMS_41, DIMS_42, ... 可以看看 (wcmatch ...) 函数。

还有更深的疑问,可以到 lsp开发区 去:http://bbs.mjtd.com/forum-3-1.html
 楼主| 发表于 2020-3-17 13:14:32 | 显示全部楼层
dunkel 发表于 2020-3-17 10:16
如果将是这些项,合并不合并,好像也没太大的区别。一定要合并,可以把它们罗列在一起建一个大表,然后检索 ...

非常感谢你百忙之中的答复,我对这个实在不是很懂,所以如果方便的话,是否可以帮我出一个(wcmatch)函数的例子,因为那个序号是真的会延续下去,再次感谢
发表于 2020-3-17 13:58:15 | 显示全部楼层
那些拖数字序号的有没有其它的非数字的可能,比如 DIMS_a 什么的是不要被处理的,如果没有,比较好办:
(if (wcmatch (vla-get-name x) "DIMS_*,SCS_*_DIM,SCS_*_DIM")
    (prog
       (vla-setrgb acmCol 0 255 0)
       (vla-put-TrueColor x acmCol)
    )
)
如果有,由于 lsp 的这个 wcmatch 函数不支持完整的正则表示,可能需要罗列 1和 2 和 3位的数字序号才行:
(if (wcmatch (vla-get-name x) "DIMS_#,DIMS_##,DIMS_###,SCS_#_DIM,SCS_##_DIM,SCS_###_DIM,SCS_#_DIM,SCS_##_DIM,SCS_###_DIM")
要是有 4位序号的,还得再加它进去。
其它没有罗列进去的照样添加进去即可。
上面的 (if ...) 是替代原来的 (cond ...) 的。
 楼主| 发表于 2020-3-17 14:47:45 | 显示全部楼层
dunkel 发表于 2020-3-17 13:58
那些拖数字序号的有没有其它的非数字的可能,比如 DIMS_a 什么的是不要被处理的,如果没有,比较好办:
(i ...

你好,就是数字的,没有其他的非数字的可能,
我把你的代码替换进去,运行输入tt显示为止命令呢,代码如下是正确的么?
(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)))
  (if (wcmatch (vla-get-name x) "DIMS_*,SCS_*_DIM,CCS_*_DIM,SWAY_*,TLTBLCK_TEXT,BARS_*,INTDRIVE*,LIP-TOLIP_*,LIP-TO-LIP")
      (prog
         (vla-setrgb acmCol 0 255 0)
         (vla-put-TrueColor x acmCol)

      )
)

发表于 2020-3-17 15:09:08 | 显示全部楼层
最前面要加上 (vl-load-com) 吧,这个是使用 vl... 类函数的必需。
 楼主| 发表于 2020-3-17 15:35:58 | 显示全部楼层
dunkel 发表于 2020-3-17 15:09
最前面要加上 (vl-load-com) 吧,这个是使用 vl... 类函数的必需。

再次感谢,我后面加个了),现在能运行了,但是发现只有几个颜色变了,DIMS_1和DIMS_4颜色变了,其他的都没变,不知道怎么回事,代码如下

(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)))
  (if (wcmatch (vla-get-name x) "DIMS_*, SCS_*_DIM, CCS_*_DIM, SWAY_*, TLTBLCK_TEXT,BARS_*, INTDRIVE*, LIP-TO-LIP_*, LIP-TO-LIP, DIM.")
      (prog
         (vla-setrgb acmCol 0 255 0)
         (vla-put-TrueColor x acmCol)

)
)
)
)
 楼主| 发表于 2020-3-17 16:36:16 | 显示全部楼层
dunkel 发表于 2020-3-17 16:12
上面的 prog 应该是 progn 丢了个字母 n

万分感谢,解决了,是的,少了个n字母。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-6 00:41 , Processed in 0.190785 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表