<?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: How to access Dynamic block's custom value in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-access-dynamic-block-s-custom-value/m-p/7086799#M31504</link>
    <description>&lt;P&gt;Firstly, your code need to identify the block reference. Assume your code already gets the BlockReference in interest. Then you only need to loop through the DynamicBlockReferencePropertyCollection property and look for the property with certain name. Something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;private void SetDoorBlockProperties(ObjectId blockRefId, double doorSize, double wallThick)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; using (var tran=blockRefId.Database.TransactionManager.StartTransaction())&lt;/P&gt;
&lt;P&gt;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; var bref=(BlockReference)tran.GetObject(blockRefId,OpenMode.ForWrite);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; foreach (var prop in bref.DynamicBlockReferencePropertyCollection)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (prop.PropertyName.ToUpper()=="DOOR SIZE")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; prop.Value=doorSize;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else if (prop.PropertyName.ToUpper()=="WALL THICKNESS")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; prop.Value=wallThick;&lt;/P&gt;
&lt;P&gt;&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;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, here assumes that the parameters doorSize and wallThick have valid value that are allowed with the block's dynamic properties.&lt;/P&gt;</description>
    <pubDate>Tue, 16 May 2017 13:47:09 GMT</pubDate>
    <dc:creator>norman.yuan</dc:creator>
    <dc:date>2017-05-16T13:47:09Z</dc:date>
    <item>
      <title>How to access Dynamic block's custom value</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-access-dynamic-block-s-custom-value/m-p/7086526#M31503</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Can any one help how to access Dynamic block's Custom value as well as assign&amp;nbsp;different value as required Using C#?&lt;/P&gt;&lt;P&gt;Attached sanp..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2017 11:59:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-access-dynamic-block-s-custom-value/m-p/7086526#M31503</guid>
      <dc:creator>kite15</dc:creator>
      <dc:date>2017-05-16T11:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to access Dynamic block's custom value</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-access-dynamic-block-s-custom-value/m-p/7086799#M31504</link>
      <description>&lt;P&gt;Firstly, your code need to identify the block reference. Assume your code already gets the BlockReference in interest. Then you only need to loop through the DynamicBlockReferencePropertyCollection property and look for the property with certain name. Something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;private void SetDoorBlockProperties(ObjectId blockRefId, double doorSize, double wallThick)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; using (var tran=blockRefId.Database.TransactionManager.StartTransaction())&lt;/P&gt;
&lt;P&gt;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; var bref=(BlockReference)tran.GetObject(blockRefId,OpenMode.ForWrite);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; foreach (var prop in bref.DynamicBlockReferencePropertyCollection)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (prop.PropertyName.ToUpper()=="DOOR SIZE")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; prop.Value=doorSize;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else if (prop.PropertyName.ToUpper()=="WALL THICKNESS")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; prop.Value=wallThick;&lt;/P&gt;
&lt;P&gt;&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;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, here assumes that the parameters doorSize and wallThick have valid value that are allowed with the block's dynamic properties.&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2017 13:47:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-access-dynamic-block-s-custom-value/m-p/7086799#M31504</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2017-05-16T13:47:09Z</dc:date>
    </item>
  </channel>
</rss>

