jim78b 发表于 2022-9-14 18:47:45

setbyblock 慢例程

我有几张带有很多块的图纸,每次我启动 setbyblock.lsp 都很慢,
有没有办法加快列表速度?
万分感谢
(defun c:setbyblock ( / _byblock e n x a sel c)

    (defun _byblock ( n l / a e x )
      (if (and (setq e (tblobjname "BLOCK" n)) (not (member n l)))
            (while (setq e (entnext e))
                (setq x (entget e))
                (if (setq a (assoc 420 x))
                  (setq x (vl-remove (assoc 420 x) x))
                )
                (if (setq a (assoc 62 x))
                  (entmod (subst '(62 . 0) a x))
                  (entmod (append x '((62 . 0))))
                )
                (if (= "INSERT" (cdr (assoc 0 x)))
                  (_byblock (cdr (assoc 2 x)) (cons n l))
                )
            )
      )
      nil
    )

    (prompt "\nSelect Blocks: ")
    (setq sel (ssget (list (cons 0 "INSERT"))))
    (setq c 0)
    (repeat (sslength sel)
      (setq n (ssname sel c))      
      (_byblock (cdr (assoc 2 (entget n))) nil)
      (setq c (1+ c))
    )
   
    (command "_.regen")
    (princ)
   
)

页: [1]
查看完整版本: setbyblock 慢例程