Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automatic LAYDEL command

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
1060 Views, 2 Replies

Automatic LAYDEL command

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

2 REPLIES 2
Message 2 of 3
gpcattaneo
in reply to: Anonymous

Try:

 

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

Message 3 of 3
Anonymous
in reply to: gpcattaneo

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report