<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Automatic LAYDEL command in AutoCAD Electrical Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266748#M30471</link>
    <description>&lt;P&gt;That's exactly what I did !&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;</description>
    <pubDate>Mon, 31 Jul 2017 20:05:10 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-07-31T20:05:10Z</dc:date>
    <item>
      <title>Automatic LAYDEL command</title>
      <link>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7265859#M30456</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a script ''Deletelayer.scr'' that I wish to use to delete a particular layer on multiple drawings.&lt;/P&gt;&lt;P&gt;It looks like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;(command "-laydel" "_n" "Révision 2" "" "_y")&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;;end(it is important to leave this empty line)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With AutoCAD Electrical 2016, ''Projects'', ''Utilities'', I launch the script but it fails at the first drawing that doesn't contain layer ''revision 2''&lt;/P&gt;&lt;P&gt;Here is command bar result:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Command: wd_scr_msg "========== Drawing 1 of 135 =========="&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;Command:&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;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&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;Command:&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;Command: (command "-laydel" "_n" "Révision 2" "" "_y")&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;-laydel&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;Select object on layer to delete or [Name]: _n&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;Enter layer name or [?]: Révision 2&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;Invalid Layer name.&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;Enter layer name or [?]:&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;Select object on layer to delete or [Name/Undo]: _y&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;*Invalid selection*&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;Expects a point or Last/Name&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;; error: Function cancelled&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Someone could help ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 15:10:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7265859#M30456</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-31T15:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic LAYDEL command</title>
      <link>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7265976#M30457</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(setq laynam "Revision 2")(if (tblsearch "layer" laynam) (command "-laydel" "_n" laynam "" "_y"))&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Jul 2017 15:44:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7265976#M30457</guid>
      <dc:creator>rhesusminus</dc:creator>
      <dc:date>2017-07-31T15:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic LAYDEL command</title>
      <link>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266260#M30458</link>
      <description>&lt;P&gt;Thanks rhesusminus&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Script works well ! By the way, do you know why first drawing can't be open ? I got error&amp;nbsp;(Active drawing is first in list). But if I close that first drawing, it works fine !&lt;/P&gt;&lt;P&gt;But now I can't insert my schematic symbol drawn on layer ''revision 2''&lt;/P&gt;&lt;P&gt;I tried creating new ''revision 2'' layer and it works. But it is impossible to insert any symbol created on layer ''revision 2''.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have idea of what's happening ?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 17:23:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266260#M30458</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-31T17:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic LAYDEL command</title>
      <link>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266283#M30459</link>
      <description>The "Active drawing is first in list" is "as designed" You can't have the first drawing to be processed as the active drawing.&lt;BR /&gt;&lt;BR /&gt;For the symbol, can you post the symbol here?</description>
      <pubDate>Mon, 31 Jul 2017 17:28:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266283#M30459</guid>
      <dc:creator>rhesusminus</dc:creator>
      <dc:date>2017-07-31T17:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic LAYDEL command</title>
      <link>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266298#M30460</link>
      <description>&lt;P&gt;Yes, take a look !&lt;/P&gt;&lt;P&gt;Thanks !&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 17:32:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266298#M30460</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-31T17:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic LAYDEL command</title>
      <link>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266366#M30461</link>
      <description>Nothing seems to be amiss with the block, excepting the layer assignments for the two objects. &lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;Move all of the entities in the symbol to Layer 0.&lt;BR /&gt;When you go to insert the block, it will absorb the properties of whichever layer is active at the time of insertion.&lt;BR /&gt;&lt;BR /&gt;*Remember to purge the old block definition from the drawing before inserting your edited block.&lt;BR /&gt;&lt;BR /&gt;*FYI, this is often considered 'best practice' for normal ACAD blocks (ie, placing everything on Layer 0)&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;&lt;BR /&gt;Jim</description>
      <pubDate>Mon, 31 Jul 2017 17:53:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266366#M30461</guid>
      <dc:creator>jseefdrumr</dc:creator>
      <dc:date>2017-07-31T17:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic LAYDEL command</title>
      <link>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266378#M30462</link>
      <description>&lt;P&gt;This is why:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Command: (setq laynam "Révision 2")(if (tblsearch "layer" laynam) (command "-laydel" "_n" laynam "" "_y"))

Selected layers: Révision 2.
******** WARNING ********

&lt;STRONG&gt;There are 1 block definition(s) which reference the layer(s) you are deleting.
The block(s) will be redefined and the entities referencing the layer(s)
will be removed from the block definition(s).&lt;/STRONG&gt;

You are about to delete layer "Révision 2" from this drawing.
&lt;STRONG&gt;Redefining block "REV02".&lt;/STRONG&gt;

Deleting layer "Révision 2".
1 layer deleted.nil&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The LAYDEL command removes the layer even if it's "in use".&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 17:56:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266378#M30462</guid>
      <dc:creator>rhesusminus</dc:creator>
      <dc:date>2017-07-31T17:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic LAYDEL command</title>
      <link>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266419#M30463</link>
      <description>Do you want the script to delete the layer, no matter what?</description>
      <pubDate>Mon, 31 Jul 2017 18:08:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266419#M30463</guid>
      <dc:creator>rhesusminus</dc:creator>
      <dc:date>2017-07-31T18:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic LAYDEL command</title>
      <link>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266533#M30464</link>
      <description>&lt;P&gt;Yes, I want the script to delete the layer no matter what but I want to be able to create it again by inserting my ''rev002'' block with layer ''revision 2'' in it.&lt;/P&gt;&lt;P&gt;Blocks rev001, rev002, etc.. are inserted during a project. Layer ''revision 1'' comes with block ''rev001'' and so on...&lt;/P&gt;&lt;P&gt;The script that I want now is to begin a new project without any trace of ''revxx'' blocks and ''revision x'' layers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 18:47:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266533#M30464</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-31T18:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic LAYDEL command</title>
      <link>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266536#M30465</link>
      <description>&lt;P&gt;Maybe I should delete the block first and then purge the unused layer ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem is that I can't find a command to select a block by its name.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 19:04:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266536#M30465</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-31T19:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic LAYDEL command</title>
      <link>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266578#M30466</link>
      <description>Yes, you should delete the block first, and the purge it.</description>
      <pubDate>Mon, 31 Jul 2017 19:04:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266578#M30466</guid>
      <dc:creator>rhesusminus</dc:creator>
      <dc:date>2017-07-31T19:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic LAYDEL command</title>
      <link>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266581#M30467</link>
      <description>&lt;P&gt;Do you know how to select a block by its name ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 19:06:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266581#M30467</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-31T19:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic LAYDEL command</title>
      <link>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266617#M30468</link>
      <description>&lt;PRE&gt;(setq laynam "Révision 2")
(setq blknam "REV02")
(setq ss (ssget "_X" (list (cons 2 blknam))))
(if ss (command "erase" ss ""))
(command "-purge" "B" blknam "N")
(if (tblsearch "layer" laynam) (command "-laydel" "_n" laynam "" "_y"))
&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Jul 2017 19:15:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266617#M30468</guid>
      <dc:creator>rhesusminus</dc:creator>
      <dc:date>2017-07-31T19:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic LAYDEL command</title>
      <link>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266730#M30469</link>
      <description>&lt;P&gt;It works very well ! Thanks !&lt;/P&gt;&lt;P&gt;I customized a little bit and it does what I want :&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;(command "zoom" "_e")&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;(command "-layer" "_s" "0" "")&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;(setq laynam "Révision 2")&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;(setq blknam "REV02")&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;(setq ss (ssget "_X" (list (cons 2 blknam))))&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;(if ss (command "erase" ss ""))&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;(command "-purge" "B" blknam "N")&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;(if (tblsearch "layer" laynam) (command "-laydel" "_n" laynam "" "_y"))&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I'll have to see if I can find a way to increment ''rev01'' to ''rev02'' and ''revision 1'' to ''revision 2'' and so on...&lt;/P&gt;&lt;P&gt;I guess that a FOR loop could work...&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 19:57:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266730#M30469</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-31T19:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic LAYDEL command</title>
      <link>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266744#M30470</link>
      <description>Or just copy/paste and increase manually &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;</description>
      <pubDate>Mon, 31 Jul 2017 20:03:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266744#M30470</guid>
      <dc:creator>rhesusminus</dc:creator>
      <dc:date>2017-07-31T20:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic LAYDEL command</title>
      <link>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266748#M30471</link>
      <description>&lt;P&gt;That's exactly what I did !&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 20:05:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-electrical-forum/automatic-laydel-command/m-p/7266748#M30471</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-31T20:05:10Z</dc:date>
    </item>
  </channel>
</rss>

