Code Red > AutoLISP (Vanilla / Visual)

Select revclouds

(1/4) > >>

Joe Burke:
I hacked this today because I have a bunch of drawings where the old revclouds need to be deleted before adding new ones. There's many existing clouds. Trying to pick them out visually is error prone and a waste of time.

It works, but I wonder if there's an easier way codewise, like a filtered selection set? I'm not up on the -4 stuff.

Thanks for any suggestions.


--- Code: ---;; Select revclouds
;; Distinguish revclouds from other lwplines by checking every
;; vertex has a 42 DXF code other than zero.
(defun c:SRC ( / i ss ssrc e elst)
  (setq i 0 ssrc (ssadd))
  (if (setq ss (ssget "x" '((0 . "LWPOLYLINE") (410 . "Model"))))
    (repeat (sslength ss)
      (setq e (ssname ss i))
      (setq elst (vl-remove-if-not '(lambda (x) (= 42 (car x))) (entget e)))
      (if
        (and
          (< 2 (length elst))
          (vl-every '(lambda (x) (not (zerop (cdr x)))) elst)     
        )
        (ssadd e ssrc)
      )
      (setq i (1+ i))
    )
  )
  (sssetfirst nil ssrc)
  (princ)
) ;end

--- End code ---

ElpanovEvgeniy:
......

--- Code: ---(setq ss(ssget "x" '((0 . "LWPOLYLINE") (410 . "Model")(-4 . "/=")(42 . 0))))
--- End code ---
......

ElpanovEvgeniy:
Closed polyline..

--- Code: ---(setq ss(ssget "x" '((0 . "LWPOLYLINE") (410 . "Model")(70 . 1)(-4 . "/=")(42 . 0))))
--- End code ---

Joe Burke:
Thanks,

That's what I didn't know how to do.

ElpanovEvgeniy:
In a cloud, all codes 42 are equal!

Navigation

[0] Message Index

[#] Next page

Go to full version