<?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: modify attributes in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/modify-attributes/m-p/5632141#M40135</link>
    <description>&lt;P&gt;Have you tried?&lt;/P&gt;&lt;PRE&gt;ar.AdjustAlignment(db);&lt;/PRE&gt;</description>
    <pubDate>Wed, 13 May 2015 03:17:43 GMT</pubDate>
    <dc:creator>jeff</dc:creator>
    <dc:date>2015-05-13T03:17:43Z</dc:date>
    <item>
      <title>modify attributes</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-attributes/m-p/5631971#M40134</link>
      <description>&lt;P&gt;i have a routine that opens a drawing with a block that contains attributes and then updated some of the attributes. &amp;nbsp;my issue is when i have the routine open the drawing and modify the attributes. they don't display unless you dbl click on the block and then the attributes are justified wrong. &amp;nbsp;when i comment out the .Open and manually open the file the rest of the routine works fine. &amp;nbsp;i am at a loss.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public static void GenerateDESD()&lt;BR /&gt;{&lt;BR /&gt;string FileLocation = @"\\fserve01\cad$\Auto_temps\double end stud.DWG";&lt;BR /&gt;Autodesk.AutoCAD.ApplicationServices.DocumentCollection DocColdesd&lt;BR /&gt;= Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager;&lt;/P&gt;&lt;P&gt;Autodesk.AutoCAD.ApplicationServices.DocumentCollection docCol = DocColdesd;&lt;BR /&gt;Document acDoc = Autodesk.AutoCAD.ApplicationServices.DocumentCollectionExtension.Open(docCol, FileLocation, false);&lt;BR /&gt;DocColdesd.MdiActiveDocument = acDoc;&lt;BR /&gt;Editor ed = acDoc.Editor;&lt;BR /&gt;Database db = acDoc.Database;&lt;BR /&gt;&lt;BR /&gt;using (var lk = acDoc.LockDocument())&lt;BR /&gt;{&lt;BR /&gt;using (Transaction Tx = acDoc.Database.TransactionManager.StartTransaction())&lt;BR /&gt;{&lt;BR /&gt;BlockTable bt = (BlockTable)Tx.GetObject(acDoc.Database.BlockTableId, OpenMode.ForRead, true);&lt;BR /&gt;BlockTableRecord btr = (BlockTableRecord)Tx.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);&lt;/P&gt;&lt;P&gt;foreach (ObjectId bref in btr)&lt;BR /&gt;{&lt;BR /&gt;if (bref.ObjectClass.Name == "AcDbBlockReference")&lt;BR /&gt;{&lt;BR /&gt;BlockReference currentBlockRef = Tx.GetObject(bref, OpenMode.ForRead) as BlockReference;&lt;BR /&gt;if (currentBlockRef.Name == "DESD")&lt;BR /&gt;{&lt;BR /&gt;foreach (ObjectId arId in currentBlockRef.AttributeCollection)&lt;BR /&gt;{&lt;BR /&gt;DBObject obj =Tx.GetObject(arId,OpenMode.ForWrite );&lt;BR /&gt;AttributeReference ar = obj as AttributeReference;&lt;BR /&gt;if (ar != null)&lt;BR /&gt;{&lt;BR /&gt;if (ar.Tag.ToUpper() == "8")&lt;BR /&gt;{&lt;BR /&gt;ar.TextString = "test"; &amp;nbsp;//just updating one attribute for this example&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;Tx.Commit();&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 22:15:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-attributes/m-p/5631971#M40134</guid>
      <dc:creator>bherber</dc:creator>
      <dc:date>2015-05-12T22:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: modify attributes</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-attributes/m-p/5632141#M40135</link>
      <description>&lt;P&gt;Have you tried?&lt;/P&gt;&lt;PRE&gt;ar.AdjustAlignment(db);&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 May 2015 03:17:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-attributes/m-p/5632141#M40135</guid>
      <dc:creator>jeff</dc:creator>
      <dc:date>2015-05-13T03:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: modify attributes</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-attributes/m-p/5633379#M40136</link>
      <description>&lt;P&gt;it didnt make any difference. what is odd is the method works fine if you manually open the drawing but if you let the code open the drawing, that is when the issues suraface.&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2015 16:42:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-attributes/m-p/5633379#M40136</guid>
      <dc:creator>bherber</dc:creator>
      <dc:date>2015-05-13T16:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: modify attributes</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-attributes/m-p/5640737#M40137</link>
      <description>&lt;A target="_blank" href="http://adndevblog.typepad.com/autocad/2012/07/using-readdwgfile-with-net-attachxref-or-objectarx-acdbattachxref.html"&gt;http://adndevblog.typepad.com/autocad/2012/07/using-readdwgfile-with-net-attachxref-or-objectarx-acdbattachxref.html&lt;/A&gt; may be helpful And check this too. &lt;A target="_blank" href="http://adndevblog.typepad.com/autocad/2012/07/using-readdwgfile-with-net-attachxref-or-objectarx-acdbattachxref.html"&gt;http://adndevblog.typepad.com/autocad/2012/07/using-readdwgfile-with-net-attachxref-or-objectarx-acdbattachxref.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I had similar issues, you use HostApplicationServices.WorkingDatabase but you have to be careful with it. We have found that ar.AdjustAlignment(db); doesn't work if it is not the working database.&lt;BR /&gt;</description>
      <pubDate>Mon, 18 May 2015 23:43:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-attributes/m-p/5640737#M40137</guid>
      <dc:creator>CADbloke</dc:creator>
      <dc:date>2015-05-18T23:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: modify attributes</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-attributes/m-p/5651201#M40138</link>
      <description>Glad my answer helped. Here's some more info on this problem ... &lt;A href="http://forums.autodesk.com/t5/net/attribute-alignment/m-p/3182842#M25497" target="_blank"&gt;http://forums.autodesk.com/t5/net/attribute-alignment/m-p/3182842#M25497&lt;/A&gt;</description>
      <pubDate>Mon, 25 May 2015 23:50:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-attributes/m-p/5651201#M40138</guid>
      <dc:creator>CADbloke</dc:creator>
      <dc:date>2015-05-25T23:50:56Z</dc:date>
    </item>
  </channel>
</rss>

