<?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 Betreff: Manipulate the Layer Manager using VBA - or other code in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/11855915#M1692</link>
    <description>&lt;DIV class="lia-message-subject lia-component-message-view-widget-subject"&gt;
&lt;DIV class="MessageSubject"&gt;
&lt;DIV class="MessageSubjectIcons "&gt;
&lt;DIV class="lia-message-subject"&gt;Hi,&lt;/DIV&gt;
&lt;DIV class="lia-message-subject"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="lia-message-subject"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="lia-message-subject"&gt;&lt;EM&gt;&amp;gt;&amp;gt;"Manipulate the Layer Manager using VBA"&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV class="lia-message-subject"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="lia-message-subject"&gt;I think you can't manipulate the Layerproperties-Manager&lt;/DIV&gt;
&lt;DIV class="lia-message-subject"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV id="bodyDisplay" class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;
&lt;DIV class="lia-message-body-content"&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;gt;"I want to manipulate the Layer Manager by adding Property"&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Wether existing properties, else your own properties (becaus you can not manipulate this dialog and you can not add properties to the layerobject)&lt;/P&gt;
&lt;P&gt;Perhaps you mean that you want to edit layer properties VALUEs?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt; &amp;gt;&amp;gt;"and Group Filters"&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Sure, if there are no Api-method (but I guess there is), you can also use sendcommand&lt;/P&gt;
&lt;P&gt;to add or remove Layer Groupfilters&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;"and to add new layers using VBA"&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;No problem&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt; &amp;gt;&amp;gt;"or some other code that I am to run as a macro from the Manage Tab."&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;from wherever you want, from commandline, buttons, toolpalettes,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;gt;"Before I start the process of writing the code, is this do-able please?"&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I think the layer properties manager part wasn't very clear,&lt;BR /&gt;you should explain that in more detail.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds you never programmed kin AutoCAD before&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Wed, 29 Mar 2023 11:06:14 GMT</pubDate>
    <dc:creator>cadffm</dc:creator>
    <dc:date>2023-03-29T11:06:14Z</dc:date>
    <item>
      <title>Manipulate the Layer Manager using VBA - or other code</title>
      <link>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/11855878#M1691</link>
      <description>&lt;P&gt;I want to manipulate the Layer Manager by adding Property and Group Filters and to add new layers using VBA or some other code that I am to run as a macro from the Manage Tab.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Before I start the process of writing the code, is this do-able please?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 10:51:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/11855878#M1691</guid>
      <dc:creator>cve60069</dc:creator>
      <dc:date>2023-03-29T10:51:29Z</dc:date>
    </item>
    <item>
      <title>Betreff: Manipulate the Layer Manager using VBA - or other code</title>
      <link>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/11855915#M1692</link>
      <description>&lt;DIV class="lia-message-subject lia-component-message-view-widget-subject"&gt;
&lt;DIV class="MessageSubject"&gt;
&lt;DIV class="MessageSubjectIcons "&gt;
&lt;DIV class="lia-message-subject"&gt;Hi,&lt;/DIV&gt;
&lt;DIV class="lia-message-subject"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="lia-message-subject"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="lia-message-subject"&gt;&lt;EM&gt;&amp;gt;&amp;gt;"Manipulate the Layer Manager using VBA"&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV class="lia-message-subject"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="lia-message-subject"&gt;I think you can't manipulate the Layerproperties-Manager&lt;/DIV&gt;
&lt;DIV class="lia-message-subject"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV id="bodyDisplay" class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;
&lt;DIV class="lia-message-body-content"&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;gt;"I want to manipulate the Layer Manager by adding Property"&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Wether existing properties, else your own properties (becaus you can not manipulate this dialog and you can not add properties to the layerobject)&lt;/P&gt;
&lt;P&gt;Perhaps you mean that you want to edit layer properties VALUEs?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt; &amp;gt;&amp;gt;"and Group Filters"&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Sure, if there are no Api-method (but I guess there is), you can also use sendcommand&lt;/P&gt;
&lt;P&gt;to add or remove Layer Groupfilters&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;"and to add new layers using VBA"&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;No problem&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt; &amp;gt;&amp;gt;"or some other code that I am to run as a macro from the Manage Tab."&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;from wherever you want, from commandline, buttons, toolpalettes,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;gt;"Before I start the process of writing the code, is this do-able please?"&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I think the layer properties manager part wasn't very clear,&lt;BR /&gt;you should explain that in more detail.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds you never programmed kin AutoCAD before&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 29 Mar 2023 11:06:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/11855915#M1692</guid>
      <dc:creator>cadffm</dc:creator>
      <dc:date>2023-03-29T11:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulate the Layer Manager using VBA - or other code</title>
      <link>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/11855937#M1693</link>
      <description>&lt;P&gt;Thank you for the reply.&amp;nbsp; I am very versed in coding using VBA; its the Layer manager I am having trouble accessing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to open a blank drawing and run a macro that will add my Layer Filters into the Layers manager (see snip).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 11:13:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/11855937#M1693</guid>
      <dc:creator>cve60069</dc:creator>
      <dc:date>2023-03-29T11:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulate the Layer Manager using VBA - or other code</title>
      <link>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/11856004#M1694</link>
      <description>&lt;P&gt;I refer to the &lt;A href="https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-A809CD71-4655-44E2-B674-1FE200B9FE30" target="_blank" rel="noopener"&gt;datamodel&lt;/A&gt;:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MichielValcke_0-1680089811820.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1195120i3912EF87D217186F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MichielValcke_0-1680089811820.png" alt="MichielValcke_0-1680089811820.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can create your own layers in VBA without trouble :&amp;nbsp;&lt;BR /&gt;&lt;A href="https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-14F28A52-81E5-4CD0-AA79-ADC09E91BB8C" target="_blank"&gt;https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-14F28A52-81E5-4CD0-AA79-ADC09E91BB8C&lt;/A&gt;&lt;BR /&gt;You just need to grab the application, then document then layer collection&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I don't think there's a way to create layer filters with vba, but it is easily done by lisp/macro or script by mimicking the command line input:&lt;BR /&gt;&lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/script-or-lisp-to-create-layer-filter/td-p/7764754" target="_blank"&gt;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/script-or-lisp-to-create-layer-filter/td-p/7764754&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 11:43:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/11856004#M1694</guid>
      <dc:creator>Michiel.Valcke</dc:creator>
      <dc:date>2023-03-29T11:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulate the Layer Manager using VBA - or other code</title>
      <link>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/11856037#M1695</link>
      <description>&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Knew it could be done.&amp;nbsp; I need to learn a bit of Lisp.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 11:58:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/11856037#M1695</guid>
      <dc:creator>cve60069</dc:creator>
      <dc:date>2023-03-29T11:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulate the Layer Manager using VBA - or other code</title>
      <link>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/11856070#M1696</link>
      <description>&lt;P&gt;Example of ones we use in Civil 3D:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;; (load "LayFilterAdd.lsp")
; ^C^C^P(or LayFilterAdd (load "LayFilterAdd.lsp"));(LayFilterAdd)
; [B][COLOR="#FF0000"]Newer versions automatically display Xref Layer Filters **Adding Xref Layer Filter names the same as them can cause serious issues**[/COLOR][/B]
; Save, close and reopen the DWT or DWG for the Filters to be put into alphabetical order.
(defun LayFilterAdd (/ collection names)
;  (load "LFD.lsp")
;  (command "C:LFD" "All*") *Layers
  (setq names (list ""))
  (if (not (vl-catch-all-error-p (setq collection (vl-catch-all-apply
    (function (lambda () (vla-item (vla-getextensiondictionary (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))) "ACAD_LAYERFILTERS")))
  ))))
;  (vlax-for item collection (setq names (cons (strcase (vla-get-name item)) names))))
  (vlax-for item collection (setq names (cons (vla-get-name item) names))))
  names 
  (or(member "CALC Points" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"V-NODE-CALC\" or NAME== \"Layer*\"" "CALC Points" "X" nil))
  (or(member "HATCH No xrefs" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"~*|*\" and NAME==\"*HATCH\"" "HATCH No xrefs" "X" nil))
  (or(member "Linetype" names)(command "._-layer" "filter" "new" "property" "All" "LINETYPE==\"~Continuous\"" "Linetype" "X" nil))
  (or(member "Lineweight" names)(command "._-layer" "filter" "new" "property" "All" "LINEWEIGHT==\"~Default\"" "Lineweight" "X" nil))
  (or(member "NCS" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"[A,C,E,L,V]-*\" or NAME== \"Layer*\"" "NCS" "X" nil))
  (or(member "NCS No xrefs" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"~*|*\" and NAME==\"[A,C,E,L,V]-*\" or NAME== \"Layer*\"" "NCS No xrefs" "X" nil))
  (or(member "No NCS" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"~[A,C,E,L,V]-*\"" "No NCS" "X" nil))
  (or(member "No NCS or xrefs" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"~*|*\" and NAME==\"~[A,C,E,L,V]-*\"" "No NCS or xrefs" "X" nil))
  (or(member "No NODE" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"~*|*\" and NAME==\"[A,C,E,L,V]-*\" and NAME==\"~*-NODE*\" or NAME== \"Layer*\"" "No NODE" "X" nil))
  (or(member "NODE" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"~*|*\" and NAME==\"[A,C,E,L,V]-*\" and NAME==\"*-NODE*\" or NAME== \"Layer*\"" "NODE" "X" nil))
  (or(member "Profile" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"C-ROAD-PROF*\" or NAME== \"Layer*\"" "Profile" "X" nil))
  (or(member "Sections" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"C-ROAD-SEC*\" or NAME== \"Layer*\"" "Sections" "X" nil))
  (or(member "Topo" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"C-TOPO*\" or NAME== \"Layer*\"" "Topo" "X" nil))
  (princ "Layer Filter Names » ")(princ names)
;  (princ "\nSave, close and reopen the DWT or DWG for the Filters to be put into alphabetical order.")
  (princ)
); function
(LayFilterAdd)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;STRONG&gt; Note:&amp;nbsp;All recent AutoCAD versions &amp;amp; verticles automatically display Xref Layer Filters **Adding Xref Layer Filter names the same as them can cause serious issues**!&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 12:10:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/11856070#M1696</guid>
      <dc:creator>TomBeauford</dc:creator>
      <dc:date>2023-03-29T12:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulate the Layer Manager using VBA - or other code</title>
      <link>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/11856130#M1697</link>
      <description>&lt;P&gt;You can also use command -LAYER, so you don't need lisp api ()&lt;/P&gt;
&lt;P&gt;See beaufordts Code, no Lisp-API needed, just simple controle of the native -layer command is enough.&lt;/P&gt;
&lt;P&gt;In VBA you are usinf sendcommand to do it.&lt;/P&gt;
&lt;P&gt;(But of course,&amp;nbsp;&amp;nbsp; in Lisp API you have also other wayS&amp;nbsp; to work with layerfilters)&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 12:45:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/11856130#M1697</guid>
      <dc:creator>cadffm</dc:creator>
      <dc:date>2023-03-29T12:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulate the Layer Manager using VBA - or other code</title>
      <link>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/11877213#M1698</link>
      <description>&lt;P&gt;Dear All&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the advice.&amp;nbsp; I am having to work on other work at the moment but I shall be returning to this topic when I start the code.&amp;nbsp; I will publish my results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 10:28:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/11877213#M1698</guid>
      <dc:creator>cve60069</dc:creator>
      <dc:date>2023-04-06T10:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulate the Layer Manager using VBA - or other code</title>
      <link>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/12269786#M1699</link>
      <description>&lt;P&gt;Dear&amp;nbsp;&lt;SPAN class=""&gt; &lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/540307" target="_self"&gt;&lt;SPAN class=""&gt;TomBeauford&lt;/SPAN&gt;&lt;/A&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Thanks for the code. It works perfectly and I am going to have very little work to make it work for my filters.&amp;nbsp; Brilliant.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 11:21:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/12269786#M1699</guid>
      <dc:creator>cve60069</dc:creator>
      <dc:date>2023-09-27T11:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulate the Layer Manager using VBA - or other code</title>
      <link>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/12269789#M1700</link>
      <description>&lt;P&gt;Thanks for the link.&amp;nbsp; The code was perfect.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 11:22:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/manipulate-the-layer-manager-using-vba-or-other-code/m-p/12269789#M1700</guid>
      <dc:creator>cve60069</dc:creator>
      <dc:date>2023-09-27T11:22:29Z</dc:date>
    </item>
  </channel>
</rss>

