<?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 I have difficulties in handling API AutoCAD.Net using Dynamic Blocks in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3544776#M54473</link>
    <description>&lt;P&gt;&lt;SPAN style="font-family: Tms Rmn;"&gt;&lt;SPAN style="font-family: Tms Rmn;"&gt;&lt;SPAN style="font-family: Tms Rmn;"&gt;Please, I have difficulties in handling API AutoCAD.Net using Dynamic Blocks. Could you help me? Thanks in advance.&lt;BR /&gt;I'm trying to modify the configuration of a given dynamic block. The goal is to access the property Table1 Block Dynamic Block and change its value to an existing one.&lt;BR /&gt;You can navigate between the records from Table1 Block? With this code below I have managed to navigate between the dynamic properties of the block and its values​​, but I can not make the property value set in the block table1.&lt;BR /&gt;I tried an example of the link: &lt;A target="_blank" href="http://through-the-interface.typepad.com/through_the_interface/blocks/page/3/"&gt;http://through-the-interface.typepad...blocks/page/3/&lt;/A&gt; however it still fails.&lt;BR /&gt;If you have something that can help me I would be very grateful! Attached is a file with dynamic block if you can help me ...&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;[CommandMethod("getprop")]
static public void GetProps()
{
  Document doc = Application.DocumentManager.MdiActiveDocument; 
  Database db = doc.Database; 
  Editor ed = doc.Editor;
  PromptEntityOptions peo = 
   new PromptEntityOptions("\nSelecione o Bloco: ");
  peo.SetRejectMessage("\nIsso não é um Bloco.");
  peo.AddAllowedClass(typeof(BlockReference), false);
  PromptEntityResult per = ed.GetEntity(peo); 
  if (per.Status != PromptStatus.OK) return;
  ObjectId sourceId = per.ObjectId;
  using (Transaction tr = db.TransactionManager.StartTransaction())
  {
    BlockReference brF = 
     (BlockReference)tr.GetObject(sourceId, OpenMode.ForRead);
    if (brF != null &amp;amp;&amp;amp; brF.IsDynamicBlock) 
     foreach (DynamicBlockReferenceProperty prop in brF.DynamicBlockReferencePropertyCollection)
       ed.WriteMessage(string.Format("\n{0}: {1}: ", prop.PropertyName, prop.Value)); 
       tr.Commit();
  }
}&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="font-family: Tms Rmn;"&gt;&lt;SPAN style="font-family: Tms Rmn;"&gt;&lt;SPAN style="font-family: Tms Rmn;"&gt;&lt;BR /&gt;&amp;nbsp;Thank you!&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jul 2012 14:05:36 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-07-19T14:05:36Z</dc:date>
    <item>
      <title>I have difficulties in handling API AutoCAD.Net using Dynamic Blocks</title>
      <link>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3544776#M54473</link>
      <description>&lt;P&gt;&lt;SPAN style="font-family: Tms Rmn;"&gt;&lt;SPAN style="font-family: Tms Rmn;"&gt;&lt;SPAN style="font-family: Tms Rmn;"&gt;Please, I have difficulties in handling API AutoCAD.Net using Dynamic Blocks. Could you help me? Thanks in advance.&lt;BR /&gt;I'm trying to modify the configuration of a given dynamic block. The goal is to access the property Table1 Block Dynamic Block and change its value to an existing one.&lt;BR /&gt;You can navigate between the records from Table1 Block? With this code below I have managed to navigate between the dynamic properties of the block and its values​​, but I can not make the property value set in the block table1.&lt;BR /&gt;I tried an example of the link: &lt;A target="_blank" href="http://through-the-interface.typepad.com/through_the_interface/blocks/page/3/"&gt;http://through-the-interface.typepad...blocks/page/3/&lt;/A&gt; however it still fails.&lt;BR /&gt;If you have something that can help me I would be very grateful! Attached is a file with dynamic block if you can help me ...&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;[CommandMethod("getprop")]
static public void GetProps()
{
  Document doc = Application.DocumentManager.MdiActiveDocument; 
  Database db = doc.Database; 
  Editor ed = doc.Editor;
  PromptEntityOptions peo = 
   new PromptEntityOptions("\nSelecione o Bloco: ");
  peo.SetRejectMessage("\nIsso não é um Bloco.");
  peo.AddAllowedClass(typeof(BlockReference), false);
  PromptEntityResult per = ed.GetEntity(peo); 
  if (per.Status != PromptStatus.OK) return;
  ObjectId sourceId = per.ObjectId;
  using (Transaction tr = db.TransactionManager.StartTransaction())
  {
    BlockReference brF = 
     (BlockReference)tr.GetObject(sourceId, OpenMode.ForRead);
    if (brF != null &amp;amp;&amp;amp; brF.IsDynamicBlock) 
     foreach (DynamicBlockReferenceProperty prop in brF.DynamicBlockReferencePropertyCollection)
       ed.WriteMessage(string.Format("\n{0}: {1}: ", prop.PropertyName, prop.Value)); 
       tr.Commit();
  }
}&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="font-family: Tms Rmn;"&gt;&lt;SPAN style="font-family: Tms Rmn;"&gt;&lt;SPAN style="font-family: Tms Rmn;"&gt;&lt;BR /&gt;&amp;nbsp;Thank you!&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2012 14:05:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3544776#M54473</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-19T14:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: I have difficulties in handling API AutoCAD.Net using Dynamic Blocks</title>
      <link>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3544990#M54474</link>
      <description>&lt;P&gt;You have to check IsDynamic property for BlockTableRecord before&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        [CommandMethod("getprop")]
        static public void GetProps()
        {
            Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;
            PromptEntityOptions peo =
             new PromptEntityOptions("\nSelecione o Bloco: ");
            peo.SetRejectMessage("\nIsso não é um Bloco.");
            peo.AddAllowedClass(typeof(BlockReference), false);
            PromptEntityResult per = ed.GetEntity(peo);
            if (per.Status != PromptStatus.OK) return;
            ObjectId sourceId = per.ObjectId;
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {

                BlockReference brF = (BlockReference)tr.GetObject(sourceId, OpenMode.ForRead);
                BlockTableRecord btr = (BlockTableRecord)tr.GetObject(brF.BlockTableRecord, OpenMode.ForRead);
                if (btr != null &amp;amp;&amp;amp; btr.IsDynamicBlock)
                {
                    foreach (DynamicBlockReferenceProperty prop in brF.DynamicBlockReferencePropertyCollection)
                        ed.WriteMessage(string.Format("\n{0}: {1}: ", prop.PropertyName, prop.Value));
                    tr.Commit();
                }
            }
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#800000"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2012 16:10:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3544990#M54474</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-07-19T16:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: I have difficulties in handling API AutoCAD.Net using Dynamic Blocks</title>
      <link>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3545278#M54475</link>
      <description>&lt;P&gt;Thank you for your attention Hallex.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The real objective is modify the value of the property Block&amp;nbsp;Table1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;prop.Value = 3 for example&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;prop.Value= 4 for example or 5, 6, ....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this link show example of how modify this value, but Iam not to apply in my code.&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://through-the-interface.typepad.com/through_the_interface/2009/03/painting-properties-between-dynamic-autocad-blocks-using-net.html"&gt;http://through-the-interface.typepad.com/through_the_interface/2009/03/painting-properties-between-dynamic-autocad-blocks-using-net.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your attention.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2012 19:25:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3545278#M54475</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-19T19:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: I have difficulties in handling API AutoCAD.Net using Dynamic Blocks</title>
      <link>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3545464#M54476</link>
      <description>&lt;P&gt;I tried to get values from your drawing,&lt;/P&gt;&lt;P&gt;seems to me next code is working:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;       [CommandMethod("getprop")]
        static public void GetProps()
        {
            Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;
            PromptEntityOptions peo =
             new PromptEntityOptions("\nSelecione o Bloco: ");
            peo.SetRejectMessage("\nIsso não é um Bloco.");
            peo.AddAllowedClass(typeof(BlockReference), false);
            PromptEntityResult per = ed.GetEntity(peo);
            if (per.Status != PromptStatus.OK) return;
            ObjectId sourceId = per.ObjectId;
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {

                BlockReference brF = (BlockReference)tr.GetObject(sourceId, OpenMode.ForRead);
                if (brF.IsDynamicBlock){
                BlockTableRecord btr = (BlockTableRecord)tr.GetObject(brF.DynamicBlockTableRecord, OpenMode.ForRead);
                if (btr != null &amp;amp;&amp;amp; btr.IsDynamicBlock)
                {
                    foreach (DynamicBlockReferenceProperty prop in brF.DynamicBlockReferencePropertyCollection)
                    {
                        ed.WriteMessage(string.Format("\n{0}: {1}: ", prop.PropertyName, prop.Value));
                        if (prop.PropertyName == "COMPRIMENTO")
                        {
                            prop.Value = 1500.0;
                        }
                        if (prop.PropertyName == "Distance2")
                        {
                            prop.Value = 900.0;
                        }
                        // ---   change other stuffs here   ---  //
                    }
                }
                    tr.Commit();
                }
            }
        }


//Block Table1: 12:
//COMPRIMENTO: 3000:
//Distance2: 118.110236220472:
//Origin: (-1.20792265079217E-13,200,0):
//Visibility1: SEM:
//Desloc: 28.3464566929134:
//Origin: (0,0,0):
//Multi: 121.259842519685:
//Origin: (720,-30.0000000000001,0):
//PISO: 1/4":&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#800000"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2012 21:26:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3545464#M54476</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-07-19T21:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: I have difficulties in handling API AutoCAD.Net using Dynamic Blocks</title>
      <link>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3546072#M54477</link>
      <description>&lt;P&gt;Hello,Hallex&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The example you sent me worked perfectly. Thank you!&lt;/P&gt;&lt;P&gt;However, when I try to change: if (prop.PropertyName == "Block Table1") {prop.Value = 6;}&lt;/P&gt;&lt;P&gt;generates an error: e.Mensagem: eInvalidInput,&lt;/P&gt;&lt;P&gt;e.StackTrace: at Autodesk.AutoCAD.DatabaseServices.DynamicBlockReferenceProperty.set_Value (Object Value) at ClassLibrary1.Class1.GetProps ().&lt;/P&gt;&lt;P&gt;I would like to change my Dynamic&amp;nbsp;Block by setting the value of the&amp;nbsp;"Block Table1"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for example:&lt;/P&gt;&lt;P&gt;if (prop.PropertyName == "Block Table1") {prop.Value = 6;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for the help and attention!!&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2012 12:43:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3546072#M54477</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-20T12:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: I have difficulties in handling API AutoCAD.Net using Dynamic Blocks</title>
      <link>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3546154#M54478</link>
      <description>&lt;P&gt;I have never worked with BlockTable, but I will&lt;/P&gt;&lt;P&gt;to try this way,&lt;/P&gt;&lt;P&gt;Later,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#008080"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2012 13:28:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3546154#M54478</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-07-20T13:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: I have difficulties in handling API AutoCAD.Net using Dynamic Blocks</title>
      <link>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3546258#M54479</link>
      <description>&lt;P&gt;Ok thank you very much. See this example that I found in LISP program. the program does exactly what I need, but I would like do in C##.NET program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;;(GetBlockValue "Block Table1" 2)
(defun GetBlockValue (prop value)												       
	(vl-load-com)												   	               
      	(setq block (entlast)) 	      											      	       
      	(vl-some 
		(function (lambda ( _prop ) 
			(if (eq prop (strcase (vla-get-propertyname _prop)))
				(progn	
					(vla-put-value _prop (vlax-make-variant value (vlax-variant-type (vla-get-value _prop))))
					value
				)
			)
		)
	)
	(vlax-invoke (vlax-ename-&amp;gt;vla-object Block) 'GetDynamicBlockProperties))
)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2012 14:10:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3546258#M54479</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-20T14:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: I have difficulties in handling API AutoCAD.Net using Dynamic Blocks</title>
      <link>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3546798#M54480</link>
      <description>&lt;P&gt;Sorry this is out of my skills,&lt;/P&gt;&lt;P&gt;I didn't know how to rich at Block Table rows&lt;/P&gt;&lt;P&gt;using c#&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img id="smileyindifferent" class="emoticon emoticon-smileyindifferent" src="https://forums.autodesk.com/i/smilies/16x16_smiley-indifferent.png" alt="Smiley Indifferent" title="Smiley Indifferent" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2012 18:47:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3546798#M54480</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-07-20T18:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: I have difficulties in handling API AutoCAD.Net using Dynamic Blocks</title>
      <link>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3548038#M54481</link>
      <description>&lt;P&gt;Hallex,&lt;/P&gt;&lt;P&gt;Thanks for your attention.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jul 2012 10:35:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3548038#M54481</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-23T10:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: I have difficulties in handling API AutoCAD.Net using Dynamic Blocks</title>
      <link>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3561606#M54482</link>
      <description>&lt;P&gt;Márcio,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; I suspect the "Block Table1" property cannot be assigned with 6 (integer). Please, inspect its type in your code or in the debugger - prop.PropertyTypeCode, it is a value from this enumeration (described in the ObjectARX Reference Guide):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;enum DwgDataType {&lt;BR /&gt;&amp;nbsp; kDwgNull = 0,&lt;BR /&gt;&amp;nbsp; kDwgReal = 1,&lt;BR /&gt;&amp;nbsp; kDwgInt32 = 2,&lt;BR /&gt;&amp;nbsp; kDwgInt16 = 3,&lt;BR /&gt;&amp;nbsp; kDwgInt8 = 4,&lt;BR /&gt;&amp;nbsp; kDwgText = 5,&lt;BR /&gt;&amp;nbsp; kDwgBChunk = 6,&lt;BR /&gt;&amp;nbsp; kDwgHandle = 7,&lt;BR /&gt;&amp;nbsp; kDwgHardOwnershipId = 8,&lt;BR /&gt;&amp;nbsp; kDwgSoftOwnershipId = 9,&lt;BR /&gt;&amp;nbsp; kDwgHardPointerId = 10,&lt;BR /&gt;&amp;nbsp; kDwgSoftPointerId = 11,&lt;BR /&gt;&amp;nbsp; kDwg3Real = 12,&lt;BR /&gt;&amp;nbsp; kDwgInt64 = 13,&lt;BR /&gt;&amp;nbsp; kDwgNotRecognized = 19&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2012 17:47:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/i-have-difficulties-in-handling-api-autocad-net-using-dynamic/m-p/3561606#M54482</guid>
      <dc:creator>Marat.Mirgaleev</dc:creator>
      <dc:date>2012-08-01T17:47:09Z</dc:date>
    </item>
  </channel>
</rss>

