<?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: Copy Dynamic Block Reference within a drawing in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/copy-dynamic-block-reference-within-a-drawing/m-p/9196548#M20625</link>
    <description>&lt;P&gt;I assume you do know that a dynamic block reference is, in most cases, when its dynamic property is changed from its original value, a reference to an anonymous block definition, which is generated by AutoCAD automatically.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Creating a copy of dynamic block reference by calling Entity.GetTransformedCopy() is bad thing to do, because the copying is simply to a shallow copying (Entity.Clone()&amp;nbsp; along with Entity.TransformBy()). This the quote from .NET API documentation (pay attention to lines in blue):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;QUOTE&amp;gt;&lt;/P&gt;
&lt;DIV id="areascroll" class="Element720" style="overflow: auto; height: 755px; width: 875px; top: 0px; padding-right: 20px;"&gt;
&lt;DIV class="Element721"&gt;
&lt;DIV class="Element58"&gt;
&lt;DIV class="Element11"&gt;
&lt;DIV class="Element10"&gt;
&lt;P class="Element10"&gt;&lt;EM&gt;&lt;STRONG&gt;Function implementation in derived classes&lt;/STRONG&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;EM&gt;The default &lt;SPAN class="Element146"&gt;Entity&lt;/SPAN&gt; implementation of this function should be adequate for most derived entity types. However, derived entity classes that wish to support non-uniform scaling or non-orthogonal transformations will need to override this method with their own implementation.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;EM&gt;This function must create a copy of the entity (using memory that has been dynamically allocated), apply the transformation matrix &lt;SPAN class="Element146"&gt;transform&lt;/SPAN&gt; to the copy and then return the transformed copy.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;EM&gt;Determining what constitutes a valid transformation matrix and whether to do a shallow clone (that is, the entity's clone() method), a deepclone (if the entity owns other objects), or no clone at all (that is, make this function a no-op), is up to the implementer.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;EM&gt;&lt;STRONG&gt;Default implementation&lt;/STRONG&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;If the entity is uniformly scaled and orthogonal, &lt;SPAN class="Element146"&gt;Entity.GetTransformedCopy&lt;/SPAN&gt; will call the entity's &lt;SPAN class="Element146"&gt;clone()&lt;/SPAN&gt; method to create a clone of the entity, then call &lt;SPAN class="Element146"&gt;Entity.TransformBy()&lt;/SPAN&gt; on the clone, and then return the transformed clone.&lt;/EM&gt;&lt;/FONT&gt;&lt;SPAN style="font-family: inherit;"&gt;&amp;lt;/QUOTE&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;SPAN style="font-family: inherit;"&gt;Each dynamic block reference has undocumented ExtensionDictionary to hold information on how it is related to the original dynamic block definition in spite being the reference of an anonymous block definition. When a shallow copying (Entity.Clone()) happens, its ExtensionDictionary data would not be created with the cloned block reference, thus, its "dynamic" capability is lost, and just becomes a regular reference of an anonymous block definition.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;SPAN style="font-family: inherit;"&gt;I am not sure what you really want to do, but creating dynamic block reference by GetTransformedCopy() probably is not something you want to or should do.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Wed, 11 Dec 2019 17:05:11 GMT</pubDate>
    <dc:creator>norman.yuan</dc:creator>
    <dc:date>2019-12-11T17:05:11Z</dc:date>
    <item>
      <title>Copy Dynamic Block Reference within a drawing</title>
      <link>https://forums.autodesk.com/t5/net-forum/copy-dynamic-block-reference-within-a-drawing/m-p/9196107#M20624</link>
      <description>&lt;P&gt;I think this probably been asked quite a number of times, but I still cannot figure it out.&lt;/P&gt;&lt;P&gt;I have a drawing with some dynamic blocks, I need to copy them as they are in the code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use getTransformedCopy method, then It becomes anoymous. I want to copy it and keep everything the same .How should I make a copy of it while maintaining the ability to stretch the handles in AutoCAD.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 14:46:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/copy-dynamic-block-reference-within-a-drawing/m-p/9196107#M20624</guid>
      <dc:creator>ilovejingle</dc:creator>
      <dc:date>2019-12-11T14:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Dynamic Block Reference within a drawing</title>
      <link>https://forums.autodesk.com/t5/net-forum/copy-dynamic-block-reference-within-a-drawing/m-p/9196548#M20625</link>
      <description>&lt;P&gt;I assume you do know that a dynamic block reference is, in most cases, when its dynamic property is changed from its original value, a reference to an anonymous block definition, which is generated by AutoCAD automatically.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Creating a copy of dynamic block reference by calling Entity.GetTransformedCopy() is bad thing to do, because the copying is simply to a shallow copying (Entity.Clone()&amp;nbsp; along with Entity.TransformBy()). This the quote from .NET API documentation (pay attention to lines in blue):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;QUOTE&amp;gt;&lt;/P&gt;
&lt;DIV id="areascroll" class="Element720" style="overflow: auto; height: 755px; width: 875px; top: 0px; padding-right: 20px;"&gt;
&lt;DIV class="Element721"&gt;
&lt;DIV class="Element58"&gt;
&lt;DIV class="Element11"&gt;
&lt;DIV class="Element10"&gt;
&lt;P class="Element10"&gt;&lt;EM&gt;&lt;STRONG&gt;Function implementation in derived classes&lt;/STRONG&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;EM&gt;The default &lt;SPAN class="Element146"&gt;Entity&lt;/SPAN&gt; implementation of this function should be adequate for most derived entity types. However, derived entity classes that wish to support non-uniform scaling or non-orthogonal transformations will need to override this method with their own implementation.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;EM&gt;This function must create a copy of the entity (using memory that has been dynamically allocated), apply the transformation matrix &lt;SPAN class="Element146"&gt;transform&lt;/SPAN&gt; to the copy and then return the transformed copy.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;EM&gt;Determining what constitutes a valid transformation matrix and whether to do a shallow clone (that is, the entity's clone() method), a deepclone (if the entity owns other objects), or no clone at all (that is, make this function a no-op), is up to the implementer.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;EM&gt;&lt;STRONG&gt;Default implementation&lt;/STRONG&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;If the entity is uniformly scaled and orthogonal, &lt;SPAN class="Element146"&gt;Entity.GetTransformedCopy&lt;/SPAN&gt; will call the entity's &lt;SPAN class="Element146"&gt;clone()&lt;/SPAN&gt; method to create a clone of the entity, then call &lt;SPAN class="Element146"&gt;Entity.TransformBy()&lt;/SPAN&gt; on the clone, and then return the transformed clone.&lt;/EM&gt;&lt;/FONT&gt;&lt;SPAN style="font-family: inherit;"&gt;&amp;lt;/QUOTE&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;SPAN style="font-family: inherit;"&gt;Each dynamic block reference has undocumented ExtensionDictionary to hold information on how it is related to the original dynamic block definition in spite being the reference of an anonymous block definition. When a shallow copying (Entity.Clone()) happens, its ExtensionDictionary data would not be created with the cloned block reference, thus, its "dynamic" capability is lost, and just becomes a regular reference of an anonymous block definition.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;SPAN style="font-family: inherit;"&gt;I am not sure what you really want to do, but creating dynamic block reference by GetTransformedCopy() probably is not something you want to or should do.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 11 Dec 2019 17:05:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/copy-dynamic-block-reference-within-a-drawing/m-p/9196548#M20625</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2019-12-11T17:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Dynamic Block Reference within a drawing</title>
      <link>https://forums.autodesk.com/t5/net-forum/copy-dynamic-block-reference-within-a-drawing/m-p/9198155#M20626</link>
      <description>&lt;P&gt;Thank you for your explaination, now I think the question is "How to do a proper deep clone of the entity with all the extension dictionaries attached ? "&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found a similar questions here.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/net/entity-deepclone-vs-database-deepcloneobjects/td-p/7525517" target="_blank"&gt;https://forums.autodesk.com/t5/net/entity-deepclone-vs-database-deepcloneobjects/td-p/7525517&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;Database.DeepCloneObjects()&lt;/PRE&gt;&lt;P&gt;This method seems solved the problem.&lt;/P&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;</description>
      <pubDate>Thu, 12 Dec 2019 09:39:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/copy-dynamic-block-reference-within-a-drawing/m-p/9198155#M20626</guid>
      <dc:creator>ilovejingle</dc:creator>
      <dc:date>2019-12-12T09:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Dynamic Block Reference within a drawing</title>
      <link>https://forums.autodesk.com/t5/net-forum/copy-dynamic-block-reference-within-a-drawing/m-p/9201199#M20627</link>
      <description>&lt;P&gt;Try copy constructor implementation&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 15:21:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/copy-dynamic-block-reference-within-a-drawing/m-p/9201199#M20627</guid>
      <dc:creator>amitnkukanur</dc:creator>
      <dc:date>2019-12-13T15:21:29Z</dc:date>
    </item>
  </channel>
</rss>

