Author Topic: Select revclouds  (Read 5442 times)

0 Members and 1 Guest are viewing this topic.

Joe Burke

  • Guest
Select revclouds
« on: January 24, 2008, 09:26:33 AM »
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]
;; 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

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Select revclouds
« Reply #1 on: January 24, 2008, 09:36:57 AM »
......
Code: [Select]
(setq ss(ssget "x" '((0 . "LWPOLYLINE") (410 . "Model")(-4 . "/=")(42 . 0))))......

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Select revclouds
« Reply #2 on: January 24, 2008, 09:39:35 AM »
Closed polyline..
Code: [Select]
(setq ss(ssget "x" '((0 . "LWPOLYLINE") (410 . "Model")(70 . 1)(-4 . "/=")(42 . 0))))

Joe Burke

  • Guest
Re: Select revclouds
« Reply #3 on: January 24, 2008, 09:47:08 AM »
Thanks,

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

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Select revclouds
« Reply #4 on: January 24, 2008, 09:50:11 AM »
In a cloud, all codes 42 are equal!

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Select revclouds
« Reply #5 on: January 24, 2008, 09:52:44 AM »
Stratospherically speaking of course.

 :-)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Select revclouds
« Reply #6 on: January 24, 2008, 10:01:46 AM »
Shoot, beat me to it.
Well you could add dxf 90 with a minimum number of vertex to further filter the selection.

Code: [Select]
(setq ss (ssget "x" '((0 . "LWPOLYLINE")(410 . "Model")(-4 . "/=")(42 . 0.0)(-4 . ">")(90 . 4))))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Joe Burke

  • Guest
Re: Select revclouds
« Reply #7 on: January 24, 2008, 10:13:29 AM »
Thanks Alan,

Yes, I need that too.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Select revclouds
« Reply #8 on: January 24, 2008, 10:44:43 AM »
If they are on the same layer, just delete the layer.

Code: [Select]
(defun C:DEL-LAYER  (/ n ent acapp acsp adoc allrs layer_name TotalNumber CurrNumber)
  (vl-load-com)
  (setq n 1)
  ;;(setq layer_name (getstring t "\n* Enter Layer name to Delete : "))
  (setq ent   (entsel "\nSelect object on Delete Layer")
layer_name (cdr (assoc 8 (entget (CAR ent))))
  )
  (setq acapp (vlax-get-acad-object)
adoc  (vla-get-activedocument acapp)
acsp  (vla-get-block (vla-get-activelayout adoc))
allrs (vla-get-layers adoc)
  )
  (setq TotalNumber (sslength (ssget "_X" (list (cons 8 layer_name)))) CurrNumber 1)
  ;;(princ "\n Total deleted object - ")(princ TotalNumber)(terpri)
  (if (member "acetutil.arx" (arx))
    (ACET-UI-PROGRESS-INIT
      "Please Wait while the Program is Running"
      TotalNumber
      )
    )
  ;;added progress bar start   
  (or (eq (vla-get-freeze (vla-item allrs layer_name)) :vlax-true)
    (vla-put-freeze (vla-item allrs layer_name) :vlax-false)
  )
  (or (eq (vla-get-lock (vla-item allrs layer_name)) :vlax-true)
    (vla-put-lock  (vla-item allrs layer_name) :vlax-false)
  )
  (or (eq (vla-get-layeron (vla-item allrs layer_name)) :vlax-false)
    (vla-put-layeron (vla-item allrs layer_name) :vlax-true)
  )     
 
  (vlax-for lt (vla-get-layouts adoc)
    (vlax-for ob (vla-get-block lt)
      (if (eq (vla-get-layer ob) layer_name)
(progn
;;(grtext -1 (strcat "Deleted " (itoa CurrNumber) " of " (itoa Totalnumber)))   
         (if (member "acetutil.arx" (arx))(ACET-UI-PROGRESS-SAFE n)(ARCH:WORKING))         
         ;;added progress bar running     
         (setq n (+ n 1))
         ;;added progress bar count marker           
(vla-delete ob)         
(vlax-release-object ob)         
)       
      )
    )
  )
  ;;(vla-regen adoc acallviewports)
  (if (member "acetutil.arx" (arx))(ACET-UI-PROGRESS-DONE))
  ;;added progress bar finish
  (princ)
)
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Joe Burke

  • Guest
Re: Select revclouds
« Reply #9 on: January 24, 2008, 11:03:06 AM »
Gary,

The reason I chose to select the revclouds, rather than simply delete them, is any such routine cannot be bulletproof in terms of only finding lwplines which were created using the revcloud command.

Select first, then visually check the selection. If it looks OK, then erase.

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Select revclouds
« Reply #10 on: January 24, 2008, 11:12:51 AM »
Gary,

The reason I chose to select the revclouds, rather than simply delete them, is any such routine cannot be bulletproof in terms of only finding lwplines which were created using the revcloud command.

Select first, then visually check the selection. If it looks OK, then erase.

My cent  :-)

Code: [Select]
(defun c:SRC-1 (/ ss)
 (if (setq ss (ssget "x" '((0 . "LWPOLYLINE") (410 . "Model") (70 . 1) (-4 . "/=") (42 . 0) (-4 . ">") (90 . 4))))
  (sssetfirst
   nil
   (progn
    (foreach x (mapcar (function cadr) (ssnamex ss))
     (if (null (vl-every (function =) (mapcar (function cdr) (vl-remove-if-not '(lambda (x) (= 42 (car x))) (entget x)))))
      (ssdel x ss)
     ) ;_ if
    ) ;_ foreach
    ss
   ) ;_ progn
  ) ;_ sssetfirst
 ) ;_ if
)

Joe Burke

  • Guest
Re: Select revclouds
« Reply #11 on: January 25, 2008, 07:56:33 AM »
Thanks, Evgeniy.

OcCad

  • Guest
Re: Select revclouds
« Reply #12 on: February 20, 2008, 06:27:39 PM »
How could someone go about freezing layers that the revclouds are currently on versus deleting them? And when i say layers, i mean multiple revision clouds on layers that correspond to its date or delta number.

ex:

s-anno-revc-1   s-anno-revc-A   s-anno-revc-080112   
s-anno-revc-2   s-anno-revc-B   s-anno-revc-080214
s-anno-revc-3   s-anno-revc-C   s-anno-revc-080303

Also i would prefer a way that would not require me to list each individual layer as it varies from job to job.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Select revclouds
« Reply #13 on: February 20, 2008, 09:42:25 PM »
Code: [Select]
(command "-layer" "F" "s-anno-revc*" "")
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

OcCad

  • Guest
Re: Select revclouds
« Reply #14 on: February 21, 2008, 03:57:42 PM »
Is there a faster way to modify multiple drawings for this other than a batch?

processes i would like to run are:

   (setvar "clayer" "0")
   (command "-layer" "freeze" "s-anno-revc*" "")

   (if (tblsearch "layer" revlay)
     (command "-layer" "thaw" revlay "")
   );if