;;----------------------------------------------------------------------
;;论坛地址:http://bbs.mjtd.com/forum.php?mod=viewthread&tid=86610
;;程序创意来自wkai
;;代码设计：小菜
;;块属性代码来自KLDC
;;综合了wowan1314 的修改方案，手选、全选等直接改为按钮 v1.29版修改
;;作者对本程序不提供任何使用上的保证。
;;本程序不得用于商业目的，复制传播请保留以上信息
;;----------------------------------------------------------------------
(defun c:ss ( / slent f dcl_name lst2 lst1 color tmp index_value flag entl lst3 lst4 lst5 code tmp2 tmp3
                   ktmp klst acadlay kl_tmp lst6 pop_lst tmp1 inf_wid txta_wid tog_wid eval_value
                   tmp_str pop_wid wctmp attl1 attl2 attl3 att_fj dblk_fj dblkl1 dblkl2 dblkl3 dblk_sel
                   att_sel att_value_fj dblk_value_fj att_tag_fj dblk_name_fj dblk_value att_value att_tag
                   dblk_name grps_lst grps_value grpsl1hand fjflt filter kl_pre
                   ;;样板实体空选时按上次过滤表进行选择，用ss_saved_lst保存;;ss_saved_lst作为全局变量保存上次选择的变量值，格式：(hand fjflt filter kl_pre)
                   ss fjlst ssl attdis strtmp dblkdis acaddoc lay_lst sty_lst lin_lst color_lst dims_lst
                   appid_lst str_xdata lines
               ) 
                   ;;--存在问题1：因为块属性和动态块特性是程序中自动生成的，所以保存的状态到下次SS使用时，选择不同图块，默认选择状态的位置不正确
  (setq tmp (findfile (strcat mai_mini_path "用户设置\\ss_filter.lsp")))
  (if tmp (load tmp))
  (setq attdis "N"
        dblkdis "N"
        kl_pre (last ss_saved_lst)
        hand (car ss_saved_lst)
        slent "N"
        flag t
        inf_wid "12"
        txta_wid "12.3"
        tog_wid "14"
        pop_wid "6"
        color_lst '((256 "随层") (0 "随块") (1 "红色") (2 "黄色")
                    (3 "绿色") (4 "青色") (5 "蓝色") (6 "紫色") (7 "黑白")
                    ((acad_colordlg (atoi (get_tile "txt62"))) "其它...")
                   )
        acaddoc (vla-get-activedocument (vlax-get-acad-object))
        acadlay (vla-get-Layers acaddoc)
  )
  (vlax-map-collection acadlay '(lambda (x) (setq lay_lst (cons (vla-get-name x) lay_lst))))
  (vlax-map-collection (vla-get-TextStyles acaddoc) '(lambda (x) (setq sty_lst (cons (vla-get-name x) sty_lst))))
  (vlax-map-collection (vla-get-linetypes acaddoc) '(lambda (x) (setq lin_lst (cons (vla-get-name x) lin_lst))))
  (vlax-map-collection (vla-get-dimstyles acaddoc) '(lambda (x) (setq dims_lst (cons (vla-get-name x) dims_lst))))
  (vlax-map-collection (vla-get-groups acaddoc) '(lambda (x) (setq grps_lst (cons (vla-get-name x) grps_lst))))
  (setq grps_lst (reverse grps_lst) ;;;V1.31
        lay_lst (acad_strlsort lay_lst)
        sty_lst (acad_strlsort sty_lst)
        dims_lst (acad_strlsort dims_lst)
        lin_lst (reverse lin_lst)
  )
  (if grps_lst (setq grps_lst (acad_strlsort grps_lst)))
  (while (member slent (list "N" "H" "B"))
      (initget "H N B" )
      (setq slent (entsel
                    (strcat "\n请选择样板实体[帮助(H)/打开块属性显示(N)/打开动态块特性显示(B)]当前状态：块属性"
                            (if (= "Y" attdis) "打开" "关闭")
                            ",动态块特性"
                            (if (= "Y" dblkdis) "打开" "关闭")
                            ":"
                    )
                  )
      )
      (cond
        ((= slent "N") (setq attdis "Y"))
        ((= slent "B") (setq dblkdis "Y"))
        ((= slent "H")
              (alert (strcat "\n通配符使用说明："
                             "\n# (磅值符号)  匹配任意单个数值字符"
                             "\n@ (at)        匹配任意单个字母字符"
                             "\n. (句号)      匹配任意单个非字母数值字符"
                             "\n* (星号)      匹配任意字符序列，包括空字符串，它可以出现在任何位置"
                             "\n? (问号)      匹配任意单个字符"
                             "\n~ (波浪号)    如果它是模式字符串的第一个字符，则匹配除此字符串之外的任意字符串"
                             "\n[...]         匹配括号中的任意一个字符"
                             "\n[~...]        匹配不在括号中的任意单个字符"
                             "\n- (连字符)    用在括号里面，用来指明单个字符的取值范围"
                             "\n, (逗点)      分隔两个模式字符串"
                             "\n` (上撇号)    特殊转义字符(按字义读取随后的字符)"
                             ;|
                             "\n"
                             "\n选择不含数字的文本：(ssget '((0 . \"TEXT\") (-4 . \"<NOT\") (1 . \"*[0-9]*\") (-4 . \"NOT>\")))"
                             "\n选择不含数字的文本：(ssget '((0 . \"TEXT\") (1 . \"~*#*\")))"
                             "\n选择含字母的文本：(ssget '((0 . \"TEXT\" )(-4 . \"<or\") (1 . \"*[a-z]*\") (1 . \"*[A-Z]*\")(-4 . \"or>\")))"
                             "\n选择不含字母的文本：(ssget '((0 . \"TEXT\") (-4 . \"<NOT\") (1 . \"*[a-A-z-Z]*\") (-4 . \"NOT>\")))"
                             "\n选择200X后面数字大于400的文字：(ssget '((1 . \"200X[4-9][0-9][0-9]\")))"
                             "\n选择Line线和多义线：(ssget '((0 . \"*LINE,LWPOLYLINE\")))"
                             "\n选择线和圆弧：(ssget '((0 . \"*LINE,ARC\")))"
                             ;|;
                      )
               );;alert
         )
         (t (setq slent (car slent)))
    )  ;;cond
 );;while
 (if slent  ;;;----------------------1
    (progn  ;;;-----------------------1
      (setq fjflt nil filter nil entl (entget slent '("*")))     
      (and (member (mai_dxf 0 entl) '("CIRCLE" "ELLIPSE" "LWPOLYLINE" "REGION" "SPLINE"))
           (= (mai_dxf 0 (mai_dxf 330 entl)) "VIEWPORT")
           (setq slent (mai_dxf 330 entl)) ;;采用视口作为样本实体
      )
      (setq entl (entget slent '("*"))
            lst2
           '(("GLOBAL"
              ((0 "实体类型"
                  (((mai_dxf 0 slent) "当前实体") ("*" "所有实体") ("VIEWPORT" "视 口") ("*LINE,ARC" "线和圆弧") ("*LINE" "各种线")
                   ((ss_sel_lay
                            "实体类型多选"
                            '("ARC" "ATTDEF" "CIRCLE" "DIMENSION" "ELLIPSE" "HATCH" "IMAGE" "INSERT" 
                              "LEADER" "LINE" "LWPOLYLINE" "MTEXT" "MULTILEADER" "OLE2FRAME" "POINT" 
                              "POLYLINE" "SOLID" "SPLINE" "TEXT" "VIEWPORT" "WIPEOUT"
                              "TCH_ARCSTAIR" "TCH_ARROW" "TCH_ASCENT" "TCH_AXIS_LABEL" "TCH_BALCONY" 
                              "TCH_BLOCK_INSERT" "TCH_CABLETRY" "TCH_COLUMN" "TCH_COMPOSING" "TCH_COORD" 
                              "TCH_CORNER_WINDOW" "TCH_CURTAIN_WALL" "TCH_CURVESTAIR" "TCH_DIMENSION2" 
                              "TCH_DORMER" "TCH_DRAWINGINDEX" "TCH_DRAWINGNAME" "TCH_EFITTING" 
                              "TCH_ELEVATION" "TCH_EQUIPDIM2" "TCH_HANDRAIL" "TCH_INDEXPOINTER" 
                              "TCH_LINESTAIR" "TCH_MTEXT" "TCH_MULTILEADER" "TCH_MULTISTAIR" "TCH_NORTHTHUMB" 
                              "TCH_OPENING" "TCH_PIPE" "TCH_RADIUSDIM" "TCH_RECT" "TCH_RECTSTAIR" 
                              "TCH_RUPTURE" "TCH_SHEET" "TCH_SLOPEROOF" "TCH_SPACE" "TCH_STEP" 
                              "TCH_SYMB_SECTION" "TCH_SYMMETRY" "TCH_TEXT" "TCH_WALL" "TCH_WIREDIM2"
                              "SWR_ARCSTAIR" "SWR_ARROW" "SWR_ASCENT" 
                              "SWR_AXIS_LABEL" "SWR_BALCONY" "SWR_BLOCK_INSERT" "SWR_CABLETRY" "SWR_COLUMN" 
                              "SWR_COMPOSING" "SWR_COORD" "SWR_CORNER_WINDOW" "SWR_CURTAIN_WALL" 
                              "SWR_CURVESTAIR" "SWR_DIMENSION2" "SWR_DORMER" "SWR_DRAWINGINDEX" 
                              "SWR_DRAWINGNAME" "SWR_EFITTING" "SWR_ELEVATION" "SWR_HANDRAIL" 
                              "SWR_INDEXPOINTER" "SWR_LINESTAIR" "SWR_MTEXT" "SWR_MULTILEADER" 
                              "SWR_MULTISTAIR" "SWR_NORTHTHUMB" "SWR_OPENING" "SWR_PIPE" "SWR_RADIUSDIM" 
                              "SWR_RECTSTAIR" "SWR_RUPTURE" "SWR_SHEET" "SWR_SLOPEROOF" "SWR_SPACE" 
                              "SWR_STEP" "SWR_SYMB_SECTION" "SWR_SYMMETRY" "SWR_TEXT" "SWR_WALL"
                             )
                            "txt0"
                    )
                    "类型多选..."
                   )
                  )
                )   ;;v1.26修改txt0
                (6 "实体线型")
                (8 "所在图层" (((mai_dxf 8 slent) "实体图层") ("*" "所有图层") ((getvar "clayer") "当前图层")
                               ((ss_sel_lay "图层多选" lay_lst "txt8") "图层多选...")
                              )
                )
                (48 "线型比例") (62 "实体颜色")
                 ;; ((256 "随层") (0 "随块") (1 "红色") (2 "黄色") (3 "绿色") 
                 ;; (4 "青色") (5 "蓝色") (6 "紫色") (7 "黑白") ((acad_colordlg (atoi (get_tile "txt62"))) "其它...")))
                (370 "实体线宽") (-3 "扩展数据"))
                ("FJ" ("FJ1" "显示颜色") ("FJ2" "显示线型") ("FJ3" "实体编组"))
             );; (47 "天正比例")))
             ("ARC" ((-4 "圆弧") (10 "圆心坐标") (40 "圆弧半径") (39 "实体厚度") (50 "起点角度") (51 "终点角度"))
                    ("FJ" ("FJ4" "圆弧长度" (mai_curve_length slent)) ("FJ5" "圆弧面积" (mai_get_area slent)))
             )
             ("CIRCLE" ((-4 "圆形") (10 "圆心坐标") (40 "圆形半径") (39 "实体厚度")))
             ("SOLID" ((-4 "SOLID") (39 "实体厚度")))
             ("POINT" ((-4 "点") (10 "点的位置") (39 "实体厚度") (50 "旋转角度")))
             ("LINE" ((-4 "直线段") (10 "起点坐标") (11 "终点坐标") (39 "实体厚度"))
                     ("FJ" ("FJ4" "线段长度" (mai_curve_length slent))
                           ("FJ5" "线段角度" (rem (atof (angtos (angle (mai_dxf 10 slent) (mai_dxf 11 slent)))) 180))
                     )
             )
             ("ELLIPSE" ((-4 "椭圆") (10 "椭圆中心") (11 "长轴端点") (40 "长短轴比") (41 "开始参数") (42 "结束参数")))
             ("INSERT" ((-4 "图块") (10 "图块位置") (2 "图块名称") (41 "Ｘ轴比例") (42 "Ｙ轴比例") (43 "Ｚ轴比例")
                        (50 "旋转角度")(66 "伴随属性" ((0 "否") (1 "是")))
                       )
                       ("FJ"
                         ("FJ4" "图块名称" (mai_block_name (mai_get_property slent nil)))
                         ("FJ5" "是动态块" (if vla-get-isdynamicblock (vla-get-isdynamicblock (mai_get_property slent nil))) ((:vlax-true "是") (:vlax-false "否")))
                         ("FJ6" "外部引用" (vla-get-isxref (vla-item (vla-get-blocks acaddoc) (mai_dxf 2 slent))) ((:vlax-true "是") (:vlax-false "否")))
                       )
             )
             ("LWPOLYLINE" ((-4 "轻多义线") (38 "复线标高") (43 "固定宽度") (90 "顶点个数") (39 "复线厚度")
                            (70 "是否闭合" ((0 "不闭合") (1 "闭合") (128 "Plinegen") (129 "Plinegen closed")))
                           ) 
                           ("FJ" ("FJ4" "曲线长度" (mai_curve_length slent)) ("FJ5" "曲线面积" (mai_get_area slent)))
             )
             ("POLYLINE" ((-4 "重多义线") (70 "是否闭合" ((0 "不闭合") (1 "闭合"))))
                         ("FJ" ("FJ4" "曲线长度" (mai_curve_length slent )) ("FJ5" "曲线面积" (mai_get_area slent )))
             )
             ("HATCH" ((-4 "图案填充") (2 "填充图案") (41 "填充比例") (52 "填充角度")
                       (71 "边界关联" ((0 "不关联") (1 "关联"))) 
                       (76 "图案类型" ((0 "用户定义") (1 "预定义") (2 "自定义")))
                      )
                      ("FJ" ("FJ4" "填充面积" (mai_get_area slent)))
             )
             ("TEXT" ((-4 "文字")
                      (1 "文字内容"
                         (((ss_cltpf (mai_dxf 1 slent) nil t) "文字内容")
                          ((ss_getallstr (ss_cltpf (mai_dxf 1 slent) nil t)) "文字内容(不区分大小写)")
                          ("*[~ -~]*" "含有汉字(含空格)")
                          ("*[~!-~]*" "含有汉字(含空格)及非汉字含空格")
                          ("~*[!-~]*" "仅汉字(含空格)")
                          ("~*[ -~]*" "仅汉字(不含空格)")
                          ("~*[~ -~]*" "字符(含空格)")
                          ("~*[~!-~]*" "纯字符")
                          ("~* *" "不含空格任意字符")
                          ("*[a-A-z-Z]*" "含字母")
                          ("~*[a-A-z-Z]*" "不含字母")
                          ("~*@*" "不含字母的任意字符")  
                          ("~*[~ -@~]*" "仅数字(含空格)")
                          ("~*[~!-@~]*" "仅数字(不含空格)")
                          ("*#*" "含有数字(含空格)")
                          ;("*[0-9]*" "含有数字(含空格)-2")
                          ;;("~*#*" "不包含数字(含空格)")
                          ;("~*['.@#]*" "仅含特殊字符(如!@#$等)及小数点") ;;有错误
                          ("~*[@#]*" "不含特殊字符(如!@#$等)")
                         )
                      )
                      (7 "文字样式") (10 "插入位置") (40 "文字高度") (41 "宽度系数") (50 "旋转角度") (51 "倾斜角度") 
                      (71 "文字镜像" ((0 "默认") (2 "文字反向") (4 "文字倒置") (6 "反向倒置"))) 
                      (72 "水平对齐" ((0 "左对齐") (1 "居中对齐") (2 "右对齐") (3 "对齐") (4 "中间") (5 "拟合"))) 
                      (73 "垂直对齐" ((0 "基线对齐") (1 "底端对齐") (2 "居中对齐") (3 "顶端对齐"))))
                      ("FJ" ("FJ4" "文字角度" (atof (angtos (mai_dxf 50 slent)))) ("FJ5" "字符个数" (strlen (mai_dxf 1 slent))))
             )
             ("ATTDEF" ((-4 "属性定义") (2 "属性标记") (7 "字型样式") (10 "插入位置") (40 "文字高度") (50 "旋转角度") (51 "倾斜角度") 
                        (71 "文字镜像" ((0 "默认") (2 "文字反向") (4 "文字倒置") (6 "反向倒置"))) 
                        (72 "水平对齐" ((0 "左对齐") (1 "居中对齐") (2 "右对齐") (3 "对齐") (4 "中间") (5 "拟合"))) 
                        (74 "垂直对齐" ((0 "基线对齐") (1 "底端对齐") (2 "居中对齐") (3 "顶端对齐")))
                       )
                       ("FJ" ("FJ4" "标记数值" (atof (mai_dxf 2 slent))))
             )
             ("MTEXT" ((-4 "多行文字") (10 "插入位置") (7 "文字样式") (40 "文字高度") (50 "旋转角度"))
                      ("FJ" ("FJ4" "文字角度" (atof (angtos (mai_dxf 50 slent))))
                            ("FJ5" "文字内容" (if (= (mai_dxf 0 slent) "MTEXT") (mai_get_property slent 'TextString)))
                      )
             )
             ("SPLINE" ((-4 "样条曲线") (70 "曲线标志") (71 "曲线阶数") (72 "节点数量") (73 "控制点数") 
                        (74 "拟合点数") (42 "节点公差") (43 "控点公差") (44 "拟合公差")
                       )
                       ("FJ" ("FJ4" "曲线长度" (mai_curve_length slent)) ("FJ5" "曲线面积" (mai_get_area slent)))
             )
             ("DIMENSION" ((-4 "尺寸标注") (1 "标注文字") (42 "测量数值") (3 "标注样式") (50 "旋转角度") (70 "标注类型" ((32 "水平垂直") 
                           (33 "对齐标注") (34 "角度标注") (35 "直径标注") (36 "半径标注") (37 "三点角度") (38 "坐标标注")))
                          )
                          ("FJ" ("FJ4" "手改尺寸" (if (= "" (mai_get_property slent 'TextOverride)) "否" "是") (("是" "是") ("否" "否")))
                                ("FJ5" "测量数值" (ss_dimvalue slent)) 
                                ("FJ6" "标注文字" (ss_dimtext slent))
                                ("FJ7" "文字颜色")
                                ("FJ8" "文字高度" (mai_get_property slent 'TextHeight))
                                ("FJ9" "文字样式") ;;(vlax-get (vlax-ename->vla-object slent) 'TextStyle))
                                ("FJ10" "上 公 差" (mai_get_property slent 'ToleranceUpperLimit))
                                ("FJ11" "下 公 差" (mai_get_property slent 'ToleranceLowerLimit))
                                ("FJ12" "文字角度" (mai_get_property slent 'TextRotation)) ;;by smartstar "所有标注类型均有可选的51组码，表示标注图元的水平方向" "标注图元决定水平、垂直和旋转线性标注的标注文字和直线的方向"
                          )
             )
             ("LEADER" ((-4 "标注引线") (3 "标注样式") (71 "箭头标志" ((0 "禁用") (1 "启用"))) (72 "引线类型" ((0 "直线") (1 "样条曲线"))))
                       ("FJ" ("FJ4" "标注样式" (mai_dxf 3 slent))  ;;child style 在ssget标准过滤表中不能正常选择出结果
                             ("FJ5" "箭头样式" (mai_get_property slent 'ArrowheadType)
                                    ((0 "实心闭合") (1 "空心闭合") (2 "闭合") (3 "点") (4 "建筑标记") (5 "倾斜") (6 "打开")
                                     (7 "指示原点") (8 "指示原点2") (9 "直角") (10 "30度角") (11 "小点") (12 "空心点") (13 "空心小点") (14 "方框") (15 "实心方框")
                                     (16 "基准三角形")   (17 "实心基准三角形") (18 "积分") (19 "无")  (20 "用户箭头") ;;;by smartstar  
                                    )
                             ) 
                       )
             ) 
             ("VIEWPORT" ((-4 "视口") (69 "视口　ID")) ("FJ" ("FJ4" "比例　1: " (rtos (/ (mai_dxf 45 slent) (mai_dxf 41 slent)) 2 0))))
             ("WIPEOUT" ((-4 "区域覆盖")   ;;by smartstar
                         (71 "边界类型" ((1 "矩形") (2 "多边形")))
                             (91 "顶 点 数")    ;后面的裁剪边界顶点数（不明白什么意思，总是比“附加过滤”中的“顶点数值”的值大1）
                             (280 "剪裁状态" ( (0 "关闭") (1 "打开")))
                             (281 "亮 度 值") (282 "对比度值") (283 "淡入度值")
                             (70 "图像特性"  ;调试中组码70的值总是7，cad说明中无此项
                                 ((1 "显示图像") (2 "当与屏幕不对齐时显示图像") (4 "使用剪裁边界") (7 "★未知情况") (8 "透明度打开"))
                             )  
                        )
                        ("FJ" ("FJ4" "顶点数量" (length (wipeout2plst slent))) ("FJ5" "覆盖面积" (abs (ss_fonces_Area (wipeout2plst slent)))))
              ) ;;by smartstar    
              ("IMAGE" ((-4 "图像") (13 "图像大小") (71 "边界类型" ((1 "矩形") (2 "多边形")))
                        (91 "顶 点 数")    ;后面的裁剪边界顶点数（不明白什么意思，总是比“附加过滤”中的“顶点数值”的值大1）
                        (280 "剪裁状态" ( (0 "关闭") (1 "打开")));总是不出现下拉框，不知道为什么
                        (281 "亮 度 值") (282 "对比度值") (283 "淡入度值")
                        (70 "图像特性"  ;调试中组码70的值总是7，cad说明中无此项
                            ((1 "显示图像") (2 "当与屏幕不对齐时显示图像") (4 "使用剪裁边界") (7 "未知情况") (8 "透明度打开"))
                        )  
                       )
                       ("FJ" ("FJ4" "图像宽度" (mai_get_property slent 'ImageWidth))
                             ("FJ5" "图像高度" (mai_get_property slent 'ImageHeight))
                             ("FJ6" "缩放比例" (mai_get_property slent 'ScaleFactor))
                             ("FJ7" "像素宽度" (mai_get_property slent 'Width))
                             ("FJ8" "像素高度" (mai_get_property slent 'Height))
                             ("FJ9" "图像文件" (mai_get_property slent 'ImageFile))
                             ("FJ10" "图像名称" (mai_get_property slent 'Name))
                       )
              )
              ("REGION" ((-4 "面域") (70 "建模格式")) ("FJ" ("FJ4" "面域面积" (mai_get_property slent 'Area))))
              ("TRACE" ((-4 "跟踪") (10 "起点坐标")))
              ("RAY" ((-4 "射线") (10 "起点坐标")) ("FJ" ("FJ4" "射线角度" (atof (angtos (angle '(0.0 0.0 0.0) (mai_dxf 11 slent)))))))
              ("XLINE" ((-4 "构造线") (10 "起点坐标")) ("FJ" ("FJ4" "角　　度" (rem  (atof (angtos (angle '(0.0 0.0 0.0) (mai_dxf 11 slent)))) 180))))
              ("MULTILEADER" ((-4 "多重引线") (42 "旋转角度") (304 "默认文字")))
              ("OLE2FRAME" ((-4 "OLE框架") (10 "左上坐标") (11 "右下坐标") (70 "版　　本")
                            (71 "对象类型" ((1 "链接") (2 "嵌入") (3 "静态")))
                            (72 "平辅模式" ((0 "模型空间") (1 "图纸空间")))
                           )
                           ("FJ" ("FJ4" "对象宽度" (mai_get_property slent 'Width)) ("FJ5" "对象高度" (mai_get_property slent 'Height)))
              )
              ("TCH_DIMENSION2" ((-4 "天正尺寸") (47 "天正比例")))
              ("TCH_WALL" ((-4 "天正墙体") (47 "天正比例") (40 "左侧墙厚") (41 "右侧墙厚") (42 "面层厚度") (50 "圆心角度") (76 "门窗数目")
                           (73 "内墙外墙" ((0 "内墙") (1 "外墙"))) (74 "墙体材料" ((10 "轻型隔断") (20 "幕墙") (40 "砖墙") (50 "石材") (60 "钢筋砼")))
                          )
                          ("FJ" ("FJ4" "墙体高度" (mai_dxf 39 slent))
                                ("FJ5" "左侧墙厚" (if (not (mai_dxf 40 slent)) (mai_get_property slent 'LeftWidth))) ;;有些墙体40和41组码均为nil，用此处附加过滤
                                ("FJ6" "右侧墙厚" (if (not (mai_dxf 41 slent)) (mai_get_property slent 'RightWidth)))
                                ("FJ7" "墙体厚度" (if (and (mai_dxf 40 slent) (mai_dxf 41 slent))
                                                      (+ (mai_dxf 40 slent) (mai_dxf 41 slent))
                                                      (mai_get_property slent 'TotalWidth)
                                                  )
                                )
                          )
              )
              ("TCH_ELEVATION" ((-4 "天正标高") (47 "天正比例") (10 "标高位置")(1 "标高文字")(7 "文字样式")(40 "文字高度"))
                               ("FJ" ("FJ4" "标高数值" (atof (mai_dxf 1 slent))))
              )
              ("TCH_TEXT" ((-4 "天正文字") (47 "天正比例") (10 "文字位置") (1 "文字内容") (7 "文字样式") (40 "文字字高") (50 "旋转角度")
                           (70 "控制标记" ((0 "不屏蔽背景") (1 "屏蔽背景")))
                           (72 "对齐方式" ((1 "左上") (2 "中上") (3 "右上") (4 "左中") (5 "正中") (6 "右中") (7 "左下") (8 "中下")
                                           (9 "右下") (10 "左(基线)") (11 "中心(基线)") (12 "右(基线)") (13 "中间")
                                          )
                           )
                          )
              )
              ("TCH_MTEXT" ((-4 "天正多行文字") (47 "天正比例") (1 "文字内容") (7 "文字样式")
                            (40 "文字高度") (50 "旋转角度") (41 "页面宽度") (42 "行 间 距")
                            (70 "控制标记" ((0 "不屏蔽背景") (1 "屏蔽背景")))
                            (72 "对齐方式" ((10 "左(基线)") (11 "中心(基线)") (12 "右(基线)") (14 "两端")))
                           )
              )
              ("TCH_PIPE" ((-4 "天正管道") (47 "天正比例") (280 "其　　他") (301 "标　　注")) ("FJ" ("FJ4" "管　　径" (mai_dxf 140 slent))))
              ("TCH_OPENING" ((-4 "天正门窗") (47 "天正比例") (11 "编号位置") (302 "门窗编号") (40 "门窗宽度")
                              (41 "门窗高度") (43 "窗套距离") (44 "窗套宽度") (50 "文字转角") (51 "窗圆心角")
                              (71 "门窗类型" ((0 "门") (1 "窗") (2 "洞") (3 "弧窗") (4 "凸窗") (5 "转角窗") (6 "门联窗") (7 "子母门")))
                              (73 "凸窗类型" ((1 "梯形") (2 "三角形") (3 "拱形") (4 "矩形"))) (7 "文字样式")
                             )
              )
              ("TCH_ARROW" ((-4 "天正箭头标注") (47 "天正比例") (11 "文字位置") (1 "文字内容") (7 "文字样式") (40 "文字高度") (41 "箭头大小")
                            (70 "文字对齐" ((1 "在线端") (2 "在线中") (3 "齐线端")))
                           )
              )
              ("TCH_RADIUSDIM" ((-4 "天正半径标注") (47 "天正比例") (10 "圆心位置")(3 "标注样式"))
                               ("FJ" ("FJ4" "标注文字" (mai_get_property slent 'TEXT)))
              )
              ("TCH_CURTAIN_WALL" ((-4 "天正玻璃幕墙") (47 "天正比例") (78 "水平分格") (79 "竖直分格") (148 "横框间距")
                                   (149 "竖挺间距") (415 "玻璃图层") (416 "横框图层") (417 "竖挺图层")
                                  )
              )
              ("TCH_CORNER_WINDOW" ((-4 "天正转角窗") (47 "天正比例") (10 "位　　置") (11 "编号位置") (302 "门窗编号") (40 "门窗宽度1")
                                    (41 "门窗宽度2") (42 "门窗高度") (140 "文字高度") (44 "窗套宽度") (50 "文字转角") (7 "文字样式")
                                   )
              )
              ("TCH_DORMER" ((-4 "天正老虎窗") (47 "天正比例") (7 "文字样式") (10 "窗台位置") (11 "编号位置") (302 "门窗编号") (40 "文字高度")
                             (50 "法　　向") (140 "出檐长度") (141 "出山长度") (142 "坡　　度") (148 "窗　　高") (144 "窗　　宽")
                             (70 "类　　型" ((0 "三角坡") (1 "双坡") (2 "三坡") (3 "梯形坡") (4 "平顶窗")))
                             (71 "是否显示" ((0 "不显示") (1 "显示")))
                            )
              )
              ("TCH_SYMMETRY" ((-4 "天正对称轴") (47 "天正比例") (10 "起 始 点") (11 "终 止 点") (40 "距　离 a") (41 "距　离 b") (42 "距　离 c")))
              ("TCH_COMPOSING" ((-4 "天正作法标注") (47 "天正比例") (1 "文字内容") (7 "文字样式") (40 "文字高度") (41 "引线长度")
                                (70 "文字对齐" ((0 "在线上") (1 "在线端")))
                               )
              )
              ("TCH_COORD" ((-4 "天正坐标标注") (47 "天正比例") (10 "标 注 点") (41 "X 坐标值") (42 "Y 坐标值") (7 "文字样式") (40 "文字高度")
                            (70 "控制标记" ((0 "XY方式,三位精度") (1 "AB方式,三位精度") (2 "XY方式,两位精度") (3 "AB方式,二位精度")))
                            (71 "标注方向" ((0 "第一象限") (1 "第二象限") (2 "第三象限") (3 "第四象限")))
                           )
              )
              ("TCH_DRAWINGINDEX" ((-4 "天正索引图名") (47 "天正比例") (10 "圆心位置") (1 "索引编号") (7 "文字样式") (40 "文字高度") (41 "圆圈直径") (42 "线　　粗"))
                                  ("FJ" ("FJ4" "图纸编号" (mai_get_property slent 'DrawingLabel))
                                        ("FJ5" "比例文字" (mai_get_property slent 'ScaleText))
                                  )
              )
              ("TCH_INDEXPOINTER" ((-4 "天正指向索引") (47 "天正比例") (10 "指向位置") (7 "文字样式") (40 "文字高度") (41 "圆圈直径")
                                   (70 "类型" ((0 "指向索引") (1 "剖切索引")))
                                  )
                                  ("FJ" ("FJ4" "索 引 号" (mai_dxf 1 slent)) ("fj5" "详 图 号" (mai_dxf 2 slent)) ;;(ATOF (mai_dxf 2 SLENT)) 去掉ATOF，支持字母
                                        ("FJ6" "上标文字" (mai_dxf 3 slent)) ("fj7" "下标文字" (mai_dxf 4 slent))
                                  )
              )
              ("TCH_MULTILEADER" ((-4 "天正引出标注") (47 "天正比例") (10 "引出位置") (1 "引注上标")
                                  (2 "引注下标") (7 "文字样式") (40 "文字高度") (41 "箭头大小")
                                  (70 "箭头样式" ((0 "无") (1 "圆点") (2 "箭头") (3 "箭头")))
                                  (71 "文字对齐" ((0 "在线上") (1 "在线端")))
                                 )
              )
              ("TCH_NORTHTHUMB" ((-4 "天正指北针") (47 "天正比例") (10 "圆心位置") (41 "直　　径") (50 "方向角度")))
              ("TCH_RUPTURE" ((-4 "天正折断线") (47 "天正比例") (10 "起　　点") (11 "终　　点") (70 "折断数目") (46 "布局转角")))
              ("TCH_SYMB_SECTION" ((-4 "天正剖切号") (47 "天正比例") (1 "文字内容") (7 "文字样式") (40 "文字高度") (50 "剖视方向")
                                   (70 "剖切形式" ((0 "断面剖切") (1 "剖面剖切")))
                                  )
              )
              ("TCH_AXIS_LABEL" ((-4 "天正轴号标注") (47 "天正比例") (7 "文字样式") (40 "引线长度") (41 "轴圈直径")))
              ("TCH_SHEET" ((-4 "天正表格") (47 "天正比例") (1 "标题文字") (40 "标准行高") (50 "旋转转角") (70 "表格行数") (71 "表格列数")
                              (72 "对齐方式" ((1 "左上") (3 "右上") (7 "左下") (9 "右下")))
                           )
              )
              ("TCH_SPACE" ((-4 "天正房间") (47 "天正比例") (10 "标注位置") (1 "房间名称") (2 "房间编号") (7 "文字样式")
                              (40 "文字高度") (50 "文字转角") (41 "房间面积") (42 "房间周长") (43 "地板厚度")
                           )
              )
              ("TCH_STEP" ((-4 "天正台阶") (47 "天正比例") (48 "底标高度") (40 "踏步高度") (41 "踏步宽度") (70 "踏步数目")))
              ("TCH_LINESTAIR" ((-4 "天正直线梯段") (47 "天正比例") (71 "踏步数目") (40 "踏步高度") (41 "剖线左位置")
                                (42 "剖线右位置") (43 "踏步宽度") (44 "梯段宽度") (50 "旋转角度")
                               )
              )
              ("TCH_ARCSTAIR" ((-4 "天正圆弧梯段") (47 "天正比例") (71 "踏步数目") (40 "踏步高度") (41 "剖线左位置") (42 "剖线右位置")
                                 (43 "内圆半径") (44 "外圆半径") (51 "圆 心 角") (10 "圆　　心") (50 "起始角度")
                              )
              )
              ("TCH_CURVESTAIR" ((-4 "天正任意梯段") (47 "天正比例") (71 "踏步数目") (40 "踏步高度") (41 "剖线左位置") (42 "剖线右位置") (48 "起点标高") (50 "左圆心角") (51 "右圆心角")))
              ("TCH_RECTSTAIR" ((-4 "天正双跑楼梯") (47 "天正比例") (40 "踏步高度") (41 "楼梯间宽")
                                (42 "平台宽度") (43 "踏步宽度") (44 "梯段宽度") (50 "旋转角度")
                                  (71 "一跑步数") (72 "二跑步数") (70 "楼梯标记" ((0 "首层") (1 "中间层") (2 "顶层")))
                                  (73 "起步一侧" ((0 "左侧") (1 "右侧"))) (74 "踏步取齐方式" ((0 "齐休息平台") (1 "齐中间") (2 "齐楼板")))
                               )
              )
              ("TCH_MULTISTAIR" ((-4 "天正多跑楼梯") (47 "天正比例") (40 "踏步高度") (42 "平台宽度") (43 "踏步宽度") (44 "梯段宽度")
                                   (70 "楼梯标记" ((0 "首层") (1 "中间层") (2 "顶层")))
                                 (71 "基线标记" ((0 "左边") (1 "右边")))
                              )
              )
              ("TCH_ASCENT" ((-4 "天正坡道") (47 "天正比例") (40 "坡道长度") (41 "坡道宽度") (42 "坡道高度") (43 "缩进宽度") (50 "旋转转角")))
              ("TCH_BALCONY" ((-4 "天正阳台") (47 "天正比例") (40 "栏板高度") (41 "栏板宽度") (42 "底板厚度") (43 "阳台梁厚") (412 "地面图层")))
              ("TCH_BLOCK_INSERT" ((-4 "天正图块") (47 "天正比例") (2 "图块名称") (41 "Ｘ轴比例") (42 "Ｙ轴比例") (43 "Ｚ轴比例") (50 "旋转角度")))
              ("TCH_COLUMN" ((-4 "天正柱子") (47 "天正比例") (49 "柱子高度") (70 "柱子形状" ((0 "异形柱") (1 "矩形") (2 "圆形")
                             (3 "正八角形") (4 "正六边形") (5 "正三角形") (6 "正五边形") (7 "正十二边形")))
                             (71 "柱子材料" ((40 "砖") (50 "石材") (60 "钢筋砼") (70 "钢材"))) (411 "填充图层")
                            )
              )
              ("TCH_SLOPEROOF" ((-4 "天正坡屋顶") (47 "天正比例") (10 "顶　　点") (48 "底 标 高") (51 "边 坡 度")))
              ("TCH_HANDRAIL" ((-4 "天正扶手") (47 "天正比例") (70 "扶手类型" ((0 "二维") (1 "栏板") (2 "矩形截面") (3 "圆形截面")))
                                 (71 "对齐方式" ((0 "中间") (1 "左") (2 "右"))) (40 "扶手高度") (41 "扶手宽度") (42 "矩形截面高度")
                              )
              )
              ("TCH_CABLETRY" ((-4 "天正桥架") (47 "天正比例")) 
                              ("FJ" ("FJ4" "桥架高度" (mai_get_property slent 'Height))
                                      ("FJ5" "桥架宽度" (mai_get_property slent 'Width))
                                      ("FJ6" "桥架型式" (mai_get_property slent 'Style))
                                      ("FJ7" "桥架型号" (mai_get_property slent 'Type))
                              )
              )
              ("TCH_EFITTING" ((-4 "天正桥架") (47 "天正比例")) 
                               ("FJ" ("FJ4" "桥架高度" (mai_get_property slent 'Height))
                                     ("FJ5" "桥架宽度" (mai_get_property slent 'Width))
                                     ("FJ6" "桥架型式" (mai_get_property slent 'Style))
                                     ("FJ7" "桥架型号" (mai_get_property slent 'Type))
                               )
              )
              ("TCH_DRAWINGNAME" ((-4 "天正图纸名称") (47 "天正比例") (1 "名称文字") (2 "比例文字") (40 "名称字高")))
              ("TCH_WIREDIM2" ((-4 "天正导线标注") (47 "天正比例") (7 "文字样式") (40 "文字高度")))
              ("TCH_EQUIPDIM2" ((-4 "天正设备标注") (47 "天正比例") (7 "文字样式") (40 "文字高度")))
              ("TCH_RECT" ((-4 "天正矩形") (10 "底面中心") (47 "天正比例") (50 "旋转角度") (40 "矩形长度") (41 "矩形宽度")
                             (70 "标　　记" ((0 "缺省") (1 "45度对角") (2 "135度对角") (3 "双 对 角")))
                          )
              )
            
              ("SWR_DIMENSION2" ((-4 "斯维尔尺寸") (47 "斯维比例")))
              ("SWR_WALL" ((-4 "斯维尔墙体") (47 "斯维比例") (40 "左侧宽度") (41 "右侧宽度") (42 "面层厚度") (50 "圆心角度") ;;(47 "斯维比例"))
                             (76 "门窗数目") (73 "内墙外墙" ((0 "内墙") (1 "外墙")))
                           (74 "墙体材料" ((10 "轻型隔断") (20 "幕墙") (40 "砖墙") (50 "石材") (60 "钢筋砼")))
                          )
                          ("FJ" ("FJ4" "墙体高度" (mai_dxf 39 slent)) ("FJ5" "墙体总宽" (+ (mai_dxf 40 slent) (mai_dxf 41 slent))))
              )
              ("SWR_ELEVATION" ((-4 "斯维尔标高") (47 "斯维比例") (10 "标高位置")(1 "标高文字")(7 "文字样式")(40 "文字高度"))
                               ("FJ" ("FJ4" "标高数值" (atof (mai_dxf 1 slent))))
              )
              ("SWR_TEXT" ((-4 "斯维尔文字") (47 "斯维比例") (10 "文字位置") (1 "文字内容") (7 "文字样式") (40 "文字字高") (50 "旋转角度") 
                           (70 "控制标记" ((0 "不屏蔽背景") (1 "屏蔽背景")))
                             (72 "对齐方式" ((1 "左上") (2 "中上") (3 "右上") (4 "左中") (5 "正中") (6 "右中") (7 "左下")
                                           (8 "中下") (9 "右下") (10 "左(基线)") (11 "中心(基线)") (12 "右(基线)") (13 "中间")
                                          )
                           )
                          )
              )
              ("SWR_MTEXT" ((-4 "斯维尔多行文字") (47 "斯维比例") (1 "文字内容") (7 "文字样式") (40 "文字高度")
                            (50 "旋转角度") (41 "页面宽度") (42 "行 间 距")
                              (70 "控制标记" ((0 "不屏蔽背景") (1 "屏蔽背景")))
                            (72 "对齐方式" ((10 "左(基线)") (11 "中心(基线)") (12 "右(基线)") (14 "两端")))
                           )
              )
              ("SWR_PIPE" ((-4 "斯维尔管道") (47 "斯维比例") (280 "其　　他") (301 "标　　注")))
              ;;("SWR_MULTILEADER" ((-4 "斯维尔引注") (47 "斯维比例") (1 "引注上标") (2 "引注下标")))
              ("SWR_OPENING" ((-4 "斯维尔门窗") (47 "斯维比例") (11 "编号位置") (302 "门窗编号") (40 "门窗宽度") (41 "门窗高度")
                              (43 "窗套距离") (44 "窗套宽度") (50 "文字转角") (51 "窗圆心角")
                              (71 "门窗类型" ((0 "门") (1 "窗") (2 "洞") (3 "弧窗") (4 "凸窗") (5 "转角窗") (6 "门联窗") (7 "子母门")))
                              (73 "凸窗类型" ((1 "梯形") (2 "三角形") (3 "拱形") (4 "矩形")))
                              (7 "文字样式")
                             )
              )
              ("SWR_ARROW" ((-4 "斯维尔箭头标注") (47 "斯维比例") (11 "文字位置") (1 "文字内容") (7 "文字样式") (40 "文字高度") (41 "箭头大小")
                              (70 "文字对齐" ((1 "在线端") (2 "在线中") (3 "齐线端")))
                           )
              )
              ("SWR_RADIUSDIM" ((-4 "斯维尔半径标注") (47 "斯维比例") (10 "圆心位置") (3 "标注样式"))
                               ("FJ" ("FJ4" "标注文字" (mai_get_property slent 'TEXT)))
              )
              ("SWR_CURTAIN_WALL" ((-4 "斯维尔玻璃幕墙") (47 "斯维比例") (78 "水平分格") (79 "竖直分格") (148 "横框间距")
                                   (149 "竖挺间距") (415 "玻璃图层") (416 "横框图层") (417 "竖挺图层")
                                  )
              )
              ("SWR_CORNER_WINDOW" ((-4 "斯维尔转角窗") (47 "斯维比例") (10 "位　　置") (11 "编号位置") (302 "门窗编号") (40 "门窗宽度1")
                                    (41 "门窗宽度2") (42 "门窗高度") (140 "文字高度") (44 "窗套宽度") (50 "文字转角") (7 "文字样式")
                                   )
              )
              ("SWR_DORMER" ((-4 "斯维尔老虎窗") (47 "斯维比例") (7 "文字样式") (10 "窗台位置") (11 "编号位置") (302 "门窗编号") (40 "文字高度")
                             (50 "法　　向") (140 "出檐长度") (141 "出山长度") (142 "坡　　度") (148 "窗　　高") (144 "窗　　宽")
                               (70 "类　　型" ((0 "三角坡") (1 "双坡") (2 "三坡") (3 "梯形坡") (4 "平顶窗")))
                             (71 "是否显示" ((0 "不显示") (1 "显示")))
                            )
              )
              ("SWR_SYMMETRY" ((-4 "斯维尔对称轴") (47 "斯维比例") (10 "起 始 点") (11 "终 止 点") (40 "距　离 a") (41 "距　离 b") (42 "距　离 c")))
              ("SWR_COMPOSING" ((-4 "斯维尔作法标注") (47 "斯维比例") (1 "文字内容") (7 "文字样式") (40 "文字高度") (41 "引线长度")
                                (70 "文字对齐" ((0 "在线上") (1 "在线端")))
                               )
              )
              ("SWR_COORD" ((-4 "斯维尔坐标标注") (47 "斯维比例") (10 "标 注 点") (41 "X 坐标值") (42 "Y 坐标值") (7 "文字样式") (40 "文字高度")
                              (70 "控制标记" ((0 "XY方式,三位精度") (1 "AB方式,三位精度") (2 "XY方式,两位精度") (3 "AB方式,二位精度")))
                              (71 "标注方向" ((0 "第一象限") (1 "第二象限") (2 "第三象限") (3 "第四象限")))
                           )
              )
              ("SWR_DRAWINGINDEX" ((-4 "斯维尔索引图名") (47 "斯维比例") (10 "圆心位置") (1 "索引编号") (7 "文字样式")
                                   (40 "文字高度") (41 "圆圈直径") (42 "线　　粗")
                                  )
              )
              ("SWR_INDEXPOINTER" ((-4 "斯维尔指向索引") (47 "斯维比例") (10 "指向位置") (7 "文字样式") (40 "文字高度") (41 "圆圈直径")
                                     (70 "类型" ((0 "指向索引") (1 "剖切索引")))
                                  )
                                  ("FJ" ;;("FJ1" "显示颜色" (ss_getcolor slent))
                                          ("FJ4" "索 引 号" (mai_dxf 1 slent)) ("FJ5" "详 图 号" (mai_dxf 2 slent))
                                          ("FJ6" "上标文字" (mai_dxf 3 slent)) ("FJ7" "下标文字" (mai_dxf 4 slent))
                                  )
              )
              ("SWR_MULTILEADER" ((-4 "斯维尔引出标注") (47 "斯维比例") (10 "引出位置") (1 "引注上标")
                                  (2 "引注下标") (7 "文字样式") (40 "文字高度") (41 "箭头大小")
                                    (70 "箭头样式" ((0 "无") (1 "圆点") (2 "箭头") (3 "箭头")))
                                  (71 "文字对齐" ((0 "在线上") (1 "在线端")))
                                  )
              )
                      ;;("FJ" ;;("FJ1" "显示颜色" (ss_getcolor slent))
              ;;      ("FJ2" "上标文字" (mai_dxf 1 SLENT)) ("FJ3" "下标文字" (mai_dxf 2 SLENT))) ) 
              ("SWR_NORTHTHUMB" ((-4 "斯维尔指北针") (47 "斯维比例") (10 "圆心位置") (41 "直　　径") (50 "方向角度")))
              ("SWR_RUPTURE" ((-4 "斯维尔折断线") (47 "斯维比例") (10 "起　　点") (11 "终　　点") (70 "折断数目") (46 "布局转角")))
              ("SWR_SYMB_SECTION" ((-4 "斯维尔剖切号") (47 "斯维比例") (1 "文字内容") (7 "文字样式") (40 "文字高度") (50 "剖视方向")
                                   (70 "剖切形式" ((0 "断面剖切") (1 "剖面剖切")))
                                  )
              )
              ("SWR_AXIS_LABEL" ((-4 "斯维尔轴号标注") (47 "斯维比例") (7 "文字样式") (40 "引线长度") (41 "轴圈直径")))
              ("SWR_SHEET" ((-4 "斯维尔表格") (47 "斯维比例") (1 "标题文字") (40 "标准行高") (50 "旋转转角") (70 "表格行数") (71 "表格列数")
                              (72 "对齐方式" ((1 "左上") (3 "右上") (7 "左下") (9 "右下")))
                           )
              )
              ("SWR_SPACE" ((-4 "斯维尔房间") (47 "斯维比例") (10 "标注位置") (1 "房间名称") (2 "房间编号") (7 "文字样式")
                            (40 "文字高度") (50 "文字转角") (41 "房间面积") (42 "房间周长") (43 "地板厚度")
                           )
              )
              ("SWR_STEP" ((-4 "斯维尔台阶") (47 "斯维比例") (48 "底标高度") (40 "踏步高度") (41 "踏步宽度") (70 "踏步数目")))
              ("SWR_LINESTAIR" ((-4 "斯维尔直线梯段") (47 "斯维比例") (71 "踏步数目") (40 "踏步高度") (41 "剖线左位置")
                                (42 "剖线右位置") (43 "踏步宽度") (44 "梯段宽度") (50 "旋转角度")
                               )
              )
              ("SWR_ARCSTAIR" ((-4 "斯维尔圆弧梯段") (47 "斯维比例") (71 "踏步数目") (40 "踏步高度") (41 "剖线左位置") (42 "剖线右位置")
                                 (43 "内圆半径") (44 "外圆半径") (51 "圆 心 角") (10 "圆　　心") (50 "起始角度")
                              )
              )
              ("SWR_CURVESTAIR" ((-4 "斯维尔任意梯段") (47 "斯维比例") (71 "踏步数目") (40 "踏步高度") (41 "剖线左位置")
                                 (42 "剖线右位置") (48 "起点标高") (50 "左圆心角") (51 "右圆心角")
                                )
              )
              ("SWR_RECTSTAIR" ((-4 "斯维尔双跑楼梯") (47 "斯维比例") (40 "踏步高度") (41 "楼梯间宽") (42 "平台宽度")
                                (43 "踏步宽度") (44 "梯段宽度") (50 "旋转角度") (71 "一跑步数") (72 "二跑步数")
                                (70 "楼梯标记" ((0 "首层") (1 "中间层") (2 "顶层")))
                                (73 "起步一侧" ((0 "左侧") (1 "右侧")))
                                  (74 "踏步取齐方式" ((0 "齐休息平台") (1 "齐中间") (2 "齐楼板")))
                               )
              )
              ("SWR_MULTISTAIR" ((-4 "斯维尔多跑楼梯") (47 "斯维比例") (40 "踏步高度") (42 "平台宽度") (43 "踏步宽度") (44 "梯段宽度")
                                   (70 "楼梯标记" ((0 "首层") (1 "中间层") (2 "顶层")))
                                 (71 "基线标记" ((0 "左边") (1 "右边")))
                                )
              )
              ("SWR_ASCENT" ((-4 "斯维尔坡道") (47 "斯维比例") (40 "坡道长度") (41 "坡道宽度") (42 "坡道高度") (43 "缩进宽度") (50 "旋转转角")))
              ("SWR_BALCONY" ((-4 "斯维尔阳台") (47 "斯维比例") (40 "栏板高度") (41 "栏板宽度") (42 "底板厚度") (43 "阳台梁厚") (412 "地面图层")))
              ("SWR_BLOCK_INSERT" ((-4 "斯维尔图块") (47 "斯维比例") (2 "图块名称") (41 "Ｘ轴比例") (42 "Ｙ轴比例") (43 "Ｚ轴比例") (50 "旋转角度")))
              ("SWR_COLUMN" ((-4 "斯维尔柱子") (47 "斯维比例") (49 "柱子高度")
                             (70 "柱子形状" ((0 "异形柱") (1 "矩形") (2 "圆形") (3 "正八角形") (4 "正六边形") (5 "正三角形") (6 "正五边形") (7 "正十二边形")))
                             (71 "柱子材料" ((40 "砖") (50 "石材") (60 "钢筋砼") (70 "钢材")))
                             (411 "填充图层")
                            )
              )
              ("SWR_SLOPEROOF" ((-4 "斯维尔坡屋顶") (47 "斯维比例") (10 "顶　　点") (48 "底 标 高") (51 "边 坡 度")))
              ("SWR_HANDRAIL" ((-4 "斯维尔扶手") (47 "斯维比例")
                               (70 "扶手类型" ((0 "二维") (1 "栏板") (2 "矩形截面") (3 "圆形截面")))
                                 (71 "对齐方式" ((0 "中间") (1 "左") (2 "右")))
                               (40 "扶手高度") (41 "扶手宽度") (42 "矩形截面高度")
                            )
              )
              ("SWR_CABLETRY" ((-4 "斯维尔桥架") (47 "斯维比例")) 
                              ("FJ" ;;("FJ1" "显示颜色" (ss_getcolor slent))
                                     ("FJ4" "桥架高度" (mai_get_property slent 'Height))
                                     ("FJ5" "桥架宽度" (mai_get_property slent 'Width))
                                     ("FJ6" "桥架型式" (mai_get_property slent 'Style))
                                     ("FJ7" "桥架型号" (mai_get_property slent 'Type))
                              )
              )
              ("SWR_EFITTING" ((-4 "斯维尔桥架") (47 "斯维比例")) 
                              ("FJ" ;;("FJ1" "显示颜色" (ss_getcolor slent))
                                     ("FJ4" "桥架高度" (mai_get_property slent 'Height))
                                     ("FJ5" "桥架宽度" (mai_get_property slent 'Width))
                                     ("FJ6" "桥架型式" (mai_get_property slent 'Style))
                                     ("FJ7" "桥架型号" (mai_get_property slent 'Type))
                              )
              )
              ("SWR_DRAWINGNAME" ((-4 "斯维尔图纸名称") (47 "斯维比例") (1 "名称文字") (2 "比例文字") (40 "名称字高")))
              ;;("TCH_PIPEVALVE" ((-4 "块名") (2 "天正")))
            ) 
    );;setq lst2
    (setq lst5 (assoc (mai_dxf 0 entl) lst2)  ;;样本实体特性表
          lst3 lst5  ;;通用附加过滤表
          lst4 (caddr lst5) ;;附加表
          lst6 (append (cadr (mai_dxf "GLOBAL" lst2)) (cdr lst4))
          lst6 (subst (list "FJ1" "显示颜色" '(ss_getcolor slent)
                            (if (setq tmp (assoc (ss_getcolor slent) color_lst))
                                (cons tmp (vl-remove tmp color_lst))
                                (cons (last color_lst) (mai_rcdr color_lst))
                            )
                      )  
                      '("FJ1" "显示颜色")
                      lst6
                )
          tmp (ss_linetype slent)
          lst6 (subst (list "FJ2" "显示线型" '(ss_linetype slent) 
                            (list (list tmp tmp) ;;显示线型排第一个，提高显示速度
                                  (list (mai_dxf 6 slent) "实体线型")
                                  '("*" "所有线型") 
                                  (list (getvar "celtype") "当前线型")
                                  '((ss_sel_lay "线型多选" lin_lst "txtFJ2") "线型多选...")
                            )
                      )  
                      '("FJ2" "显示线型")
                      lst6
                )   ;;=========V1.25============
          lst6 (subst (list "FJ4" "标注样式" '(mai_dxf 3 slent) 
                            (list  ;;显示样式排第一个，提高显示速度
                                 (list (mai_dxf 3 slent) "实体样式")
                                 '("*" "所有样式")
                                 (list (getvar "dimstyle") "当前样式")
                                 '((ss_sel_lay "标注样式多选" dims_lst "txtFJ3") "标注样式多选...")
                            )
                      )  
                      '("FJ4" "标注样式" (mai_dxf 3 slent)) ;;****v1.26替换leader的标注样式
                      lst6
               )
          lst6 (subst (list "FJ7" "文字颜色"
                            '(mai_get_property slent 'TextColor)
                             (if (setq tmp (assoc (mai_get_property slent 'TextColor) color_lst))
                                 (cons tmp (vl-remove tmp color_lst))
                                 (cons (last color_lst) (mai_rcdr color_lst))
                             )
                      )  
                      '("FJ7" "文字颜色") ;;****v1.27替换标注文字颜色
                      lst6
               )
          lst6 (subst (list "FJ9" "文字样式"
                            '(mai_get_property slent 'TextStyle)
                             (list (list (mai_get_property slent 'TextStyle) "实体样式")
                                   '("*" "所有样式")
                                   (list (getvar "textstyle") "当前样式")
                                   '((ss_sel_lay "文字样式多选" sty_lst "txtFJ8") "文字样式多选...")
                             )
                      )  
                      '("FJ9" "文字样式") ;;****v1.27替换标注文字样式
                      lst6
               )
          ;;lst5 (subst lst6 lst4 lst5)
          ;;lst2 (subst lst5 lst3 lst2)
          tmp (groupnames slent)
  );;setq
  (if tmp
      (setq grpsl1 (mapcar 'car tmp)  ;;;****** 变量在ss_sel_lay函数中需要用到
            grpsl3 (mapcar '(lambda (x) (list (cdr x) (car x))) tmp)
            lst6 (subst (list "FJ3" "实体编组"
                              '(cdar (groupnames slent))  ;;这里是临时表达式，不在过滤时使用
                               (vl-list* (car grpsl3)
                                         (list (list 'ss_sel_lay "实体编组多选" (list 'quote grps_lst) "txtFJ3") "编组多选...")
                                         (cdr grpsl3)
                               )
                        )
                        '("FJ3" "实体编组")
                        lst6
                 )
      )
  )
  (setq lst5 (if lst4 (subst lst6 lst4 lst5) (mai_cons_last lst6 lst5))
        lst2 (subst lst5 lst3 lst2)
        tmp (mai_dxf 0 slent)
  )
  (cond ((= "TEXT" tmp)
         (setq inf_wid "28" txta_wid "28.3")
         (ss_add_text_fj "TEXT")
        )
        ((= "MTEXT" tmp) (ss_add_text_fj "MTEXT"))
        ((= "INSERT" tmp) (ss_kldc_1) (ss_dynamicblk))
  )
           ;;对块实体，增加属性过滤表，slent及lst2作为全局变量传递;;(= attdis "Y")
           ;;(= dblkdis "Y")  v1.26修改到函数内判断
        
  (setq lst3 (car (mai_dxf "GLOBAL" lst2)) 
        lst5 (mai_dxf tmp lst2) 
        lst4 (car lst5) 
        lst5 (cadr lst5) 
  )
  (or lst5 (setq lst5 lst6)) ;实体类型未定义时，通用过滤的附加过滤表保留
  (setq lst3 (vl-remove-if
               '(lambda(x)
                    (setq x (car x))
                    (and (not (mai_dxf x entl))
                         (/= x 62)
                    )
                )
                lst3
             )
        lst3 (subst (list 6 "实体线型"
                         (list (list (mai_dxf 6 slent) "实体线型")
                               '("*" "所有线型") 
                               (list (getvar "celtype") "当前线型")
                               '((ss_sel_lay "线型多选" lin_lst "txt6") "线型多选...")
                         )
                    )  
                    '(6 "实体线型")
                    lst3
             )
        lst3 (subst (list 62 "实体颜色"
                          (if (setq tmp (assoc (mai_dxf 62 slent) color_lst))
                              (cons tmp (vl-remove tmp color_lst))
                              (cons (last color_lst) (mai_rcdr color_lst))
                          );;if
                    )  
                    '(62 "实体颜色")
                    lst3
             )
        appid_lst (mai_tblsearch "appid")
        str_xdata (ss_get_appn slent)
        lst3 (subst (list -3 "扩展数据"
                          (list (if str_xdata (list str_xdata "实体应用名称"))
                                '("*" "所有应用名称")
                                '((ss_sel_lay "应用名称多选" appid_lst "txt-3") "应用名称多选...")
                          )
                    )  
                    '(-3 "扩展数据")
                    lst3
             )
  )
  (foreach tmp (cdr lst4)  ;;****v1.26 对lst4中的info表重新排序，提高显示速度
    (setq code (car tmp)
          tmp1 (caddr tmp)
    ) 
    (and (mai_dxf code entl)
         (= (type tmp1) 'LIST)
         (setq ktmp (assoc (mai_dxf code entl) tmp1))
         (setq lst4 (subst (subst (cons ktmp (vl-remove ktmp tmp1)) tmp1 tmp)
                           tmp
                           lst4
                    )
         )
    )
  );;foreach
  (setq lines (> (+ (length lst3) (length lst4) (length lst5)) 20)  ;;-----------v1.29分两列，计算行数
        dcl_name (strcat (getenv "temp") "\\sel.dcl") 
        f (open dcl_name "w")
  ) 
  (write-line "sl:dialog{label=\"我的选择易v1.31--By 小菜\";" f) 
  (write-line ":column{" f)
  (if lines (write-line ":boxed_row{children_alignment=top;" f))  ;;;-------------------v1.29 分两列
  (write-line ":boxed_column{label=\"过滤条件\";" f)
  (if lines (write-line "fixed_height=true;" f))  ;;---------------v1.29 分两列-----
  (write-line ":boxed_column{label=\"通用\";" f)
  (foreach tmp lst3 
     (setq tmp2 (car tmp)
           ktmp (itoa tmp2)
     )
     (write-line ":row{fixed_width=true;" f) 
     (write-line (strcat ":toggle{key=\"" ktmp "\";label=\"" (cadr tmp) "\";width=" tog_wid ";}") f) 
     (write-line (strcat ":popup_list{edit_width=" pop_wid ";key=\"pop" ktmp "\";" (ss_mk_pop_txt tmp2 (mai_dxf tmp2 slent))"}") f) 
     (setq ktmp (list (strcat "pop" ktmp) ktmp)
           tmp1 (if (= -3 tmp2) str_xdata (vl-princ-to-string (mai_dxf tmp2 entl)))
           ktmp (ss_write f ktmp tmp2 tmp1 "txt" "16")
     )
     (cond ((member tmp2 '(48 370)) (setq ktmp (ss_write f ktmp tmp2 "容差" "txta" txta_wid)))
           ((member tmp2 '(0 6 8 62 -3)) (ss_write_inf tmp2 lst3))
     );;cond 
     (write-line "}" f)
     (setq klst (cons (reverse ktmp) klst)) 
  );;foreach 
  (write-line "}" f) 
  (write-line (strcat ":boxed_column{label=\"" (vl-princ-to-string (car (mai_dxf -4 lst4))) "\";") f) 
  (setq lst4 (cdr lst4) ;;去掉前面的-4组码 ;;
        lst4 (subst (list 7 "文字样式"
                         (list (list (mai_dxf 7 slent) "实体样式")
                               '("*" "所有样式")
                               (list (getvar "textstyle") "当前样式")
                               '((ss_sel_lay "文字样式多选" sty_lst "txt7") "文字样式多选...")
                         )
                    )
                    '(7 "文字样式")
                    lst4
             )
        lst4 (subst (list 3 "标注样式"
                          (list (list (mai_dxf 3 slent) "实体样式")
                               '("*" "所有样式")
                                (list (getvar "dimstyle") "当前样式")
                                '((ss_sel_lay "标注样式多选" dims_lst "txt3") "标注样式多选...")
                           )
                    )
                    '(3 "标注样式")
                     lst4
             )
  );;setq
  (foreach tmp lst4 
    (setq code (car tmp)
          ktmp nil
    ) 
    (if (mai_dxf code entl)
        (progn 
           (write-line ":row{fixed_width=true;" f) 
           (setq tmp1 (itoa code)
                 ktmp (list (strcat "pop" tmp1) tmp1)
           ) 
           (write-line (strcat ":toggle{key=\"" tmp1 "\";label=\"" (vl-princ-to-string (cadr tmp)) "\";width=" tog_wid ";}") f) 
           (write-line (strcat ":popup_list{edit_width=" pop_wid ";key=\"pop" tmp1 "\";" (ss_mk_pop_txt code (mai_dxf code slent)) "}") f) 
           (setq tmp1 (mai_dxf code entl))
           (cond ((member code '(10 11 12 13))
                  (setq ktmp (ss_write f ktmp code (vl-princ-to-string (car tmp1)) "txt_x" "6.5")
                        ktmp (ss_write f ktmp code (vl-princ-to-string (cadr tmp1)) "txt_y" "6")
                        ktmp (ss_write f ktmp code (vl-princ-to-string (caddr tmp1)) "txt_z" txta_wid)
                  ) 
                 ) 
                 ((member code '(1 2 3 7 90 38 39 40 41 42 43 44 47 50 51 52 66 70 71 72 73 74 76 302 280)) ;;;===v1.15 加66组码
                  (setq ktmp (ss_write f ktmp code (ss_cltpf (vl-princ-to-string tmp1) t t) "txt" "16")) ;;原strtmp=(vl-princ-to-string (mai_dxf code entl))
                  (cond ((member code '(38 39 40 41 42 43 44 47 50 51 52))
                         (setq ktmp (ss_write f ktmp code "容差" "txta" txta_wid))
                        )
                        ((member code '(1 3 7)) (if (cadr (mai_dxf code lst4)) (ss_write_inf code lst4)))
                        ((member code '(66 70 71 72 73 74 76 280)) ;;;===v1.15 加66组码
                         (if (cadr (assoc tmp1 (caddr (assoc code lst4))))
                             (ss_write_inf code lst4)
                         );if 
                        ) 
                  );;cond 
                 )
                 ((= (type tmp1) 'STR)   ;;---------------------v1.09
                  (setq ktmp (ss_write f ktmp code (ss_cltpf (vl-princ-to-string tmp1) t t) "txt" "16"))
                 )    ;;---------------------v1.09
                 ((member (type tmp1) (list 'INT 'REAL))
                  (setq ktmp (ss_write f ktmp code (vl-princ-to-string tmp1) "txt" "16")
                        ktmp (ss_write f ktmp code "容差" "txta" txta_wid)
                  )
                 )    ;;---------------------v1.09
            );;cond 
            (write-line "}" f) 
        );progn
    ); & if 
    (if ktmp (setq klst (cons (reverse ktmp) klst)))
  );;foreach 
  (write-line "}" f)
     (if lines (write-line ":image {color = dialog_background ;height = 0.01 ;}}" f)) ;;---------------v1.29 分两列-----
     (if lst5
        (progn
            (setq lst5 (cdr lst5)) ;;去掉lst5第一个元素"FJ"
            (write-line ":boxed_column{label=\"附加过滤\";" f)
            (if lines (write-line "fixed_height = true;" f))  ;;---------------v1.29 分两列--------
            (foreach tmp lst5
               (if (setq eval_value (eval (caddr tmp)))
                   (progn
                        (setq tmp2 (car tmp))
                        (write-line ":row{fixed_width=true;" f)
                        (write-line (strcat ":toggle{key=\"" tmp2 "\";label=\"" (cadr tmp) "\";width=" tog_wid ";}") f) 
                        (write-line (strcat ":popup_list{edit_width=" pop_wid ";key=\"pop" tmp2 "\";"
                                           (ss_mk_pop_txt "SS_FJ" (eval (caddr (assoc tmp2 lst5)))) "}"
                                    )
                                    f
                        ) 
                        (setq ktmp (list (strcat "pop" tmp2) tmp2)
                              ktmp (ss_write f ktmp tmp2
                                       (ss_cltpf (if (= 'STR (type eval_value)) eval_value (vl-princ-to-string eval_value)) t nil)
                                       "txt" "16"
                                   )
                              tmp1 (cadddr (assoc tmp2 lst5))
                        )
                        (cond ((= (type tmp1) 'LIST)
                               (write-line (strcat ":popup_list{key=\"inf" (vl-princ-to-string tmp2) "\";edit_width=" inf_wid ";"
                                                    (ss_mk_pop_txt "LST2TXT" (mapcar 'cadr tmp1)) "}"
                                           )
                                           f
                               )
                               (setq pop_lst (cons (list tmp2 tmp1) pop_lst))
                              )
                              ((member (type (eval (caddr (assoc tmp2 lst5)))) '(int real))
                               (setq ktmp (ss_write f ktmp tmp2 "容差" "txta" txta_wid))
                              )
                        )
       
                        ;;;===========v1.16
                        (setq fjlst (cons (reverse ktmp) fjlst))  ;;fjlst是附加过滤条件的变量表 
                        (write-line "}" f)
                    )
                );;if
            );;foreach 
            (write-line "}" f)
        )
     );if lst5
;;-----------以下v1.29增加--------------
     (write-line "}}" f)
     (write-line ":image {color = dialog_background ;height = 0.01 ;}" f)  
     (write-line (strcat ":row {alignment=centered;fixed_width=true;"
                         ":button{" (if (= hand "1") "is_default=true;" "") "key=\"hand\";label=\"手选&S\";width=12;}"
                 )
                 f
     )
     (write-line (strcat ":button{" (if (= hand "3") "is_default=true;" "") "key=\"all\";label=\"全选&A\";width=12;}"
                         ":button{" (if (= hand "2") "is_default=true;" "") "key=\"per\";label=\"预选&D\";width=12;}"
                 )
                 f
     )
     (write-line (strcat ":button{is_cancel=true;fixed_width=true;width=12; key=\"cancel\";label=\"取消&C\";}"
                         ":button{fixed_width=true;width=12; key=\"add\";label=\"附加&V>>\";}"
                 )
                 f
     )
     (write-line "}}" f)
;;-----------以上v1.29增加--------------     
     (close f) 
     (setq klst (reverse klst))
     (while flag   ;;;======
        (setq flag nil
              index_value (load_dialog dcl_name)
        ) ;_加载dcl文件 
        (new_dialog "sl" index_value)  ;_开始新对话框 
        (foreach tmp klst  ;;klst为变量表，第三项开始含有变量名及初始值 
           (setq tmp1 (read (car tmp))
                 ktmp (mai_dxf tmp1 entl)
           )
           (and (= (type ktmp) 'STR)
                (= (car tmp) "1")
                (= "TEXT" (mai_dxf 0 entl))
                (> (strlen ktmp) 224)
                (set_tile (caaddr tmp) (ss_cltpf ktmp nil t))  ;;cltpf用nil参数，不处理 ";
            )
            ;;-------------v1.10 文字超长时初始显示不完整，在此重新设置编辑框内的文字
        )  ;;foreach 显示下拉选单信息 
        
        (princ "\naaa")
        (foreach tmp fjlst
            (setq tmp1 (eval (caddr (assoc (car tmp) lst5))))
            (and (= (type tmp1) 'STR)
                 (> (strlen tmp1) 224)  ;===v1.20判断长度后重设字符，提高速度
                 (setq tmp1 (caddr tmp))
                 (set_tile (car tmp1) (cadr tmp1))
                    ;;-------------v1.10 文字超长时初始显示不完整，在此重新设置编辑框内的文字 
             )
        );;foreach
        ;;;;fjlst是附加过滤条件的变量表,如：'(("FJ3" "popFJ3" ("txtFJ3" "0.0") ("txtaFJ3" "容差")) ("FJ2" "popFJ2" ("txtFJ2" "0.0") 
                                            ;;("txtaFJ2" "容差")) ("FJ1" "popFJ1" ("txtFJ1" "0.0") ("txtaFJ1" "容差"))) ;;
        (foreach tmp pop_lst ;;;===============v1.16
            (setq tmp2 '(acad_colordlg ss_sel_lay)
                  lst6 (mapcar '(lambda (x)
                                   (setq x (car x))
                                   (if (and (= (type x) 'LIST)
                                            (not (member (car x) tmp2))
                                       )
                                       (eval x)
                                       x
                                   )
                                )
                                (cadr tmp)
                       )
                  ;;****v1.26 修改tmp1计算方式，考虑到实数的误差，get_tile得到的文字转换后不相等;
                 tmp_str (mai_All2Str (car tmp))
                 tmp2 (strcat "inf" tmp_str)
                 tmp1 (vl-position (get_tile (strcat "txt" tmp_str)) (mapcar 'vl-princ-to-string lst6)) ;;全部转换为字符后判断
            )
            (and (/= (get_tile tmp2) (itoa (if tmp1 tmp1 (1- (length lst6)))))
                 (setq tmp1 (if tmp1 tmp1 (vl-position 'list (mapcar 'type lst6))))
                 (set_tile tmp2 (itoa tmp1)) ;;;******v1.26
            )
            (action_tile tmp2 (strcat "(ss_settxt1 $value \"txt" tmp_str "\" \"inf" tmp_str "\" '" (mai_All2Str (cadr tmp)) ")"))
        );;foreach  ;;;===============v1.16
        (foreach tmp kl_tmp
            (setq tmp (caddr tmp))
            (set_tile (car tmp) (cadr tmp))
        )  ;;附加选中的实体特性添加到对话框中
       (if kl_pre 
            (foreach tmp (cdr kl_pre)
                (and (setq tmp1 (cadddr tmp))
                     (member (car tmp) '("48" "370"))
                     (set_tile (car tmp1) (cadr tmp1))
                )
                            ;;附加通用过滤表容差部分设置;;---------v1.29--增加容差功能--------
                (if (= (mai_dxf 0 entl) (car kl_pre))
                    (progn ;;;-------------------v1.29--增加容差功能--------
                        (set_tile (car tmp) "1") ;;同类实体，全部设置;
                        (and tmp1
                            (or (member (car tmp) '("38" "39" "40" "41" "42" "43" "44" "47" "50" "51" "52"))
                                (member (type (eval (caddr (assoc (car tmp) lst5)))) '(int real))
                            )
                            (set_tile (car tmp1) (cadr tmp1))
                                       ;lst5是附加过滤表 ;(cadddr tmp)对于FJ1是nil，跳过颜色误差设置
                        )
                    );progn  ;;;----------------v1.29---------- 同类实体
                    (if (member (car tmp) '("0" "6" "8" "47" "48" "62" "370" "FJ1" "FJ2"))
                        (set_tile (car tmp) "1")
                    ) ;;else if ;不同实体，仅设置通用组
                );;end if 
            );;foreach 
        ) ;;把上次选中的复选框设为选中状态 ;

        (action_tile "hand" "(ss_get_filter) (done_dialog 1)")  ;;;-------------v1.29
        (action_tile "all" "(ss_get_filter) (done_dialog 3)")   ;;;-------------v1.29
        (action_tile "per" "(ss_get_filter) (done_dialog 2)")   ;;;-------------v1.29 
        (action_tile "cancel" "(done_dialog 4)")  ;;;====
        (action_tile "add" "(ss_add_filter) (done_dialog)") ;;;====
        (setq tmp (start_dialog))    ;;;=== ;;;-------------v1.29
        (unload_dialog index_value)
        (if (> 4 tmp 0) (setq hand (itoa tmp)))
        (if flag (ss_add_filter1))
     );;while
   );;end if slent progn ;;;-----------------------1
 
   (mapcar 'set '(hand fjflt filter) ss_saved_lst) ;;else if slent 未选样本实体时，采用保存的过滤器
);;end if;;;;--------------------------1

  (if filter
     (progn (princ "\n使用过滤器：") 
            (princ (vl-prin1-to-string filter)) 
            (cond ((= hand "1") (setq ss (ssget filter))) 
                  ((= hand "2") (setq ss (ssget "p" filter))) 
                  ((= hand "3") (setq ss (ssget "x" filter))) 
            );;cond 
      )
  );;end if filter 
  (and (setq ssl (mai_ssget_2_list ss))
       fjflt
       (progn  ;;------2009.10.08
          (princ "\n附加过滤器：") 
          (princ (if (< (atof (getvar "ACADVER")) 17.1) (vl-prin1-to-string fjflt) fjflt)) ;;2008如果有很长的mtext，vl-prin1-to-string会死机
          (or (eval fjflt)
              (foreach slent ssl (ssdel slent ss))
          )
       );;------2009.10.08 显示附加过滤器
  );;end and
  (or (= tmp 4) (setq ss_saved_lst (list hand fjflt filter kl_pre))) ;;保存至全局变量
  (setq tmp (strcat mai_mini_path "用户设置\\ss_filter.lsp")  ;;;-------v1.29 保存至文件
        f (open tmp "w")
  )
  (write-line "(setq ss_saved_lst '" f)
  (write-line (vl-prin1-to-string ss_saved_lst) f)
  (write-line ")" f)
  (close f) ;;;-------v1.29 保存至文件
  (if (and ss (> (setq tmp (sslength ss)) 0))
      (progn
         (princ (strcat "\n共选中了" (itoa tmp) "个实体。"))
         (while (/= 0 (getvar "cmdactive")) (command ""))
         (command "._select" ss "" "._pselect" ss "")
      )
      (princ "\n共选中了0个实体。")
  );;if
  ss
);;defun



(defun ss_settxt1 ( n key_txt key_inf lst / i tmp lable)
   (setq i (car (nth (atoi n) lst))
         lable (last (last lst))   ;;;*********v1.26 
   )
   (cond ((= lable "属性标志多选...") (setq att_tag nil))    ;;;*********v1.26 初始化变量
         ((= lable "属性数值多选...") (setq att_value nil))
         ((= lable "属性多选...") (setq att_sel nil))
         ((= lable "特性多选...") (setq dblk_sel nil))
         ((= lable "动态名称多选...") (setq dblk_name nil))
         ((= lable "动态数值多选...") (setq dblk_value nil))
         ((= lable "编组多选...") (setq grps_value nil))  ;;;v1.31编组
   )
   (if (= (type i) 'LIST)
       (progn
           (setq i (eval i))
           (or i (setq i (atoi (get_tile key_txt))))
           (setq tmp (vl-princ-to-string (car (vl-position i lst))))
       )
   )
   (set_tile key_txt (if (= 'STR (type i)) i (vl-prin1-to-string i)))
   (if tmp (set_tile key_inf (itoa tmp)))
)

(defun ss_add_filter ( )
    (setq flag t
          kl_tmp
            (mapcar '(lambda( x / y )
                        (setq y (caddr x))
                        (if (= "1" (get_tile (car x)))
                            (subst (list (car y) (get_tile (car y))) y x)
                        )
                    )
                    klst
            )
          kl_tmp (vl-remove nil kl_tmp)
    )
)

(defun ss_add_filter1 ( /  tmp x ss )
  ;; kl_tmp: (("0" "pop0" ("txt0" "LINE")) ("6" "pop6" ("txt6" "DOTE")))
  (if (setq ss (ssget "I")) (ssget))
  (prompt "\n请选择附加样本实体:")
  (foreach tmp (mai_ssget_2_list (ssget))
    (setq kl_tmp
          (mapcar '(lambda( x / y prop )
                      (setq prop (mai_dxf (read (car x)) tmp))
                      (if (or (member (car x) '("0" "6" "8")) ;;支持多样本实体的通用组码
                              (and (member (car x) '("1" "2" "7"))
                                   prop
                                   (= (mai_dxf 0 slent) (mai_dxf 0 tmp))
                                   (setq y (caddr x))
                              ) ;;非通用组码，需要与样本实体的类型相同
                          )  ;;or
                         (if (wcmatch prop (cadr y))
                             x
                             (subst (list (car y) (strcat (cadr y) "," (ss_cltpf prop nil t))) y x)
                         )
                         x
                      )
                   )
                   kl_tmp
          )
    )
  )
   (and ss
        (> (sslength ss) 0)
        (progn (while (/= 0 (getvar "cmdactive")) (command ""))
               (command "._select" ss "" "._pselect" ss "")
        )
   )
) ;;defun


(defun ss_get_filter ( / tmp pop txt txt1 rc txt2 txt3 pop_1 pop_2 pop_3 ktmp tmp1 tmp2)
  (cond ((= "1" (get_tile "hand")) (setq hand "1"))
        ((= "1" (get_tile "pre")) (setq hand "2"))
        ((= "1" (get_tile "all")) (setq hand "3"))
  );;cond
  ;;------------v1.29 处理记忆容差功能---------------
  (setq klst (vl-remove-if-not '(lambda(x) (= "1" (get_tile (car x)))) klst)
        fjlst (vl-remove-if-not '(lambda(x) (= "1" (get_tile (car x)))) fjlst)
        klst
          (mapcar '(lambda( x / y )
                     (setq y (last x))
                     (if (= (cadr y) "容差")
                         (subst (list (car y) (get_tile (car y))) y x)
                         x
                     )
                   )
                   klst
         )
        fjlst
          (mapcar '(lambda( x / y )
                     (setq y (last x))
                     (if (= (cadr y) "容差")
                         (subst (list (car y) (get_tile (car y))) y x)
                         x
                     )
                   )
                   fjlst
         )
  ;;------------v1.29 处理记忆容差功能---------------
        kl_pre (append (list (mai_dxf 0 entl)) klst fjlst)   ;;附加过滤选中的项下次使用也成为缺省选中 
  )
  (foreach tmp klst 
    (setq pop (get_tile (cadr tmp))
          tmp2 (read (car tmp))
          tmp3 (mai_dxf tmp2 entl)
    )    
    (cond ;;;((member (car tmp) '("0" "1" "2" "3" "6" "7" "8" "302" "410"))  ;;;-------------------v1.09
          ((= tmp2 -3)
           (setq txt (get_tile (caaddr tmp)))
           (and (setq tmp1 (cond ((= pop "0") "OR") ((= pop "1") "NOT")))
                (setq filter (vl-list* (cons -4 (strcat "<" tmp1))
                                       (list tmp2 (list txt))
                                       (cons -4 (strcat tmp1 ">"))
                                       filter
                             )
                )
           )
          )

          ((= (type tmp3) 'STR)  ;;;-------------------v1.09
           (setq txt (get_tile (caaddr tmp)) 
                 txt1 (cadr (caddr tmp))
           )
           (if (= txt txt1) 
               (setq txt (ss_cltpf tmp3 nil t))  ;*前加上`
           ) ; if ;如果(car tmp)对应的值未被用户修改过，取回原来的值
           (and (setq tmp1 (cond ((= pop "0") "OR") ((= pop "1") "NOT")))
                (setq filter (vl-list* (cons -4 (strcat "<" tmp1))
                                       (cons tmp2 txt)
                                       (cons -4 (strcat tmp1 ">"))
                                       filter
                             )
                )
           )
          );;end member

          ((member (car tmp) '("62" "66" "70" "71" "72" "73" "74" "76" "90" "370")) 
           (setq txt (get_tile (caaddr tmp)) 
                 filter (vl-list* 
                            (cons -4 (nth (read pop) '("=" "<" ">" "<=" ">=" "<>" "&" "&=")))
                            (cons tmp2 (read txt)) 
                            filter 
                        )
            );;setq 
           )

           ;;((member (car tmp) '("38" "39" "40" "41" "42" "43" "44" "47" "48" "50" "51" "52" "370"))  ;;-------------------v1.09
           ((member (type tmp3) (list 'real 'int))  ;;-------------------v1.09
            (setq txt (get_tile (caaddr tmp)) 
                  txt1 (cadr (caddr tmp)) 
                  rc (read (get_tile (car (last tmp)))) 
                  txt (if (= txt txt1) tmp3 (atof txt))
            ) ;;如果(car tmp)对应的值未被用户修改过，取回原来的实数数值 
            (and (member (type rc) (list 'real 'int))
                 (member pop (list "0" "5"))
                  ;;如果设置了容差，且为数值型，过滤条件为"="时要处理容差----- v1.07增加/=的误差功能
                (setq filter (append  ;;处理容差 
                                (if (and (member (car tmp) '("50" "51" "52"))  ;---v1.02修改 50组码计算容差后为负数时不能生成正确过滤表的问题
                                         (or (< (- txt (abs rc)) 0.0)
                                             (> (+ txt (abs rc)) (* pi 2))
                                         )
                                    )  ;;and
                                    (append (if (= pop "0") '((-4 . "<or") (-4 . "<=")) '((-4 . "<and") (-4 . ">"))) ;----- v1.07增加/=的误差功能
                                            (list (cons tmp2 (mai_fix_ang (+ txt (abs rc)))))
                                            (if (= pop "0") '((-4 . ">=")) '((-4 . "<")))
                                            (list (cons tmp2 (mai_fix_ang (- txt (abs rc)))))
                                            (if (= pop "0") '((-4 . "or>")) '((-4 . "and>")))
                                    )                       ;----- v1.07增加/=的误差功能
                                    (append (if (= pop "0") '((-4 . "<and") (-4 . "<=")) '((-4 . "<or") (-4 . ">")))  ;----- v1.07增加/=的误差功能
                                            (list (cons tmp2 (+ txt (abs rc))))
                                            (if (= pop "0") '((-4 . ">=")) '((-4 . "<")))
                                            (list (cons tmp2 (- txt (abs rc))))
                                            (if (= pop "0") '((-4 . "and>")) '((-4 . "or>")))  ;----- v1.07增加/=的误差功能
                                    )
                                );;if                     ;;--v1.02修改 50组码计算容差后为负数时不能生成正确过滤表的问题
                                filter 
                             );;append 
                      filter (vl-list*    ;不处理容差 
                                (cons -4 (nth (read pop) '("=" "<" ">" "<=" ">=" "<>")))
                                (cons tmp2 txt) 
                                filter 
                             )
                );;setq 
            );;end of if 容差 
           )

           ((member (car tmp) '("10" "11" "12" "13")) 
            (setq txt1 (get_tile (caaddr tmp)) 
                  txt2 (get_tile (car (cadddr tmp))) 
                  txt3 (get_tile (car (last tmp))) 
                  pop_1 (nth (read pop) '("=" "<" ">" "<=" ">=" "<>"))
                  pop_2 pop_1
                  pop_3 pop_1
            );;setq
            (if (= txt1 "") (setq pop_1 "*"))
            (if (= txt2 "") (setq pop_2 "*"))
            (if (= txt3 "") (setq pop_3 "*"))
            (setq txt1 (if (= txt1 (cadr (caddr tmp))) (car tmp3) (atof txt1))
                       ;;如果坐标对应的值未被用户修改过，取回原来的实数数值 
                  txt2 (if (= txt2 (cadr (cadddr tmp))) (cadr tmp3) (atof txt2))
                  txt3 (if (= txt3 (cadr (last tmp))) (caddr tmp3) (atof txt3))
                  filter (vl-list* 
                            (cons -4 (strcat pop_1 "," pop_2 "," pop_3))
                            (cons tmp2 (list txt1 txt2 txt3)) 
                            filter   
                         ) 
            ) 
           );;end of member (car tmp) '("10" "11") 
    );;cond 
  );;foreach tmp klst 

  (if fjlst
     (progn
       (foreach tmp fjlst
         (cond ((= (car tmp) att_tag_fj)
                (or att_tag
                    (setq ktmp (read (get_tile (strcat "inf" att_tag_fj)))
                          att_tag (list (1- (max 1 ktmp)))
                    )
                )
                (ss_chang_fj att_tag_fj att_tag attl1 'car '(mai_get_blk_atts slent) nil)
               )
               ((= (car tmp) att_value_fj)
                (or att_value
                    (setq ktmp (read (get_tile (strcat "inf" att_value_fj)))
                          att_value (list (1- (max 1 ktmp)))
                    )
                )
                (ss_chang_fj att_value_fj att_value attl2 'cadr '(mai_get_blk_atts slent) nil)
               )
               ((= (car tmp) att_fj)
                (or att_sel
                    (setq ktmp (read (get_tile (strcat "inf" att_fj)))
                          att_sel (list (1- (max 1 ktmp)))
                    )
                )
                (ss_chang_fj att_fj att_sel attl3 'cadr '(mai_get_blk_atts slent) t)
               )
               ((= (car tmp) dblk_fj)
                (or dblk_sel
                    (setq ktmp (read (get_tile (strcat "inf" dblk_fj)))
                          dblk_sel (list (1- (max 1 ktmp)))
                    )
                )
                (ss_chang_fj dblk_fj dblk_sel dblkl3 'cdr '(mai_getdynprops slent nil) t)
               )
               ((= (car tmp) dblk_name_fj)
                (or dblk_name
                    (setq ktmp (read (get_tile (strcat "inf" dblk_name_fj)))
                          dblk_name (list (1- (max 1 ktmp)))
                    )
                )
                (ss_chang_fj dblk_name_fj dblk_name dblkl1 'car '(mai_getdynprops slent nil) nil)
               )
               ((= (car tmp) dblk_value_fj)
                (or dblk_value
                    (setq ktmp (read (get_tile (strcat "inf" dblk_value_fj)))
                          dblk_value (list (1- (max 1 ktmp)))
                    )
                )
                (ss_chang_fj dblk_value_fj dblk_value dblkl2 'cdr '(mai_getdynprops slent nil) nil)
               )
               ((= (car tmp) "FJ3")  ;;groups ;;;v1.31编组
                (ss_chang_fj "FJ3"
                     (if grps_value
                         grps_value  ;; 通过sel_lay对话框选择
                         (list (vl-position (get_tile "txtFJ3") grps_lst)) ;;只适用于一个值，不支持手工编辑框输入数据
                     )
                     grps_lst 'car '(groupnames slent) nil
                )
               )
           
          );;cond
        )

          ;;;;*************v1.26
        (or filter (setq filter (list (assoc 0 entl))))  ;;如果仅选中的附加条件，则将filter设为样板实体的类别 ;
        (setq fjflt '(and)) 
        (foreach tmp fjlst 
            (setq pop (get_tile (cadr tmp)) 
                  txt (get_tile (caaddr tmp)) 
                  txt1 (cadr (caddr tmp)) 
                  rc (if (= (length tmp) 4) (read (get_tile (car (last tmp)))) nil)
                  tmp1 (eval (cadr (mai_dxf (car tmp) lst5)))
            )
            (if (= txt txt1)
                (setq txt tmp1)
                (if (/= 'STR (type tmp1))
                    (setq txt (read txt))
                ) ;;数据类型判断-----v1.07修改
            ) ;;如果(car tmp)对应的值未被用户修改过，取回原来的实数数值 
            (setq tmp1 (cadr (mai_dxf (car tmp) lst5)))
            (if (and (member (type rc) (list 'real 'int))
                     (member (type txt) (list 'real 'int))
                     (member pop (list "0" "1")) ;;如果设置了容差，且为数值型，过滤条件为"="时要处理容差 -------v1.07增加了处理不等于号的容差
                )
                (setq fjflt
                        (mai_cons_last ;;处理容差 
                            (list (if (= pop "0") 'and 'or)  ;-------v1.07处理不等于号的容差
                                  (list 'and tmp1 (list (if (= pop "0") '<= '>) tmp1 (+ txt (abs rc))))
                                  (list 'and tmp1 (list (if (= pop "0") '>= '<) tmp1 (- txt (abs rc))))
                            )
                            fjflt 
                        )
                );;setq 
                (setq tmp2 (= 'STR (type (eval tmp1)))
                      tmp3 (read pop)
                      wctmp (list (read (nth tmp3 (if tmp2 '("=" "/=" "wcmatch" "wcmatch") '("=" "/=" "<" ">" "<=" ">="))))
                                  tmp1
                                  (if (and (> tmp3 1) tmp2 (= txt txt1)) ;;仅针对未手改过的字符进行通配符处理，如果手改过，由手改时编辑特殊字符，确定前面是否加转义符`                           
                                      (ss_cltpf txt nil t)
                                      txt
                                  )
                            )
                      ;不处理容差 
                     fjflt (mai_cons_last (if (and tmp2 (= 3 tmp3)) (list 'not wctmp) wctmp) fjflt)
                                    ;------v1.10  修改后首先要求附加过滤的值不为nil，如果本身为nil则不能过滤
                );;setq 
            );;end of if 容差 
        );;foreach fjlst 
    )
  );;end if fjlst 
);;defun

(defun ss_chang_fj ( att_tag_fj att_tag val_lst eval1 eval2 flag / tmp fjl1 a11 str eval3 ) ;;lst5为附加过滤表，作为外部变量 *******v1.26新增函数
    ;;(if (not att_tag) (setq att_tag (list (vl-position inffj val_lst)))) 
  (setq fjl1 (assoc att_tag_fj lst5)
        a11 (list 'strcat)
  )
  (foreach tmp att_tag
    (setq str (cadr (nth tmp val_lst))
          eval3 (cond ((and str flag) (list 'mai_dxf str eval2))
                      (str (list 'if (list 'vl-position str (list 'mapcar (list 'quote eval1) eval2)) str))
                           ;;;__else if____;不考虑属性顺序的过滤;
                )
    )
    (if eval3
        (setq eval3 (list 'if eval3 (list 'vl-princ-to-string eval3) "Value not available.")
              a11 (append a11 (list eval3 ","))
        )
    );;if
  ) ;;foreach
  (if (= (last a11) ",") (setq a11 (mai_rcdr a11)))
  (setq a11 (list 'if eval2 a11)
        fjl1 (subst a11 (caddr fjl1) fjl1)
        lst5 (subst fjl1 (assoc att_tag_fj lst5) lst5)
  )
);;defun
  
(defun ss_write ( f ktmp code valuex txt width / tmp ) 
   (setq tmp (strcat txt (vl-princ-to-string code))) 
   (write-line (strcat ":edit_box{value=\"" valuex "\";key=\"" tmp "\";edit_width=" width ";allow_accept=true;}") f) 
   (cons (list tmp valuex) ktmp)
);;defun

(defun ss_write_inf ( code inf_lst / lst )
   (setq lst (caddr (assoc code inf_lst)))
   (write-line (strcat ":popup_list{key=\"inf"
                        (vl-princ-to-string code)
                        "\";edit_width=" inf_wid ";"
                        (ss_mk_pop_txt "LST2TXT" (mapcar 'cadr lst))
                        "}"
               )
               f
    )  ;;改为下拉列表
   (setq pop_lst (cons (list code lst) pop_lst))
);;defun

(defun ss_mkstr ( tmp )
       (if (= (type tmp) 'STR) tmp (vl-prin1-to-string tmp))
);;defun

(defun ss_mk_pop_txt( code valuex / tmp )
  (setq tmp (type valuex))
  (cond ((= code "LST2TXT")
         (setq str (strcat "list=\"" (mai_lst2str (mapcar '(lambda(x)(ss_cltpf x t nil)) valuex) "\\n") "\";"))
        )
        ((= code "SS_FJ")
         (cond ((member tmp '(int real)) "list=\"=\\n/=\\n<\\n>\\n<=\\n>=\";")
               ((= tmp 'sym) "list=\"=\\n/=\";")
               ((= tmp 'str) "list= \"=\\n/=\\nwcmatch\\nnot match\";")
         )
        )
        ((and (= code "SS_FJ") (= tmp 'sym)) "list=\"=\\n/=\";")
        ((= code -3) "list= \"=\\n<>\";")
        ((= tmp 'str) "list= \"=\\n<>\";")
        ((= tmp 'int) "list= \"=\\n<\\n>\\n<=\\n>=\\n<>\\n&\\n&=\";")
        ((member tmp '(real list)) "list= \"=\\n<\\n>\\n<=\\n>=\\n<>\";")
  );;cond
);;defun



(defun ss_kldc_1 ( / attl alen lval ltag aflst aa cc a11 a12 a13 fjl)  ;此函数v1.04时修改过
 (setq attl (mai_get_blk_atts slent))
 (if attl (progn
    (setq attl1 (mapcar 'car attl)  ;;;*******v1.26 变量在ss_sel_lay函数中需要用到
          attl2 (mapcar 'cadr attl)
          attl3 (mapcar 'reverse attl)
          alen (length attl)
          aa (assoc "INSERT" lst2)
          fjl (caddr aa) ;;附加过滤表;;
          att_fj (strcat "FJ" (itoa (length fjl)))
          fjl (mai_cons_last
                (list att_fj
                      "图块属性"
                      '(cadar (mai_get_blk_atts slent))  ;;这里是临时表达式，不在过滤时使用
                      (vl-list* (car attl3)
                                (list (list 'ss_sel_lay "属性多选" (list 'quote attl1) (strcat "txtFJ" (itoa (length fjl)))) "属性多选...")
                                (cdr attl3)
                      )
                )
                fjl
              )
         att_tag_fj (strcat "FJ" (itoa (length fjl))) ;;;*******以下 v1.26
         tmp1 (caar (mai_get_blk_atts slent))
         fjl (mai_cons_last
                (list att_tag_fj
                     "属性标志"
                     '(caar (mai_get_blk_atts slent))  ;;这里是临时表达式，不在过滤时使用
                     (vl-list* (list tmp1 tmp1)
                                  ;;'(((ss_sel_lay "属性标志多选" attl1 "txt6") "属性标志多选..."))
                               (list (list 'ss_sel_lay "属性标志多选" (list 'quote attl1) (strcat "txtFJ" (itoa (length fjl)))) "属性标志多选...")
                               (mapcar '(lambda (x) (list x x)) (vl-remove tmp1 attl1))
                     )
                )
                fjl
             )
         att_value_fj (strcat "FJ" (itoa (length fjl)))
         tmp1 (cadar (mai_get_blk_atts slent))
         fjl (mai_cons_last
                (list att_value_fj
                      "属性数值"
                      '(cadar (mai_get_blk_atts slent))
                      (vl-list* (list tmp1 (if (= "" tmp1) " " tmp1))
                                ;;'(((ss_sel_lay "属性数值多选" attl2 "txt6") "属性数值多选..."))
                                (list (list 'ss_sel_lay "属性数值多选" (list 'quote attl2) (strcat "txtFJ" (itoa (length fjl)))) "属性数值多选...")
                                (mapcar '(lambda(x)(list x (if (= "" x) " " x))) (vl-remove tmp1 attl2))
                      )
                )
                fjl
             )
   );;setq
   (if (= attdis "Y")
       (while (> alen 0)
          (setq a11 (list (vl-list* 'nth (1- alen) '((mai_get_blk_atts slent))))
                a12 (list 'if '(mai_get_blk_atts slent) (cons 'cadr a11))
                a13 (list 'if '(mai_get_blk_atts slent) (cons 'car a11))
                ltag (+ -1 (length fjl) alen alen)
                lval (list (strcat "FJ" (rtos ltag 2 0)) '"属性数值" a12) ;;;比原函数增加了计算FJ编号
                ltag (list (strcat "FJ" (rtos (1- ltag) 2 0)) '"属性标志" a13) ;;;比原函数增加了计算FJ编号
                aflst (vl-list* lval ltag aflst)
                alen (1- alen))
        );;end while
    );;if
    (setq cc (list (car aa) (cadr aa) (append fjl (reverse aflst)))
          lst2 (subst cc aa lst2)
    )
  );;progn
 );;if
);;end defun

;取标注文本. 
;xshrimp 2008.07.07
(defun ss_getdim (ent flag / e el roop tmp ) ;flag=T 取文字 flag=nil 只取测量数值，标注修改过返回nil
   (setq e (mai_dxf -2 (tblsearch "block" (mai_dxf 2 ent))) roop T)
   (while roop
     (if e (setq el (entget e)) (setq roop nil))
     (if (or (member '(0 . "MTEXT") el) (member '(0 . "TEXT") el))
         (setq roop nil)
         (setq e (entnext e)) ;;_else
     )
   )
   (setq e nil)
    ;判断有无修改. 
   (and (setq tmp (mai_dxf 1 el))
        (or (member tmp (list "<>" "")) flag)
        (progn
            (setq tmp1 (mai_clear_mtformat tmp)
                  tmp (car (fs_GetStrNums tmp1))
            )
                     ;;;;;;(x_txt2 "1.材料mm铝单板" "0123456789.-") 有时出错
            (setq e (if (= (vl-prin1-to-string tmp) tmp1) tmp tmp1))
       )
   )
   e
)

(defun ss_dimvalue (ent) (ss_getdim ent nil))

(defun ss_dimtext (ent) (ss_getdim ent T))

(defun ss_cltpf ( strtmp flag flag1 / tmp )
  ;; (defun cltpf ( code strtmp entl flag / tmp )
  ;;2011.05.02增加对*、@、#、?通配符的处理, 将符合条件的strtmp中的 * 替换成 `* 不考虑通配符可采用扩展过滤器中文字内容项;;
  ;;flag =nil时，不处理引号和反斜框，写文件时用T，set_tile 时用nil
  ;;flag1= t 处理所有*@等 flag1=nil ，不处理#@*
  (if flag1
     (foreach tmp '(("``" "`") ("`*" "*") ("`@" "@") ("`#" "#") ("`?" "?") ("`," ",") ("`~" "~"))
        (setq strtmp (mai_lst2str (mai_str2lst2 strtmp (cadr tmp)) (car tmp)))
     )
  )
  (if flag
     (foreach tmp '(("\\\\" "\\") ("\\\"" "\"") ("\\r" "\r") ("\\n" "\n"))
        (setq strtmp (mai_lst2str (mai_str2lst2 strtmp (cadr tmp)) (car tmp)))
     )
  ) ;;if
  strtmp
);;defun




(defun ss_dynamicblk ( / attl alen lval ltag aflst aa cc a11 a12 a13 fjl tmp1 tmp2 tmp3)  ;v1.06
 (setq attl (mai_getdynprops slent nil))
 (if attl
  (progn
    (setq dblkl1 (mapcar 'car attl)  ;;;*******v1.26 变量在ss_sel_lay函数中需要用到
          dblkl2 (mapcar 'cdr attl)
          dblkl3 (mapcar '(lambda (x / y)(setq y (vl-princ-to-string (cdr x)))(list y y)) attl)
          alen (length attl)
          aa (assoc "INSERT" lst2)
          fjl (caddr aa) ;;附加过滤表;
          tmp2 (itoa (length fjl))
          dblk_fj (strcat "FJ" tmp2)
          tmp2 (strcat "txtFJ" tmp2)
          fjl (mai_cons_last
                (list dblk_fj
                      "动态特性"
                      '(cdar (mai_getdynprops slent nil))  ;;这里是临时表达式，不在过滤时使用
                      (vl-list* (car dblkl3)
                                (list (list 'ss_sel_lay "特性多选" (list 'quote dblkl1) tmp2) "特性多选...")
                                (cdr dblkl3)
                      )
                )
                fjl
              )
                                        ; '(((ss_sel_lay "属性多选" attl1 "txt6") "属性多选..."))) )) )
          dblk_name_fj (strcat "FJ" (itoa (length fjl))) ;;;*******以下 v1.26
          tmp1 (caar (mai_getdynprops slent nil))
          fjl (mai_cons_last
                (list dblk_name_fj
                      "动态名称"
                      '(caar (mai_getdynprops slent nil))  ;;这里是临时表达式，不在过滤时使用
                      (vl-list* (list tmp1 tmp1)
                                ;;'(((ss_sel_lay "属性标志多选" attl1 "txt6") "属性标志多选..."))
                                (list (list 'ss_sel_lay "动态名称多选" (list 'quote dblkl1) tmp2) "动态名称多选...")
                                (mapcar '(lambda (x) (list x x)) (vl-remove tmp1 dblkl1))
                      )
                )
                fjl
              )
          dblk_value_fj (strcat "FJ" (itoa (length fjl)))
          tmp1 (cdar (mai_getdynprops slent nil))
          tmp3 (ss_mkstr tmp1)
          tmp3 (if (= "" tmp3) " " tmp3)
          fjl (mai_cons_last
                (list dblk_value_fj
                      "动态数值"
                      '(cdar (mai_getdynprops slent nil))
                      (vl-list* 
                            (list tmp1 tmp3)
                            (list (list 'ss_sel_lay "动态数值多选" (list 'quote dblkl2) tmp2) "动态数值多选...")
                            (mapcar '(lambda (x) (list (vl-princ-to-string x) tmp3))
                                     (vl-remove tmp1 dblkl2)
                            )
                      )
                )
                fjl
              )
   );;setq
   (if (= dblkdis "Y")
      (while (> alen 0)
          (setq a11 (list 'cdr (list 'nth (1- alen) '(mai_getdynprops slent nil)))
                ltag (mai_block_name slent)
                a12 (list 'if (list '= '(mai_block_name slent) ltag) a11)  ;---v1.10
                a13 (list 'if (list '= '(mai_block_name slent) ltag) a11)   ;---v1.10
                ltag (+ -1 (length fjl) alen alen)
                lval (list (strcat "FJ" (rtos ltag 2 0)) '"动态数值" a12) ;;;比原函数增加了计算FJ编号
                ltag (list (strcat "FJ" (rtos (1- ltag) 2 0)) '"动态名称" a13) ;;;比原函数增加了计算FJ编号
                aflst (vl-list* lval ltag aflst)
                alen (1- alen))
      );;end while
   );;if
   (setq ;cc (list (car aa) (cadr aa) (append '(FJ) (reverse aflst))) ;;如果没有fj过滤组，使用此条
         cc (list (car aa) (cadr aa) (append fjl (reverse aflst)))
         lst2 (subst cc aa lst2)
   )
  );;progn
 );;if
);;end defun
 
 (defun ss_add_text_fj ( ent_name / txt alen lval aflst aa cc a11 a12 fjl i)
  (setq txt (fs_getstrnums (mai_clear_mtformat (mai_get_property slent 'textstring))))
  (if txt
     (progn
        (setq alen (length txt)
              i 0
              aa (assoc ent_name lst2)
              fjl (caddr aa) ;;附加过滤表;
              alen (min alen 4) ;;数值过滤限制为4个
        )
        (while (and (> alen 0) (< i alen))
               (setq lval (list (strcat "FJ" (rtos (+ (length fjl) i) 2 0))
                                (strcat "文字数值" (itoa (1+ i)))
                                (list 'if
                                      '(fs_GetStrNums (mai_clear_mtformat (mai_get_property slent 'TextString)))
                                      (vl-list* 'nth i '((fs_GetStrNums (mai_clear_mtformat (mai_get_property slent 'TextString)))))
                                )
                          )
                     aflst (cons lval aflst)
                     i (1+ i)
               )
        );;end while
        (setq cc (list (car aa) (cadr aa) (append fjl (reverse aflst)))
              lst2 (subst cc aa lst2)
        )
     )
  );;end if txt
);;defun

;;提取文字中的数字(fs_GetStrNums "你好f456.12fa dfa4455 456.24.454faafd7841-5")
(defun fs_GetStrNums (str / a a1 i lst regex)
  (setq regex (vlax-create-object "Vbscript.RegExp"))
  (vlax-put-property regex 'Global 1)
  (vlax-put-property regex 'Multiline :vlax-true)
  (vlax-put-property regex 'Pattern "-?\\d+(\\.?\\d+)?")
  (setq a (vlax-invoke regex 'Execute str)
        i 0
  )
  (repeat (vla-get-Count a)
    (setq a1 (vlax-get-property a 'item i)
          lst (cons (read (vla-get-value a1)) lst)
          i (1+ i)
    )
  )
  (vlax-release-object regex)
  (reverse lst)
)

(defun ss_getcolor (ent / col) ;取得实体的颜色;;块内实体定义过颜色的，不能正确处理
  ;;(setq ent (vlax-ename->vla-object ent))
  (setq col (mai_dxf 62 ent))
  (cond ((= col 256) (vla-get-color (vla-item acadlay (mai_dxf 8 ent)))) ;;相当于 (mai_dxf 62 (tblsearch "layer" (mai_dxf 8 ent))))
        ((= col 0) 7)  ;;byblock颜色按7号色
        (col)
  );;cond
);;

(defun ss_linetype ( ent / lt ) ;取得实体的线型;;块内实体不能正确处理
  ;;(setq ent (vlax-ename->vla-object ent))
  (setq lt (mai_dxf 6 ent))
  (cond ((= lt "ByLayer") (vla-get-linetype (vla-item acadlay (mai_dxf 8 ent)))) ;;相当于 (mai_dxf 6 (tblsearch "layer" (mai_dxf 8 ent)))
        ;;((= lt "ByBlock") "ByBlock")  ;;byblock的线型未处理
        (lt)
  );;cond
)

(defun ss_get_appn ( ent / tmp )
    (if (setq tmp (mai_dxf -3 ent))
        (mai_lst2str (mapcar 'car tmp) ",")
    )
)

;; Toggle Case - Lee Mac
;; Returns the supplied string with the text case of each character switched
(defun LM:ToggleCase ( s )
    (vl-list->string
        (mapcar '(lambda ( a b c ) (if (< 96 a 123) b c))
            (vl-string->list s)
            (vl-string->list (strcase s))
            (vl-string->list (strcase s t))
        )
    )
)

(defun ss_getallstr ( s / str s1 s2) ;;生成可以支持ssget选择大小写过滤的字符串
  (setq str "")
  (if s
    (foreach s (vl-string->list s)
        (setq s1 (vl-list->string (list s))
              s2 (LM:ToggleCase s1)
              str (if (= s1 s2)
                      (strcat str s1)
                      (strcat str "[" s1 s2 "]")
                  )
        )
    )
  )
  str
)

(defun ss_sel_lay ( lable lay_lst txtn / b s_d dcl_id lays dcl_name lst1 tmp)
  (setq lays ""
        lay_lst (mapcar 'vl-princ-to-string lay_lst)
        dcl_name
            (mai_make_dcl
                (list (strcat "sel_lay:dialog{label=\"" lable "\";")
                      ":list_box{key=\"lay_sel\";height=30;width=30;fixed_width=true;fixed_height=true;"
                      "alignment=centered;multiple_select=true;allow_accept=true;}spacer;ok_cancel;}"
                )
            )
        dcl_id (load_dialog dcl_name)
    )
   (new_dialog "sel_lay" dcl_id)
   (mai_filldcl_list "lay_sel" lay_lst)
   (action_tile "lay_sel" "(setq b $value) (if (= $reason 4) (done_dialog 1))")
   (action_tile "lay_sel" "(setq b $value)")
   (setq s_d (start_dialog))
   (unload_dialog dcl_id)
   (and b
        (= s_d 1)
        (progn
            (setq lst1 (read (strcat "(" B ")"))) 
            (foreach s_d lst1
                (setq tmp (nth s_d lay_lst)
                      lays (strcat lays
                                   ","
                                   (cond ((= lable "属性多选") (cadr (assoc tmp (mapcar 'reverse attl3))))
                                         ((= lable "特性多选") (vl-princ-to-string (cadr (assoc tmp (mapcar 'reverse dblkl3)))))
                                         (tmp)
                                   );;cond
                           )
                )
            )
            (cond ((= lable "属性标志多选") (setq att_tag lst1))
                  ((= lable "属性数值多选") (setq att_value lst1))
                  ((= lable "属性多选") (setq att_sel lst1))
                  ((= lable "特性多选") (setq dblk_sel lst1))
                  ((= lable "动态名称多选") (setq dblk_name lst1))
                  ((= lable "动态数值多选") (setq dblk_value lst1))
                  ((= lable "实体编组多选") (setq grps_value lst1)) ;;v1.31编组
            )
        )
    )
    (if (= "" lays)
        (get_tile txtn)
        (substr lays 2)
    )
) ;;defun




;|
函数名称:  ss_fonces_Area  
调用格式:  (ss_fonces_Area pts)  
参数说明:  pts ---- 点表  
返回值:    实数  
函数简介:  点围成的多边形面积  
函数来源:  原创  
函数作者:  Lispboy  
适用版本:  不限
最后更新时间:  2013-06-07  

备注:
函数本身并不是重要的，重要的是利用它判断点表的顺、逆时针。
采用的是数学的行列式的方法算得面积，面积有正负，逆时针正，顺时针负。
 点表构成的多边形要保证不自交，自交可能结果不对。 

点围成的多边形面积

参数： pts ----点表

返回值： 实数
副作用： 如果点表是逆时针，面积正， 顺时针 面积负

|;

(defun ss_fonces_Area (pts / pts1 iSum p0 p1 p2 x0 x1 x2 y0 y1 y2)
  (setq pts1 pts
        iSum 0
        p0 (car pts)
        x0 (car p0)
        y0 (cadr p0)
  )
  (while (cdr pts1)
    (setq p1 (car pts1)
          x1 (car p1)
          y1 (cadr p1)
          p2 (cadr pts1)
          y2 (cadr p2)
          x2 (car p2)
          iSum (+ iSum (- (* x1 y2) (* x2 y1)))
          pts1 (cdr pts1)
    )
  )
  (/ (+ iSum (- (* (caar pts1) y0) (* x0 (cadar pts1)))) 2.0)
)

;; WO2PL (gile)
;; Re-creates a wipeout boundary (lwpolyline)
;; http://www.theswamp.org/index.php?topic=28059.msg336431#msg336431
;; returns the wipeout point list (WCS)
(defun wipeout2plst ( wo / elst u v mat )
  (setq  elst (entget wo)
         u (mai_dxf 11 elst)
         v (mai_dxf 12 elst)
         mat (list u (mapcar '- v) '(0. 0. 1.))
  )
  (mapcar
    '(lambda (p)
       (mapcar '+
         (mai_mxv (mai_trp mat) p)
         (mapcar '(lambda (x y) (/ (+ x y) 2.)) u v)
         (mai_dxf 10 elst)
       )
     )
     (cdr (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 14)) elst)))
  )
);;defun
;;/////////////////////////////////////////////////////////////////////////
;;
;;  GroupNames ( Ename )
;;
;; Copyright c 2001 Michael Puckett - All Rights Reserved
;;
;;/////////////////////////////////////////////////////////////////////////
;;
;;  Return a list of the group names the entity is a child of,
;;  innermost first.
;;
;;/////////////////////////////////////////////////////////////////////////
;;(GROUPNAMES (car(entsel)))
(defun groupnames (ename / key dict result)
  (setq key (cons 340 ename)
        dict (dictsearch (namedobjdict) "acad_group")
  )
  (while (setq dict (member (assoc 3 dict) dict))
    (if (member key (entget (cdadr dict)))
        (setq result (cons (cdar dict) result))
    )
    (setq dict (cddr dict))
  )
  ;;(setq result (reverse result))
  (if result
      (mapcar '(lambda (x) (cons x x)) (acad_strlsort result))
  ) ;;配合后面程序需要改返回值格式
);;defun


(or (member "acopm.arx" (arx)) (arxload "acopm.arx"))
(princ "\n选择易命令名：XC_SS")
(princ)