<?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 Syncronizing attribute references with ObjectARX in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/syncronizing-attribute-references-with-objectarx/m-p/3295933#M15156</link>
    <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I wrote a C# program with ObjectARX which modifies some attribute definition inside two static blocks (height and position). How can I now sync the block/attribute references according to the new definitions (as issuing "ATTSYNC N *") ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using SendStringToExecute but it's an async method: the program saves and closes the document before the command could be completed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Alessandro.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jan 2012 17:09:16 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-01-17T17:09:16Z</dc:date>
    <item>
      <title>Syncronizing attribute references with ObjectARX</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/syncronizing-attribute-references-with-objectarx/m-p/3295933#M15156</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I wrote a C# program with ObjectARX which modifies some attribute definition inside two static blocks (height and position). How can I now sync the block/attribute references according to the new definitions (as issuing "ATTSYNC N *") ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using SendStringToExecute but it's an async method: the program saves and closes the document before the command could be completed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Alessandro.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2012 17:09:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/syncronizing-attribute-references-with-objectarx/m-p/3295933#M15156</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-17T17:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Syncronizing attribute references with ObjectARX</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/syncronizing-attribute-references-with-objectarx/m-p/3312035#M15157</link>
      <description>&lt;P&gt;Hi Alessandro,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately there is no direct method do repeat ATTSYNC&amp;nbsp;command. To achieve the same result, you can try the following steps: (1) open the block definition and block reference, (2) iterate though attribute references on block reference and find the appropriate attribute definition (using TAG as a search criteria), (3) use the setAttributeFromBlock to copy the new attribute.&lt;/P&gt;
&lt;P&gt;Another option is to send ATTSYNC command:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[CommandMethod("AttsyncCmd")]&lt;/P&gt;
&lt;P&gt;static public void AttsyncCmd()&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Document doc = Application.DocumentManager.MdiActiveDocument;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Database db = doc.Database;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Editor ed = doc.Editor;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string bName = "blk1";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string command = "_ATTSYNC Name " + bName + "\n";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; doc.SendStringToExecute(command, true, false, false);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are doing that inside a save &amp;amp; close operation, then yes it will not work. You need to P/Invoke a synchronous method such as "acedCommand". Here is an example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[DllImport("acad.exe", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl, EntryPoint = "acedCommand")]
private static extern int acedCommand(int type, __arglist);

[CommandMethod("acedCommand3")]
public void acedCommand3()
{
    double rad = 2.5;

    double[] center = new double[3] { 0, 0, 0 };

    acedCommand(5005, __arglist("_.CIRCLE", 5009, center, 5001, rad, 5000));
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note for next time: you may want to post C#/VB.Net questions to the .Net section rather than ObjectARX (reserved for C++).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Philippe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Philippe Leefsma&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;EM&gt;Developer Consultant&lt;/EM&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;EM&gt;Developer Technical Services&lt;/EM&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;EM&gt;Global Subscription &amp;amp; Support&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Autodesk EMEA&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;A href="http://www.autodesk.com/joinadn" target="_blank"&gt;www.autodesk.com/joinadn&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2012 10:49:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/syncronizing-attribute-references-with-objectarx/m-p/3312035#M15157</guid>
      <dc:creator>philippe.leefsma</dc:creator>
      <dc:date>2012-01-31T10:49:25Z</dc:date>
    </item>
  </channel>
</rss>

