Automatic LAYDEL command

Automatic LAYDEL command

Anonymous
Not applicable
1,234 Views
2 Replies
Message 1 of 3

Automatic LAYDEL command

Anonymous
Not applicable

Hi,

 

I have a script ''Deletelayer.scr'' that I wish to use to delete a particular layer on multiple drawings.

It looks like this:

(command "-laydel" "_n" "Révision 2" "" "_y")
;end(it is important to leave this empty line)

 

The problem is that layer ''revision 2'' doesn't exist in every drawing so I'm looking for a solution to ignore those drawings that don't have that layer and keep deleting layer ''revision 2'' on drawings that contain it.

 

With AutoCAD Electrical 2016, ''Projects'', ''Utilities'', I launch the script but it fails at the first drawing that doesn't contain layer ''revision 2''

Here is command bar result:

Command: wd_scr_msg "========== Drawing 1 of 135 =========="
Command:
Command: wd_prj_run_cur_dwg_oem "0" "w_keep" "c_keep" "sx_keep" "0" "" 1 nil "0" "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" nil nil nil "0" nil
Command:
Command: (command "-laydel" "_n" "Révision 2" "" "_y")
-laydel
Select object on layer to delete or [Name]: _n
Enter layer name or [?]: Révision 2
Invalid Layer name.
Enter layer name or [?]:
Select object on layer to delete or [Name/Undo]: _y
*Invalid selection*
Expects a point or Last/Name
; error: Function cancelled

 

Someone could help ? 

Thanks

0 Likes
Accepted solutions (1)
1,235 Views
2 Replies
Replies (2)
Message 2 of 3

gpcattaneo
Advocate
Advocate
Accepted solution

Try:

 

(if (tblsearch "layer" "Révision 2") (command "-laydel" "_n" "Révision 2" "" "_y"))

Message 3 of 3

Anonymous
Not applicable

Thanks gpcattaneo

 

Script works well ! By the way, do you know why first drawing can't be open ? I got error (Active drawing is first in list). But if I close that first drawing, it works fine !

But now I can't insert my schematic symbol drawn on layer ''revision 2''

I tried creating new ''revision 2'' layer and it works. But it is impossible to insert any symbol created on layer ''revision 2''.

 

Do you have idea of what's happening ?

Thanks

0 Likes