本帖最后由 vitalgg 于 2023-6-8 20:39 编辑
- (defun c:sn (/ para-comp fun number)
- (@:help '("选择大于或小于某一数值的字符串."))
- (setq para-comp (string:auto-split (getstring "请输入比较规则及值,如>300,<=200 :")))
- (if (and
- (string:numberp (cadr para-comp))
- (= 'subr (type (eval (read (car para-comp))))))
- (progn
- ;; 分析输入的参数,
- (setq fun (eval (read (car para-comp)))
- number (atof (cadr para-comp)))
- ;; 过滤 条件生成新的选择集。
- (sssetfirst nil
- (pickset:from-list
- (vl-remove-if-not
- '(lambda (x)
- (and
- (string:numberp (entity:getdxf x 1))
- (fun (atof (entity:getdxf x 1)) number )))
- (pickset:to-list (ssget '((0 . "text"))))
- )))
- )))
|