<?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: Erase attribute inside block in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/erase-attribute-inside-block/m-p/11288755#M12417</link>
    <description>&lt;P&gt;I've solved to erase/rename attribute and it works for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;foreach (ObjectId blkId in objectIds)&lt;BR /&gt;{&lt;BR /&gt;BlockReference blkRef = (BlockReference)acTrans.GetObject(blkId, OpenMode.ForRead);&lt;BR /&gt;BlockTable acBlkTbl = acTrans.GetObject(acDocDb.BlockTableId, OpenMode.ForRead, false, true) as BlockTable;&lt;BR /&gt;BlockTableRecord acBlkTblRec = acTrans.GetObject(acBlkTbl[blkRef.Name], OpenMode.ForRead, false, true) as BlockTableRecord;&lt;/P&gt;&lt;P&gt;foreach (ObjectId attId in blkRef.AttributeCollection)&lt;BR /&gt;{&lt;BR /&gt;AttributeReference attRef = (AttributeReference)acTrans.GetObject(attId, OpenMode.ForRead);&lt;/P&gt;&lt;P&gt;string tag = attRef.Tag.ToUpper();&lt;BR /&gt;if (tag.StartsWith("AAA_"))&lt;BR /&gt;{&lt;BR /&gt;attRef.UpgradeOpen();&lt;BR /&gt;attRef.Erase();&lt;BR /&gt;attRef.DowngradeOpen();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;foreach (ObjectId id in acBlkTblRec)&lt;BR /&gt;{&lt;BR /&gt;DBObject obj = id.GetObject(OpenMode.ForRead);&lt;BR /&gt;AttributeDefinition attDef = obj as AttributeDefinition;&lt;/P&gt;&lt;P&gt;if (attDef != null &amp;amp;&amp;amp; !attDef.Constant)&lt;BR /&gt;{&lt;BR /&gt;if (attDef.Tag.StartsWith("AAA_"))&lt;BR /&gt;{&lt;BR /&gt;attDef.UpgradeOpen();&lt;BR /&gt;attDef.Erase();&lt;BR /&gt;attDef.DowngradeOpen();&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jul 2022 01:32:43 GMT</pubDate>
    <dc:creator>kebby70</dc:creator>
    <dc:date>2022-07-11T01:32:43Z</dc:date>
    <item>
      <title>Erase attribute inside block</title>
      <link>https://forums.autodesk.com/t5/net-forum/erase-attribute-inside-block/m-p/11288399#M12414</link>
      <description>&lt;P&gt;I've erased attribute and correctlty erased.&lt;/P&gt;&lt;P&gt;but remained attribute inside block.(block edit)&lt;/P&gt;&lt;P&gt;Please See below code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BlockReference blkRef = (BlockReference)acTrans.GetObject(blkId, OpenMode.ForWrite);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;foreach (ObjectId attId in blkRef.AttributeCollection)&lt;BR /&gt;{&lt;BR /&gt;AttributeReference attRef = (AttributeReference)acTrans.GetObject(attId, OpenMode.ForWrite);&lt;/P&gt;&lt;P&gt;string tag = attRef.Tag.ToUpper();&lt;BR /&gt;string tagValue = attRef.TextString;&lt;/P&gt;&lt;P&gt;&amp;nbsp;if (attRef.Tag.StartsWith("test"))&lt;BR /&gt;{&lt;BR /&gt;attRef.Erase();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jul 2022 17:16:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/erase-attribute-inside-block/m-p/11288399#M12414</guid>
      <dc:creator>kebby70</dc:creator>
      <dc:date>2022-07-10T17:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Erase attribute inside block</title>
      <link>https://forums.autodesk.com/t5/net-forum/erase-attribute-inside-block/m-p/11288515#M12415</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;May add&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Comment&amp;nbsp;&lt;SPAN&gt;ATTSYNC&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jul 2022 19:57:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/erase-attribute-inside-block/m-p/11288515#M12415</guid>
      <dc:creator>hosneyalaa</dc:creator>
      <dc:date>2022-07-10T19:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Erase attribute inside block</title>
      <link>https://forums.autodesk.com/t5/net-forum/erase-attribute-inside-block/m-p/11288618#M12416</link>
      <description>&lt;P&gt;Thanks hosneyalaa,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Erase attribue inside the block&lt;/P&gt;&lt;P&gt;2. Correctlry erased on attribute window or current drawing.&lt;/P&gt;&lt;P&gt;2. But Explode or Enter the block, remained attribute.&lt;/P&gt;&lt;P&gt;3. Block is rollbacked because the block has erased attribute if use ATTSYNC,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to erase attribute defination entity inside block.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jul 2022 22:36:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/erase-attribute-inside-block/m-p/11288618#M12416</guid>
      <dc:creator>kebby70</dc:creator>
      <dc:date>2022-07-10T22:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: Erase attribute inside block</title>
      <link>https://forums.autodesk.com/t5/net-forum/erase-attribute-inside-block/m-p/11288755#M12417</link>
      <description>&lt;P&gt;I've solved to erase/rename attribute and it works for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;foreach (ObjectId blkId in objectIds)&lt;BR /&gt;{&lt;BR /&gt;BlockReference blkRef = (BlockReference)acTrans.GetObject(blkId, OpenMode.ForRead);&lt;BR /&gt;BlockTable acBlkTbl = acTrans.GetObject(acDocDb.BlockTableId, OpenMode.ForRead, false, true) as BlockTable;&lt;BR /&gt;BlockTableRecord acBlkTblRec = acTrans.GetObject(acBlkTbl[blkRef.Name], OpenMode.ForRead, false, true) as BlockTableRecord;&lt;/P&gt;&lt;P&gt;foreach (ObjectId attId in blkRef.AttributeCollection)&lt;BR /&gt;{&lt;BR /&gt;AttributeReference attRef = (AttributeReference)acTrans.GetObject(attId, OpenMode.ForRead);&lt;/P&gt;&lt;P&gt;string tag = attRef.Tag.ToUpper();&lt;BR /&gt;if (tag.StartsWith("AAA_"))&lt;BR /&gt;{&lt;BR /&gt;attRef.UpgradeOpen();&lt;BR /&gt;attRef.Erase();&lt;BR /&gt;attRef.DowngradeOpen();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;foreach (ObjectId id in acBlkTblRec)&lt;BR /&gt;{&lt;BR /&gt;DBObject obj = id.GetObject(OpenMode.ForRead);&lt;BR /&gt;AttributeDefinition attDef = obj as AttributeDefinition;&lt;/P&gt;&lt;P&gt;if (attDef != null &amp;amp;&amp;amp; !attDef.Constant)&lt;BR /&gt;{&lt;BR /&gt;if (attDef.Tag.StartsWith("AAA_"))&lt;BR /&gt;{&lt;BR /&gt;attDef.UpgradeOpen();&lt;BR /&gt;attDef.Erase();&lt;BR /&gt;attDef.DowngradeOpen();&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 01:32:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/erase-attribute-inside-block/m-p/11288755#M12417</guid>
      <dc:creator>kebby70</dc:creator>
      <dc:date>2022-07-11T01:32:43Z</dc:date>
    </item>
  </channel>
</rss>

