<?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: disable layer creation in active scene when adding new xref files? in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/disable-layer-creation-in-active-scene-when-adding-new-xref/m-p/4020381#M26532</link>
    <description>I use this all the time to clean up cad layers &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; .. the deletelayerbyname will only delete empty layers.. so its safe to try it on everything in the list.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;--Delete all layers that have no objects in them and are not the current layer&lt;BR /&gt;&lt;BR /&gt;LayDelete = #()&lt;BR /&gt;for i = 1 to (LayerManager.count-1) do &lt;BR /&gt;(&lt;BR /&gt;    append LayDelete (LayerManager.getlayer i).name&lt;BR /&gt;)&lt;BR /&gt;print LayDelete&lt;BR /&gt;for i = 1 to LayDelete.count do&lt;BR /&gt;(&lt;BR /&gt;    LayerManager.deleteLayerByName LayDelete&lt;I&gt;&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;/I&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 10 Jul 2008 01:56:33 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2008-07-10T01:56:33Z</dc:date>
    <item>
      <title>disable layer creation in active scene when adding new xref files?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/disable-layer-creation-in-active-scene-when-adding-new-xref/m-p/4020380#M26531</link>
      <description>Hey users and staffers,&lt;BR /&gt;&lt;BR /&gt;In 3dsmax 2009,&lt;BR /&gt;&lt;BR /&gt;Since loadMaterialLibrary function does not accept a .max file argument string (although the material editor allows it),&lt;BR /&gt;as a work around, I wrote a function that:&lt;BR /&gt; * adds a file as an xref scene using xrefs.addNewXRefFile&lt;BR /&gt; * reads in its materials&lt;BR /&gt; * deletes that xref scene.&lt;BR /&gt;&lt;BR /&gt;Unfortunately, if I employ this in a loop over a large list of scenes, I end up with my original scene &lt;BR /&gt;having a copy of every layer from every xrefscene I referenced and deleted.&lt;BR /&gt;&lt;BR /&gt;In some simple tests, layermanager.count is as high as 76 (76 empty layers) when I  am done.&lt;BR /&gt;But I am sure in my production environment, our staff could find a way to make that much higher.&lt;BR /&gt;&lt;BR /&gt;I have 4 questions:&lt;BR /&gt;&lt;BR /&gt;1. is there a built in, documented or undocumented method, by which I can load a .max file as a material library?&lt;BR /&gt;(if so, I can skip using my function)&lt;BR /&gt;&lt;BR /&gt;2. is there a way to disable automatic importing of layers when I xrefscene a .max file?&lt;BR /&gt;(if so, I can disable that and continue happy).&lt;BR /&gt;&lt;BR /&gt;3. if neither 1 nor 2, are the left-over empty layers considered a bug or a feature of the layermanager and xrefscene nodes?&lt;BR /&gt;&lt;BR /&gt;4. if neither 1 nor 2, is there a better work around? Since I have to pay most of the cost of loading the scene anyways, I am open to ideas.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;-epu</description>
      <pubDate>Tue, 08 Jul 2008 04:40:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/disable-layer-creation-in-active-scene-when-adding-new-xref/m-p/4020380#M26531</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-07-08T04:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: disable layer creation in active scene when adding new xref files?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/disable-layer-creation-in-active-scene-when-adding-new-xref/m-p/4020381#M26532</link>
      <description>I use this all the time to clean up cad layers &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; .. the deletelayerbyname will only delete empty layers.. so its safe to try it on everything in the list.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;--Delete all layers that have no objects in them and are not the current layer&lt;BR /&gt;&lt;BR /&gt;LayDelete = #()&lt;BR /&gt;for i = 1 to (LayerManager.count-1) do &lt;BR /&gt;(&lt;BR /&gt;    append LayDelete (LayerManager.getlayer i).name&lt;BR /&gt;)&lt;BR /&gt;print LayDelete&lt;BR /&gt;for i = 1 to LayDelete.count do&lt;BR /&gt;(&lt;BR /&gt;    LayerManager.deleteLayerByName LayDelete&lt;I&gt;&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;/I&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Jul 2008 01:56:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/disable-layer-creation-in-active-scene-when-adding-new-xref/m-p/4020381#M26532</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-07-10T01:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: disable layer creation in active scene when adding new xref files?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/disable-layer-creation-in-active-scene-when-adding-new-xref/m-p/4020382#M26533</link>
      <description>Thanks, you're right!&lt;BR /&gt;Empty layers can be cleaned easily.&lt;BR /&gt;&lt;BR /&gt;Hopefully the bugs and features can get addressed in another version of 3dsmax.</description>
      <pubDate>Thu, 10 Jul 2008 05:33:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/disable-layer-creation-in-active-scene-when-adding-new-xref/m-p/4020382#M26533</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-07-10T05:33:31Z</dc:date>
    </item>
  </channel>
</rss>

