<?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: Layer Import from CSV - evaulate if layer exists first? in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5998568#M141146</link>
    <description>&lt;P&gt;I am essentially trying to get the AIA layer standards set up in a drawing template. I'm a small outfit trying to get on board with basic current standards and I can't believe how hard it is to get this accomplished.&amp;nbsp;I've spent hours searching.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why would national AutoCAD layer standards not be something that's readily available to anyone who needs them? How else does it become a standard if its so hard to get&amp;nbsp;it&amp;nbsp;into an AutoCAD drawing template? Without the good will of someone like you on the internet, it would take days to enter them all in by hand and check/double check them for accuracy.&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jan 2016 02:12:34 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-01-21T02:12:34Z</dc:date>
    <item>
      <title>Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5657809#M141128</link>
      <description>&lt;P&gt;Hi All -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a Layer Import routine that I borrowed from the brilliant Lee Mac -- where you import Layer definitions into your drawing from a CSV file. It works beautifully - EXCEPT that if any of the layer properties are modified (color, linetype, etc.) after the layer is imported from the CSV, and you re-import the layers into your drawing again from the CSV, it resets them back to their original properties as defined in the CSV.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like the command to function such that if it finds that the layer name already exists in the drawing, then it skips over importing it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thought the code I borrowed from Lee Mac was doing that.... the code is pasted below with the section I thought would have been controlling the feature I was looking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any advice or direction would be much appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;MRG&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun RM:CSV-&amp;gt;Layers  (path / f *error* extract trim activeDoc l
                        layerTable layerName layerItem layerDescription
                        layerColor layerLinetype layerLineweight
                        layerPlottable layerFreeze)
  ;; © RenderMan 2011, CADTutor.net
  ;; Exampe: (RM:CSV-&amp;gt;Layers "Z:\\my_layers_folder\\my_layers.csv")
  (vl-load-com)
  (if (and (findfile path)
           (setq f (open path "r")))
    (progn
 
      ;; Error handler
      (defun *error*  (msg)
        (cond
          ((not msg))                                                   ; Normal exit
          ((member msg '("Function cancelled" "quit / exit abort")))    ; &amp;lt;esc&amp;gt; or (quit)
          ((princ (strcat "\n** Error: " msg " ** "))))                 ; Fatal error, display it
        (if f
          (close f))
        (princ))
 
      ;; Line extraction sub-function
      (defun extract  (l /)
        (substr l 1 (vl-string-search "," l)))
 
      ;; Line trim sub-function
      (defun trim  (v /)
        (vl-string-subst "" (strcat v ",") l))
 
      ;; Main code
      (vla-startundomark
        (cond (activeDoc)
              ((setq activeDoc
                      (vla-get-activedocument
                        (vlax-get-acad-object))))))
      (read-line f)                                                     ; &amp;lt;- Skip first line (headers)
      (setq layerTable (vla-get-layers activeDoc))
 
      ;; Linetype check
      ;; &amp;lt;- Add linetype import code here, to avoid errors
 
      (while (/= nil (setq l (read-line f)))
        (progn
 
&lt;FONT color="#FF0000"&gt;          ;; Layer check
          (if (not (tblsearch "layer" (setq layerName (extract l))))
             (setq layerItem (vla-add layerTable layerName))
             (setq layerItem (vla-item layerTable layerName)))&lt;/FONT&gt;
 
          ;; Layer settings
          (setq l (trim layerName))
          (vla-put-description
            layerItem
            (setq layerDescription (extract l)))
          (setq l (trim layerDescription))
          (if (/= 7 (setq layerColor (extract l)))
            (vla-put-color layerItem layerColor))
          (setq l (trim layerColor))
          (vla-put-linetype layerItem (setq layerLinetype (extract l)))
          (setq l (trim layerLinetype))
          (if (= "BYLAYER" (strcase (setq layerLineweight (extract l))))
            (vla-put-lineweight layerItem aclnwtbylayer))
          (setq l (trim layerLineweight))
          (if (/= "YES" (strcase (setq layerPlottable (extract l))))
            (vla-put-plottable layerItem :vlax-false))
          (setq l (trim layerPlottable))
          (if (/= "NO" (strcase (setq layerFreeze (extract l))))
            (vla-put-freeze layerItem :vlax-true))))
      (close f)
      (vla-endundomark activeDoc)))
  (princ))&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 May 2015 21:02:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5657809#M141128</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-29T21:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5657848#M141129</link>
      <description>&lt;P&gt;Hi &amp;nbsp;MRG,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;t&lt;SPAN class="hps"&gt;ry&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;the&amp;nbsp;RenderMan's&amp;nbsp;quickly modified&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1206685"&gt;@BlackBox_&lt;/a&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;I hope&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;you do not mind&lt;/SPAN&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun RM:CSV-&amp;gt;Layers (path           /              f              *error*        extract        trim
                       activeDoc      l              layerTable     layerName      layerItem      layerDescription
                       layerColor     layerLinetype  layerLineweight               layerPlottable layerFreeze
                      )
  ;; © RenderMan 2011, CADTutor.net
  ;; Exampe: (RM:CSV-&amp;gt;Layers "Z:\\my_layers_folder\\my_layers.csv")
  (vl-load-com)
  (if (and (findfile path)
           (setq f (open path "r"))
      )
    (progn

      ;; Error handler
      (defun *error* (msg)
        (cond
          ((not msg)) ; Normal exit
          ((member msg '("Function cancelled" "quit / exit abort"))) ; &amp;lt;esc&amp;gt; or (quit)
          ((princ (strcat "\n** Error: " msg " ** ")))
        ) ; Fatal error, display it
        (if f
          (close f)
        )
        (princ)
      )

      ;; Line extraction sub-function
      (defun extract (l /)
        (substr l 1 (vl-string-search "," l))
      )

      ;; Line trim sub-function
      (defun trim (v /)
        (vl-string-subst "" (strcat v ",") l)
      )

      ;; Main code
      (vla-startundomark
        (cond (activeDoc)
              ((setq activeDoc
                      (vla-get-activedocument
                        (vlax-get-acad-object)
                      )
               )
              )
        )
      )
      (read-line f) ; &amp;lt;- Skip first line (headers)
      (setq layerTable (vla-get-layers activeDoc))

      ;; Linetype check
      ;; &amp;lt;- Add linetype import code here, to avoid errors

      (while (/= nil (setq l (read-line f)))
          ;(progn

        ;; Layer check
          ;(if (not (tblsearch "layer" (setq layerName (extract l))))
        (cond ((not (tblsearch "layer" (setq layerName (extract l))))
               (setq layerItem (vla-add layerTable layerName))
          ;(setq layerItem (vla-item layerTable layerName)))

               ;; Layer settings
               (setq l (trim layerName))
               (vla-put-description
                 layerItem
                 (setq layerDescription (extract l))
               )
               (setq l (trim layerDescription))
               (if (/= 7 (setq layerColor (extract l)))
                 (vla-put-color layerItem layerColor)
               )
               (setq l (trim layerColor))
               (vla-put-linetype layerItem (setq layerLinetype (extract l)))
               (setq l (trim layerLinetype))
               (if (= "BYLAYER" (strcase (setq layerLineweight (extract l))))
                 (vla-put-lineweight layerItem aclnwtbylayer)
               )
               (setq l (trim layerLineweight))
               (if (/= "YES" (strcase (setq layerPlottable (extract l))))
                 (vla-put-plottable layerItem :vlax-false)
               )
               (setq l (trim layerPlottable))
               (if (/= "NO" (strcase (setq layerFreeze (extract l))))
                 (vla-put-freeze layerItem :vlax-true)
               )
              )
        )
      )
      (close f)
      (vla-endundomark activeDoc)
    )
  )
  (princ)
)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps, &lt;BR /&gt;Henrique&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2015 21:38:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5657848#M141129</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-05-29T21:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5658027#M141130</link>
      <description>&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/75977"&gt;@hmsilva&lt;/a&gt; - Not at all, my friend. *tips hat*&lt;BR /&gt;&lt;BR /&gt;@Anonymous - Not sure that Lee would appreciate the demotion, but I'm glad that you found my code useful. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; Haha&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;&lt;BR /&gt;BlackBox_ (fka RenderMan)</description>
      <pubDate>Sat, 30 May 2015 00:19:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5658027#M141130</guid>
      <dc:creator>BlackBox_</dc:creator>
      <dc:date>2015-05-30T00:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5659510#M141131</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1206685"&gt;@BlackBox_&lt;/a&gt; - my sincerest apologies!&amp;nbsp;&amp;nbsp; &lt;img id="smileyembarrassed" class="emoticon emoticon-smileyembarrassed" src="https://forums.autodesk.com/i/smilies/16x16_smiley-embarrassed.png" alt="Smiley Embarassed" title="Smiley Embarassed" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think I was a bit tangled up in the thread from which I swiped your (awesome) code... and I think I had Lee Mac's Import Linetype bundled in with the routine - so sorry for the mixup! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MRG&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2015 13:57:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5659510#M141131</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-01T13:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5659552#M141132</link>
      <description>&lt;P&gt;Thanks so much &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/75977"&gt;@hmsilva&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tested it our and it works perfectly! I see that you added a conditional function in there and changed&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vla-item layerTable layerName)&lt;/PRE&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;PRE&gt;(vla-add layerTable layerName)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for commenting out the original code so I could see how you approached it. I am alot more conversant in AutoLISP than anything else so I definintely need to study up a bit more vigorously before I start tweaking code &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also like the ability to reset the layers back to their standard settings, so I think I'll keep &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1206685"&gt;@BlackBox_&lt;/a&gt; 's original code and give the user the ability to overwrite and reset any changes to the layers if they need to go that route or just add any layers to the existing set that they may have purged out or deleted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again to you both!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MRG&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2015 14:18:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5659552#M141132</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-01T14:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5659577#M141133</link>
      <description>&lt;P&gt;You're welcome, muddyrunnergirl&lt;BR /&gt;Glad I could help&lt;BR /&gt;&lt;BR /&gt;Henrique&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2015 14:26:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5659577#M141133</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-06-01T14:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5659766#M141134</link>
      <description>&lt;P&gt;No worries,&amp;nbsp;@Anonymous; I'm flattered that&amp;nbsp;you found the (admittedly old) code useful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A quick aside regarding the Add() and Item() Methods as applied to the LayerTable; The Item() Method only returns a valid LayerTableRecord Object, otherwise error, whereas the Add() Method gets-or-creates said LayerTableRecord Object. So be sure to simplify your/my code accordingly, or as you please.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2015 16:23:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5659766#M141134</guid>
      <dc:creator>BlackBox_</dc:creator>
      <dc:date>2015-06-01T16:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5659871#M141135</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;....&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a Layer Import routine... where you import Layer definitions into your drawing from a CSV file. It works beautifully - EXCEPT that if any of the layer properties are modified (color, linetype, etc.) after the layer is imported from the CSV, and you re-import the layers into your drawing again from the CSV, it resets them back to their original properties as defined in the CSV.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like the command to function such that if it finds that the layer name already exists in the drawing, then it skips over importing it.&lt;/P&gt;
&lt;P&gt;....&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Another way you could do that would be to have a drawing containing all those standard Layers but with nothing actually &lt;EM&gt;drawn&lt;/EM&gt; in it, and simply &lt;EM&gt;Insert&lt;/EM&gt; it&amp;nbsp;into the current drawing&amp;nbsp;[pre-exploded so you won't be asked&amp;nbsp;whether you want to re-define it if you do it more than once in the same drawing].&amp;nbsp; If any of the same Layer names already&amp;nbsp;exist in the current drawing, their colors, linetypes, etc. will &lt;EM&gt;not&lt;/EM&gt; be affected by those properties of the same Layers in the source drawing, &lt;EM&gt;without&lt;/EM&gt; any need to check whether they exist yet, but any Layers in the source drawing that do &lt;EM&gt;not&lt;/EM&gt; already exist will come into the current drawing with their standard definitions.&amp;nbsp; Any changes to your standard Layer collection would be made by simply making&amp;nbsp;them in that source drawing, rather than by editing&amp;nbsp;a CSV file. &amp;nbsp;No code is necessary unless you choose to make a simple macro or define a simple command to perform that Insertion. &amp;nbsp;A single Insert command is all it takes, no matter how many Layers are involved -- no stepping through a whole series of CSV data.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2015 17:55:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5659871#M141135</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2015-06-01T17:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5660013#M141136</link>
      <description>&lt;P&gt;Hi Kent -&lt;/P&gt;
&lt;P&gt;Thanks for you input-- actually, that's the way that my company has done it for the past 20+ years.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We are currently overhauling our layer standards and are tweaking them pretty frequently. The CSV(s) will serve a two-fold purpose - in addition to being the main layer definition source for each of our firm's disciplines, I can also use it to create a PDF for distribution to keep the teams updated to what is happening with our layers in a table format. (read: I'm too lazy to generate a secondary reference document for now - lol).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once our layer updates have settled down and we are pretty dialed in, I plan to revert back to using a DWG to hold our layer definitions and serve as our template(s).... I like using the DWG Insert method because I get nervous sometimes that if things are done too programmatically then future generations at my firm may have to re-invent the wheel if they don't know too much LISP or other customization.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, having the "Layer Reset" feature via &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1206685"&gt;@BlackBox_&lt;/a&gt; 's original CSV Layer Import method will help during our transition as we convert legacy drawings that are called back into action that have layers whose names haven't changed, but whose colors have been updated per the new standards and we want to update the old drawings to match our new settings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So yes, you are totally on point (as usual) - once we are out of the woods with this standards update, I'll be doing just as you suggest. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MRG&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2015 19:16:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5660013#M141136</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-01T19:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5660096#M141137</link>
      <description>&lt;P&gt;FWIW - Just a bit of back-story:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This CSV utility was originally&amp;nbsp;developed for similar&amp;nbsp;reasons to what&amp;nbsp;@Anonymous&amp;nbsp;mentions - as an interim utility amid major standards overhaul - which, for us at the time, was when switching from Land Desktop to Civil 3D, following a corporate acquisition.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We did find later, that despite using the same layer names, we ended up wanting different colors (CTB based at the time) for Plan, Profile, Cross Section, etc., thus we ended up having a CSV file that corresponded to each allowing us to maintain once, standardize all on the fly (for those with modify permissions, of course).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2015 19:52:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5660096#M141137</guid>
      <dc:creator>BlackBox_</dc:creator>
      <dc:date>2015-06-01T19:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5894677#M141138</link>
      <description>&lt;P&gt;Hi, could you give me some tips on how to run your routine from AutoCAD?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not experienced with LISP so can't fathom which bit to modify. &amp;nbsp;Or is the above code run from another routine?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks anyway.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2015 17:29:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5894677#M141138</guid>
      <dc:creator>arkelec</dc:creator>
      <dc:date>2015-11-05T17:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5895656#M141139</link>
      <description>&lt;P&gt;Update:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can't for the life of me see how to edit my earlier post but for the benefit of anyone coming to this thread seeking an a solution..........&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found the answer on the CAD Tutor forum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Add the following code (modified to suit the .csv file name &amp;amp; path) to the top of the previously posted code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun c:ImportCSV (/) (RM:CSV-&amp;gt;Layers "Z:\\my_layers_folder\\my_layers.csv")  (princ))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.....where "ImportCSV" is the name of the lsp file (i.e.&amp;nbsp;&lt;SPAN&gt;ImportCSV.lsp).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hell, I wish I'd learned LISP.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And thanks to all the peopes who post this stuff for the benefit of the likes of me, I love you all &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2015 04:58:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5895656#M141139</guid>
      <dc:creator>arkelec</dc:creator>
      <dc:date>2015-11-06T04:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5895670#M141140</link>
      <description>&lt;P&gt;Erm, there is an error on the line of code I posted above. &amp;nbsp;Replace "&lt;SPAN&gt;ImportCSV" with "RM" &amp;amp; make the file RM.lsp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that covers it.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2015 05:30:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5895670#M141140</guid>
      <dc:creator>arkelec</dc:creator>
      <dc:date>2015-11-06T05:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5896157#M141141</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/482519"&gt;@arkelec﻿&lt;/a&gt;&amp;nbsp;-&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for the delayed response; I don't have&amp;nbsp;the free time to participate in the forums I used to, and just happened to stumble across the email notifications.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That said, the code here and linked at CADTutor can load any valid .CSV file path/name; they need not be named something specifc (i.e., oldLayers.csv, newLayers.csv, electric.csv, sanitary.csv, drainage.csv, etc.).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For this 'mechanism' to work, you need both the supported&amp;nbsp;.CSV format, the RM:CSV-&amp;gt;Layers sub-function must be loaded (once per drawing), and then any subsequent calls to same (supplying valid .CSV file path/name) will work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2015 13:13:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5896157#M141141</guid>
      <dc:creator>BlackBox_</dc:creator>
      <dc:date>2015-11-06T13:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5995323#M141142</link>
      <description>&lt;P&gt;I am trying really hard, but I just can't get this to work for me. I have about 180 layers in a CSV file that I'm trying to import into AutoCAD. I copied the LSP info noted above into an LSP file, set the file in the search path, loaded the LSP using APPLOAD command, and it doesn't do anything. My file name is mylayers.csv.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't figure out exactly where to put &amp;nbsp;the file name and path into the LSP file. Or if it even belongs in it. There were two different LSP routines listed in this thread, then another one line modification to be added. I'm just lost.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have a particular tip that could unlock the secret? It seems really easy.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2016 12:29:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5995323#M141142</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-19T12:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5995841#M141143</link>
      <description>&lt;P&gt;Nothing secret about it - there's just some basics that have to be done; once you learn those the rest come easy.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are only a few key components... There's the "RM:CSV-&amp;gt;Layers" sub-function (the code that does the work), there's the "ImportCSV" custom command (the single-line code that 'loads' a specific .CSV file), and then there's getting it all loaded for you to use.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Copy&amp;nbsp;the larger &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;RM:CSV-&amp;gt;Layers"&lt;/SPAN&gt;&amp;nbsp;code snippet from the first page of this thread, and saved it to a .LSP file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next copy the&amp;nbsp;"ImportCSV" code, and place it at the bottom of the same .LSP file (and save, of course).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now load that LISP routine - you mentioned AppLoad, I prefer to use AcadDoc.lsp - loading this LISP routine with both code snippets in it loads both the custom command, and the dependent sub-function the custom command uses.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once loaded (in any way you choose), you simply invoke the "&lt;SPAN&gt;ImportCSV&lt;/SPAN&gt;" custom command at the command line, and done.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2016 16:57:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5995841#M141143</guid>
      <dc:creator>BlackBox_</dc:creator>
      <dc:date>2016-01-19T16:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5998516#M141144</link>
      <description>&lt;P&gt;&lt;U&gt;Wow thank you for the clear explanation!!!&lt;/U&gt; &amp;nbsp;I got everything done correctly, and the IMPORTCSV even appears as a suggestion command when I start typing it in on the command line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It looks like the routine loads up like its supposed to except I get this...&lt;STRONG&gt;error: vl-load-com not supported on &amp;nbsp;"Mac OS X Version 10.11 (x86_64)"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This looks like really bad news, it may not work on AutoCAD for MAC 2016? &amp;nbsp;I found some info saying that the MAC versions don't support Visual LISP. Man, this is bad news.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 01:05:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5998516#M141144</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-21T01:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5998557#M141145</link>
      <description>&lt;P&gt;Bummer - while I'm glad that I was able to help you get to this point, had I known you were using Mac I would have approached this differently.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That said, while I work in Win10, I'm confident&amp;nbsp;that I can refactor this to work with Mac's (alveit limited) AutoLISP API... And if not, I *may* have some tricks up my sleeve.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;as an example of what can still be done using LISP for Mac (which also works on Win), here's a routine that adds a prefix to all LayerTableRecords (that are not "0" or "Defpoints", that is):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-rename-layer-lisp-for-autocad-mac/td-p/3840760" target="_blank"&gt;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-rename-layer-lisp-for-autocad-mac/td-p/3840760&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 01:59:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5998557#M141145</guid>
      <dc:creator>BlackBox_</dc:creator>
      <dc:date>2016-01-21T01:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5998568#M141146</link>
      <description>&lt;P&gt;I am essentially trying to get the AIA layer standards set up in a drawing template. I'm a small outfit trying to get on board with basic current standards and I can't believe how hard it is to get this accomplished.&amp;nbsp;I've spent hours searching.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why would national AutoCAD layer standards not be something that's readily available to anyone who needs them? How else does it become a standard if its so hard to get&amp;nbsp;it&amp;nbsp;into an AutoCAD drawing template? Without the good will of someone like you on the internet, it would take days to enter them all in by hand and check/double check them for accuracy.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 02:12:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/5998568#M141146</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-21T02:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Layer Import from CSV - evaulate if layer exists first?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/9833225#M141147</link>
      <description>&lt;P&gt;Do you have an example of the CSV file you were using along with this LISP?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 20:17:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-import-from-csv-evaulate-if-layer-exists-first/m-p/9833225#M141147</guid>
      <dc:creator>jkreger5P63A</dc:creator>
      <dc:date>2020-10-29T20:17:04Z</dc:date>
    </item>
  </channel>
</rss>

