Message 1 of 36
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there,
Is it possible to create a lisp to delete revision clouds in the drawing? thank you very much in advance. 🙂
Solved! Go to Solution.
Hi there,
Is it possible to create a lisp to delete revision clouds in the drawing? thank you very much in advance. 🙂
Solved! Go to Solution.
Please post a sample drawing with you revcloud, so we can see what it is.. There are several ways to
produce those clouds. If they are on a given Layer, no problems at all. Simply:
(setq ss (ssget "X" (list (cons 8 "CLOUD")))); IF your revcloud is on layer 'CLOUD.
(if ss (command "_erase" ss "")); erases anything on CLOUD layer
ECCAD
hey,
all revclouds
(command "_erase" (ssget "_x" '((-3 ("RevcloudProps")))) "")
selected revclouds
(command "_erase" (ssget '((-3 ("RevcloudProps")))) "")
I did not want to delete any layer. Maybe some other objects are on the same layer with revision clouds. thanks.
Hi there,
It works great! Could you please add the first one
(command "_erase" (ssget "_x" '((-3 ("RevcloudProps")))) "")
into the below lisp? Sorry I did not say it clearly in the beginning, many thanks. 🙂
sure. like that?
(vl-load-com)
(defun c:ASet (/ format_date chgtxt adoc data_assoc_list ss attribute_tag attribute_string)
;********************************************************************************************
(defun format_date (/ mon date)
(setq mon '("JAN" "FEB" "MAR" "APR" "MAY" "JUN" "JUL" "AUG" "SEP" "OCT" "NOV" "DEC"))
(setq date (rtos (fix (getvar "cdate")) 2 0))
(strcat (substr date 1 4) (nth (1- (atoi (substr date 5 2))) mon) (substr date 7 2))
)
;********************************************************************************************
(defun chgtxt (string)
(itoa (1+ (atoi string)))
; (cond
; (
; (= (car (reverse (vl-string->list string))) 65)
; (vl-string-subst "B" "A" string) ; replace A with B
; (vl-string-subst "" "A" string) ; replace with empty string
; )
; (
; (= (car (reverse (vl-string->list string))) 97)
; (vl-string-subst "b" "a" string) ; replace a with b
; (vl-string-subst "" "a" string) ; replace with empty string
; )
; )
)
;********************************************************************************************
(setq data_assoc_list '(
; ("TITLE_LINE_1" . "DMR SUBSTATION")
; ("DATE" . "2023MAR10")
("DATE" . "2024SEP")
; ("DESIGNED_BY" . "P. SAHBA")
; ("INDEPENDENT_CHK" . "R. CLELLAND")
("DRAFTED_BY" . "M. RU")
("DRAFTING_CHECK" . "L. JI")
; ("INSPECTED_BY" . "")
; ("REVIEWED_BY" . "")
; ("ACCEPTED_BY" . "")
)
)
(if (ssget "_X" (list '(0 . "insert")))
(vlax-for block_reference (vla-get-activeSelectionSet (vla-get-activedocument (vlax-get-acad-object)))
(cond
((wcmatch (strcase (vla-get-effectiveName block_reference)) "BCH-X-BORD-DXXX,BCH-X-BORD-BXXX,BCH-X-BORD-AXXX,BCH-X-ANNO-STMP-OBSO")
(foreach attribute (vlax-invoke block_reference 'getAttributes)
(setq attribute_tag (strcase (vla-get-tagString attribute)))
(setq attribute_string (vla-get-textString attribute))
(cond
((setq item (assoc attribute_tag data_assoc_list))
(vla-put-textString attribute (format_date))
(vla-put-textString attribute (cdr item))
)
((wcmatch attribute_tag "REV_`#")
(if
(and
(or
(wcmatch attribute_string "#")
(wcmatch attribute_string "##")
(wcmatch attribute_string "#[AaBb]")
(wcmatch attribute_string "##[AaBb]")
)
(setq attribute_string (chgtxt attribute_string))
)
(vla-put-textString attribute attribute_string)
)
)
)
)
)
((= "BCH-ST-DYN-DWG-ISSUE" (vla-get-effectivename block_reference))
(setpropertyvalue (vlax-vla-object->ename block_reference) "AcDbDynBlockPropertyVisibility" "IRD - ISSUE RECORD DRAWING")
)
(t)
)
(vlax-release-object block_reference)
)
)
(command "_erase" (ssget "_x" '((-3 ("RevcloudProps")))) "")
(princ)
)
The code I posted doesn't 'delete' the Layer itself, just anything on that layer.
You are correct, though, IF you had something else on that Layer, it would be erased.
I guess you 'shouldn't' do that unless you are confident that someone didn't put something
on that layer that didn't belong there ?
That's why I requested a sample .dwg so we could see what we were dealing with.
Maybe all 'red' stuff, maybe 'lwpolylines, etc.
ECCAD
If you have revision clouds on multiple tabs you'll need something like this to delete them:
(if (setq s (ssget "_X" '((-3 ("RevcloudProps")))))
(foreach e (mapcar 'cadr (ssnamex s)) (vla-delete (vlax-ename->vla-object e)))
;; Does not work
;; (mapcar 'entdel (mapcar 'cadr (ssnamex s)))
)
Hi there,
It did not work. Please see the part of lisp below. Could you please provide some advice to me? many thanks.
Your code needs to look like Message 8.
Erasing a 'selection set', won't work, you need to get each Ename contained in the
selection set, and erase each one in turn.
ECCAD
Hi there,
Could you please provide more details about it? The message 8 is to delete revision clouds in multiple layouts. In this case, it is revision clouds in single layout, many thanks.
so, where these all revclouds you want to delete are located?
Sorry for (my) confusion. I was thinking of 'Explode, rather than 'Erase.
(command "_erase" ss ""); will work just fine. DA.
If you were to explode a selection set, it won't work like:
(command "_explode" ss ""); won't work
You would have to grab each entity and explode it alone...
For your code:
;; Bottom of your routine looks like:
(vlax-release-object block_reference)
)
)
(command "_erase" (ssget "_x" '((-3 ("RevcloudProps")))) "")
(princ)
)
;; If that is correct, then you could try this:
(vlax-release-object block_reference)
)
)
(setq ss (ssget "_x" '((-3 ("RevcloudProps")))))
(if ss
(command "_erase" ss "")
); if
(princ)
)
But that is the same as before, just re-arranged.
ECCAD
Hi there,
Unfortunately, it did not work. There is one more question. I typed in "ASET" to call this lisp, other features of the lisp work well. But there is an information below, it says unknown command "ASET". I run the original lisp, no this issue. Could you please provide some advice to me, many thanks. 🙂
Looks like the 'previous' program was asking you to "Select Objects:'', which implies it maybe has an
extra "" in some line that didn't need the "" to complete. I would have to see the entire code to determine
where that occurs. Since you didn't hit the 'Escape' key, the 'last' program was still active, and your
command 'ASET' was not accepted as an input to the "Select Objects:" prompt.
You should be able to 'load' the program and just type ASET at the Command Prompt line to call
that C:ASET function, since it's defined as a C:... type Command Function.
Post the code as you have it now, so we can determine what's wrong.
ECCAD
I'll look at the code posted in Message 5, but I need a 'sample' drawing with the Revclouds shown, and
on the Layout portion. You can strip out all the drawing content, title block, etc. that may not be
passed on to this Forum. All I need is the basics to match the Lisp function(s).
ECCAD
OK, I think I have it. You only want to remove Revclouds (within the Current Layout).
And I'm presuming you cannot 'upload' drawings.
If that's the case, try this:
(vl-load-com)
;; Add this new function at top of your file.
(defun remove_revclouds_this_layout ()
;; Added this function 8-23-2024
(setq ss (ssget "_X" '((-3 ("RevcloudProps")))))
(if ss
(progn
(setq N 0 layoutx (getvar "CTAB")); index and current Layout
(repeat (sslength ss)
(setq ent (ssname ss N)); get each entity in selection set 'ss
(setq elist (entget ent)); make an entity list of the entity
(setq curlayout (cdr (assoc 410 elist))); check which Layout it is on
(if (= curlayout layoutx)
(command "_erase" ent "")
); if
(setq N (+ N 1))
); repeat
); progn
); if
(princ)
); function
;; And on the bottom of ASet function, make it like this:
(vlax-release-object block_reference)
)
)
(remove_revclouds_this_layout); Remove the Revcloud(s) on this particular Layout only
(princ)
); function
ECCAD
I just ran the attached, modified New_ASet.lsp (my local version).
It loaded and ran, and it (DID) delete the revclouds. Try this new version.
Since you didn't post your present version of code, as it is now, I used the code
of Message 5 as a base. Removed some of the commented portions.
Also, you can remove the sample drawing, I have a copy.
I have R2021 Mechanical, what version you running ?
See also, Message 21 on page 2..
ECCAD