- 积分
- 10154
- 明经币
- 个
- 注册时间
- 2018-8-12
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2020-7-20 17:06:22
|
显示全部楼层
baitang36 大师,帮忙看下我这个怎么转了FAS格式,命令失效 以下是源码
;过滤选择
(defun FILTER_by_DXF_code(ss DXF_code / ss i filter elist DXF_cons ssf n)
(if ss
(progn
(command "undo" "be")
(setq i 0)
(setq filter nil)
(repeat (sslength ss)
(setq elist(entget (ssname ss i)))
(if (assoc DXF_code elist)
(if (=(type(cdr(assoc DXF_code elist))) 'STR)
(setq DXF_cons (cons DXF_code (ACET-STR-ESC-WILDCARDS1 (cdr(assoc DXF_code elist)))))
(setq DXF_cons (assoc DXF_code elist))
);;此处有修正
(if(= DXF_code 62)
(setq DXF_cons (cons DXF_code 256))
);;;只针对颜色为 bylayer 有用
);;end if
(setq filter (append filter (list DXF_cons)))
(setq i (1+ i))
);;end repeat
(setq filter (append '((-4 . "<or")) filter '((-4 . "or>"))));建立过滤表
(princ"\n请框选对象范围<按空格或右键全选>:")
(if (setq ssf (ssget filter))
(princ)
(setq ssf (ssget "x" filter))
)
(command "undo" "e")
(sssetfirst nil ssf)
(princ)
)
(princ"\n未选择,退出")
)
(princ)
);;end defun
;;62 按颜色过滤
(defun c:fgs() (princ "\n过滤选择---颜色")(FILTER_by_DXF_code (ssget) 62))
;;8 按图层过滤
(defun c:fgd() (princ "\n过滤选择---图层")(FILTER_by_DXF_code (ssget) 8 ))
;;0 按类型过滤
(defun c:fgf() (princ "\n过滤选择---类型")(FILTER_by_DXF_code (ssget) 0 ))
;;先选块,然后按块名过滤
(defun c:fgb() (princ "\n过滤选择---块名")(FILTER_by_DXF_code (ssget '((0 . "INSERT"))) 2))
;;先选填充,然后按填充样式过滤
(defun c:fgh() (princ "\n过滤选择---填充名")(FILTER_by_DXF_code (ssget '((0 . "HATCH"))) 2))
;;先选尺寸标注,然后按标注样式过滤
(defun c:fgr() (princ "\n过滤选择---标注样式")(FILTER_by_DXF_code (ssget '((0 . "*DIMENSION"))) 3))
;;先选文字,然后按字体样式过滤
(defun c:fgt() (princ "\n过滤选择---文字样式")(FILTER_by_DXF_code (ssget '((0 . "MTEXT,TEXT"))) 7))
;;先选文字,然后按文字内容过滤
(defun c:fgts() (princ "\n过滤选择---文字内容")(FILTER_by_DXF_code (ssget '((0 . "MTEXT,TEXT"))) 1))
;选填充
(DEFUN C:fgha()(princ "\n过滤选择---填充")(sssetfirst nil (ssget '((0 . "hatch")))) (prin1))
;;只选文字
(DEFUN C:fgta()(princ "\n过滤选择---文字")(sssetfirst nil (ssget '((0 . "MTEXT,TEXT")))) (prin1))
;;只选标注+箭头引线
(DEFUN C:fgre()(princ "\n过滤选择---标注+箭头引线")(sssetfirst nil (ssget '((0 . "*DIMENSION,LEADER")))) (prin1))
;选文字+标注+箭头引线
(DEFUN C:fgtre()(princ "\n过滤选择---文字+标注+箭头引线")(sssetfirst nil (ssget '((0 . "MTEXT,TEXT,*DIMENSION,LEADER")))) (prin1)) |
|