Ciao1982 发表于 2022-7-5 16:25:03

Alert script no round-up line

I use autocad for architectural projects, and all the time I draw lines with round length (except of course diagonal lines or arcs), with a precision of centimeter so no smaller than 0.01. Sometimes when I snap to a point, for mistake autocad snaps to something very close, so close and small that I don't realise soon this mismatch. The problem is that usually I discover the wrong length much later, when I have already spread this mistake across the drawing. So, can you suggest me a script which gives me an allert when a line with a length smaller that 0.01 has been drawn?
 
Thanks

BIGAL 发表于 2022-7-5 17:13:01

Take a bit more care with your osnap settings and turn off stuff like GRID.

Lee Mac 发表于 2022-7-5 17:46:08

The following will select all lines shorter than a given length:
(defun c:shortlines ( / ent enx idx mnl sel )      (setq mnl 0.01) ;; Minimum allowable line length   (if (setq sel (ssget "_X" (list '(0 . "LINE") (if (= 1 (getvar 'cvport)) (cons 410 (getvar 'ctab)) '(410 . "Model")))))       (repeat (setq idx (sslength sel))         (setq ent (ssname sel (setq idx (1- idx)))               enx (entget ent)         )         (if (< mnl (distance (cdr (assoc 10 enx)) (cdr (assoc 11 enx))))               (ssdel ent sel)         )       )   )   (sssetfirst nil sel)   (princ))
页: [1]
查看完整版本: Alert script no round-up line