<?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: Change block layer - NOT blockreference in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/change-block-layer-not-blockreference/m-p/6432035#M35401</link>
    <description>Thanks !</description>
    <pubDate>Tue, 12 Jul 2016 17:59:04 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-07-12T17:59:04Z</dc:date>
    <item>
      <title>Change block layer - NOT blockreference</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-block-layer-not-blockreference/m-p/6431518#M35397</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am working with C#.&lt;/P&gt;&lt;P&gt;I have got a dwg with defined blocks in different layers - but not layer 0. I am able to change blockreferences layer. But, how can I have access to block layer ? - again not blockreference- to put it back on layer 0.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2016 14:48:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-block-layer-not-blockreference/m-p/6431518#M35397</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-07-12T14:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Change block layer - NOT blockreference</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-block-layer-not-blockreference/m-p/6431651#M35398</link>
      <description>&lt;P&gt;Block, or block definition, or BlockTableRecord (assuming you use C# with Acad .NET API) itself does not have "layer" property for you to change. It is the entities contained inside the block definition that have "layer" associated. So, you need to go inside a block definition and examine/change each entity's layer property as needed. The code would look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;using (var tran=theDatabase.TransactionManager.StartTransaction())&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; var bt=(BlockTable)tran.GetObject(myDatabase.BlockTableId, OpenMode.ForRead);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; if (bt.Has(theBlockName)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var br=(BlockTableRecord)tran.GetObject(bt[theBlockName], OpenMode.ForRead);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; foreach (ObjectId id in br)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var ent=(Entity)tran.GetObject(id,OpenMode.ForRead);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ent.Layer!="0")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ent.UpgradeOpen();&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ent.Layer="0";&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; tran.Commit()&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2016 15:32:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-block-layer-not-blockreference/m-p/6431651#M35398</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2016-07-12T15:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Change block layer - NOT blockreference</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-block-layer-not-blockreference/m-p/6431922#M35399</link>
      <description>Hello,&lt;BR /&gt;thanks a lot for your solution. It works perfectly.&lt;BR /&gt;You are right, I wanted to change layers from all entities within the&lt;BR /&gt;block definition. Your solution is easier than the one I was working on&lt;BR /&gt;: explode the block, change layers, reconstruct an object, and then a&lt;BR /&gt;block ...&lt;BR /&gt;By the way, what is the command to set color for entities to "color from&lt;BR /&gt;layer" ?&lt;BR /&gt;Thanks again</description>
      <pubDate>Tue, 12 Jul 2016 17:13:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-block-layer-not-blockreference/m-p/6431922#M35399</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-07-12T17:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Change block layer - NOT blockreference</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-block-layer-not-blockreference/m-p/6432004#M35400</link>
      <description>&lt;P&gt;You set Color or ColorIndex proeprty of an Entity. To set color to "ByLayer", you can simply&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Entity.ColorIndex=256;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2016 17:48:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-block-layer-not-blockreference/m-p/6432004#M35400</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2016-07-12T17:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: Change block layer - NOT blockreference</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-block-layer-not-blockreference/m-p/6432035#M35401</link>
      <description>Thanks !</description>
      <pubDate>Tue, 12 Jul 2016 17:59:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-block-layer-not-blockreference/m-p/6432035#M35401</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-07-12T17:59:04Z</dc:date>
    </item>
  </channel>
</rss>

