本帖最后由 wanchr 于 2023-12-15 19:54 编辑
- (defun transsfilter (str / tf);就是你的函数啊。
- (vl-list->string
- (apply 'append
- (mapcar
- (function (lambda (c)
- (if (or (> c 128) tf)
- (progn
- (if (not tf) (setq tf t) (setq tf nil))
- (list c))
- (progn
- (setq tf nil)
- (if (member c '(35 64 46 42 63 126 91 93 45 44))
- (list 96 c)
- (list c)))))) (vl-string->list str)))))
- (defun get-entity-info()
- (setq entity-info (entget entity)) ; 获取所选对象的信息
- (princ (strcat "\n你选择的一个原始对象信息:\n" (vl-princ-to-string entity-info))) ; 显示所选对象的信息
- (princ "\n")
- (progn
- (setq aa (assoc 8 entity-info))
- (princ aa)
- (cons (car aa) (transsfilter (cdr aa)))
- (princ "\n")
- (princ aa)
- (princ "\n")
- )
- (setq layer-name (cdr aa));就是用你的函数吗
- ;(setq layer-name (cdr (assoc 8 entity-info))) ; 获取所选对象的图层名
- ;(princ layer-name)
- ;(princ "\n")
- ;(setq nname (cdr (assoc 100 entity-info))) ; 获取所选对象的名称
- ;(setq entity-type (cdr (assoc 0 entity-info))) ; 获取所选对象的类型
- ;(setq bname (cdr (assoc 2 entity-info)))
- )
- (defun build-filter()
- (setq filter nil) ; 初始化过滤条件为空列表
- (if layer-name
- (setq filter (cons (cons 8 layer-name) filter))) ; 如果图层名存在,则将图层名添加到过滤条件中
- (if nname
- (setq filter (cons (cons 100 nname) filter))) ; 如果名称存在,则将名称添加到过滤条件中
- (if entity-type
- (setq filter (cons (cons 0 entity-type) filter))) ; 如果类型存在,则将类型添加到过滤条件中
- (if bname
- (setq filter (cons (cons 2 bname) filter)))
- (princ (strcat "\n默认过滤条件:\n" (vl-princ-to-string filter))) ; 显示构建的过滤条件
- )
|