<?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 Dynamic block doesnt correctly update after property value change in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/dynamic-block-doesnt-correctly-update-after-property-value/m-p/9382721#M20084</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm writing a script that needs to update a dynamic block reference size. When I modify the block reference through the DynamicBlockReferencePropertyCollection, it doesn't get visually updated in the same way as it would if I would move the grip.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;		private void UpdateBlockReferenceParameter(Database db, BlockReference blockRef, int referenceIndex, double value)
        {
            var objectID = blockRef.Id;
            
			using (Transaction transaction = db.TransactionManager.StartTransaction())
			{
				DBObject obj = transaction.GetObject(objectID, OpenMode.ForWrite);
				BlockReference br = ((BlockReference)obj);
				br.DynamicBlockReferencePropertyCollection[referenceIndex].Value = value;
				transaction.Commit();
			}
        }
		
		...
		
		for (int i=0; i&amp;lt;br.DynamicBlockReferencePropertyCollection.Count; i++)
		{
			if (br.DynamicBlockReferencePropertyCollection[i].UnitsType == DynamicBlockReferencePropertyUnitsType.Distance)
			{
				UpdateBlockReferenceParameter(database, br, i, (double)(200 + i));
			}
		}
		
		
		&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this is the result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the top: the original&lt;/P&gt;&lt;P&gt;In the middle: the dynamic block after running this snippet&lt;/P&gt;&lt;P&gt;On the bottom: the same dynamic block after moving the grip.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The middle version (which is the problem) fixes itself if I move the grip by a small amount after running the script.&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 490px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/742225i5556B637E81EC267/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is wrong with what I am doing? How can it be solved?&lt;/P&gt;</description>
    <pubDate>Tue, 17 Mar 2020 15:18:46 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-03-17T15:18:46Z</dc:date>
    <item>
      <title>Dynamic block doesnt correctly update after property value change</title>
      <link>https://forums.autodesk.com/t5/net-forum/dynamic-block-doesnt-correctly-update-after-property-value/m-p/9382721#M20084</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm writing a script that needs to update a dynamic block reference size. When I modify the block reference through the DynamicBlockReferencePropertyCollection, it doesn't get visually updated in the same way as it would if I would move the grip.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;		private void UpdateBlockReferenceParameter(Database db, BlockReference blockRef, int referenceIndex, double value)
        {
            var objectID = blockRef.Id;
            
			using (Transaction transaction = db.TransactionManager.StartTransaction())
			{
				DBObject obj = transaction.GetObject(objectID, OpenMode.ForWrite);
				BlockReference br = ((BlockReference)obj);
				br.DynamicBlockReferencePropertyCollection[referenceIndex].Value = value;
				transaction.Commit();
			}
        }
		
		...
		
		for (int i=0; i&amp;lt;br.DynamicBlockReferencePropertyCollection.Count; i++)
		{
			if (br.DynamicBlockReferencePropertyCollection[i].UnitsType == DynamicBlockReferencePropertyUnitsType.Distance)
			{
				UpdateBlockReferenceParameter(database, br, i, (double)(200 + i));
			}
		}
		
		
		&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this is the result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the top: the original&lt;/P&gt;&lt;P&gt;In the middle: the dynamic block after running this snippet&lt;/P&gt;&lt;P&gt;On the bottom: the same dynamic block after moving the grip.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The middle version (which is the problem) fixes itself if I move the grip by a small amount after running the script.&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 490px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/742225i5556B637E81EC267/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is wrong with what I am doing? How can it be solved?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2020 15:18:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dynamic-block-doesnt-correctly-update-after-property-value/m-p/9382721#M20084</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-03-17T15:18:46Z</dc:date>
    </item>
  </channel>
</rss>

