<?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 change block refference attribute. Dont want to change the block itself. in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/change-block-refference-attribute-dont-want-to-change-the-block/m-p/2644995#M66563</link>
    <description>I have an issue regarding nesed entity.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advace.&lt;BR /&gt;
Herewith I explained the issue that I am facing now. Please reply as fast as possible.&lt;BR /&gt;
&lt;BR /&gt;
          I have a nested entity block reference. In  this entity I have three blocks. if  I change any of the block reference attribute defenision in the nested block reference then it is changing the original block itself.&lt;BR /&gt;
          Actually I am getting the handle of the selected block reference in the nested Entity. and change the attribute refference later. but it is making change in the block itself and other block reference too.&lt;BR /&gt;
&lt;BR /&gt;
Here is my code: &lt;BR /&gt;
 static public void CONTACTS()&lt;BR /&gt;
        {&lt;BR /&gt;
&lt;BR /&gt;
            Document doc                          = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;
            Editor ed                             = doc.Editor;&lt;BR /&gt;
            string contactName                    = string.Empty;//to hold contact name, from xdata&lt;BR /&gt;
            System.Collections.ArrayList arrXdata = new ArrayList();//array list to save array list&lt;BR /&gt;
            PromptNestedEntityResult rs           = ed.GetNestedEntity("\nSelect the contact to move:");&lt;BR /&gt;
            string contactPath                    = GetSymbolPath();//get the symbol path&lt;BR /&gt;
            contactPath                           += "Contacts//IS";//set contact path&lt;BR /&gt;
            Handle parentContactID                =new Handle();&lt;BR /&gt;
            string parentContactLayerName         = string.Empty;//get the parent contact layer name&lt;BR /&gt;
            string parentContactPosition          = string.Empty;//get the parent contact position&lt;BR /&gt;
            string parentDesignation              = string.Empty;//get the parent designation&lt;BR /&gt;
            string currentLayerName               =string.Empty;&lt;BR /&gt;
            System.Collections.Generic.Dictionary&lt;STRING&gt; dictAttributes =  new System.Collections.Generic.Dictionary&lt;STRING&gt;();&lt;BR /&gt;
            if (rs.Status == PromptStatus.OK)&lt;BR /&gt;
            {&lt;BR /&gt;
                ObjectId[] objIds = rs.GetContainers();            &lt;BR /&gt;
                //Get the selected nested entity layer name and designation of the nested entity//////////////////////////////////////////////&lt;BR /&gt;
                foreach (ObjectId dd in objIds)&lt;BR /&gt;
                {&lt;BR /&gt;
                    Transaction tr = doc.TransactionManager.StartTransaction();&lt;BR /&gt;
                    using (tr)&lt;BR /&gt;
                    { &lt;BR /&gt;
                        AttributeReference attRefParent=null;&lt;BR /&gt;
                        Entity en = (Entity)tr.GetObject(dd, OpenMode.ForRead);&lt;BR /&gt;
                        if (en is BlockReference)&lt;BR /&gt;
                        {&lt;BR /&gt;
                            BlockReference rf = en as BlockReference;&lt;BR /&gt;
                            Handle hn=rf.Handle;   ///////////////?????????  I am getting the handle here                                                          &lt;BR /&gt;
                                               &lt;BR /&gt;
                        }&lt;BR /&gt;
                    }&lt;BR /&gt;
                }&lt;BR /&gt;
              &lt;BR /&gt;
}&lt;BR /&gt;
}&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
Edited by: jithin.dcs on Mar 8, 2010 10:53 AM

Edited by: jithin.dcs on Mar 8, 2010 10:54 AM&lt;/STRING&gt;&lt;/STRING&gt;</description>
    <pubDate>Mon, 08 Mar 2010 05:21:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2010-03-08T05:21:32Z</dc:date>
    <item>
      <title>change block refference attribute. Dont want to change the block itself.</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-block-refference-attribute-dont-want-to-change-the-block/m-p/2644995#M66563</link>
      <description>I have an issue regarding nesed entity.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advace.&lt;BR /&gt;
Herewith I explained the issue that I am facing now. Please reply as fast as possible.&lt;BR /&gt;
&lt;BR /&gt;
          I have a nested entity block reference. In  this entity I have three blocks. if  I change any of the block reference attribute defenision in the nested block reference then it is changing the original block itself.&lt;BR /&gt;
          Actually I am getting the handle of the selected block reference in the nested Entity. and change the attribute refference later. but it is making change in the block itself and other block reference too.&lt;BR /&gt;
&lt;BR /&gt;
Here is my code: &lt;BR /&gt;
 static public void CONTACTS()&lt;BR /&gt;
        {&lt;BR /&gt;
&lt;BR /&gt;
            Document doc                          = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;
            Editor ed                             = doc.Editor;&lt;BR /&gt;
            string contactName                    = string.Empty;//to hold contact name, from xdata&lt;BR /&gt;
            System.Collections.ArrayList arrXdata = new ArrayList();//array list to save array list&lt;BR /&gt;
            PromptNestedEntityResult rs           = ed.GetNestedEntity("\nSelect the contact to move:");&lt;BR /&gt;
            string contactPath                    = GetSymbolPath();//get the symbol path&lt;BR /&gt;
            contactPath                           += "Contacts//IS";//set contact path&lt;BR /&gt;
            Handle parentContactID                =new Handle();&lt;BR /&gt;
            string parentContactLayerName         = string.Empty;//get the parent contact layer name&lt;BR /&gt;
            string parentContactPosition          = string.Empty;//get the parent contact position&lt;BR /&gt;
            string parentDesignation              = string.Empty;//get the parent designation&lt;BR /&gt;
            string currentLayerName               =string.Empty;&lt;BR /&gt;
            System.Collections.Generic.Dictionary&lt;STRING&gt; dictAttributes =  new System.Collections.Generic.Dictionary&lt;STRING&gt;();&lt;BR /&gt;
            if (rs.Status == PromptStatus.OK)&lt;BR /&gt;
            {&lt;BR /&gt;
                ObjectId[] objIds = rs.GetContainers();            &lt;BR /&gt;
                //Get the selected nested entity layer name and designation of the nested entity//////////////////////////////////////////////&lt;BR /&gt;
                foreach (ObjectId dd in objIds)&lt;BR /&gt;
                {&lt;BR /&gt;
                    Transaction tr = doc.TransactionManager.StartTransaction();&lt;BR /&gt;
                    using (tr)&lt;BR /&gt;
                    { &lt;BR /&gt;
                        AttributeReference attRefParent=null;&lt;BR /&gt;
                        Entity en = (Entity)tr.GetObject(dd, OpenMode.ForRead);&lt;BR /&gt;
                        if (en is BlockReference)&lt;BR /&gt;
                        {&lt;BR /&gt;
                            BlockReference rf = en as BlockReference;&lt;BR /&gt;
                            Handle hn=rf.Handle;   ///////////////?????????  I am getting the handle here                                                          &lt;BR /&gt;
                                               &lt;BR /&gt;
                        }&lt;BR /&gt;
                    }&lt;BR /&gt;
                }&lt;BR /&gt;
              &lt;BR /&gt;
}&lt;BR /&gt;
}&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
Edited by: jithin.dcs on Mar 8, 2010 10:53 AM

Edited by: jithin.dcs on Mar 8, 2010 10:54 AM&lt;/STRING&gt;&lt;/STRING&gt;</description>
      <pubDate>Mon, 08 Mar 2010 05:21:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-block-refference-attribute-dont-want-to-change-the-block/m-p/2644995#M66563</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-03-08T05:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: change block refference attribute. Dont want to change the block itself.</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-block-refference-attribute-dont-want-to-change-the-block/m-p/2644996#M66564</link>
      <description>This was mentioned here &lt;BR /&gt;
http://discussion.autodesk.com/forums/thread.jspa?messageID=6303436⻌</description>
      <pubDate>Mon, 08 Mar 2010 06:38:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-block-refference-attribute-dont-want-to-change-the-block/m-p/2644996#M66564</guid>
      <dc:creator>arcticad</dc:creator>
      <dc:date>2010-03-08T06:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: change block refference attribute. Dont want to change the block itself.</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-block-refference-attribute-dont-want-to-change-the-block/m-p/2644997#M66565</link>
      <description>I checked the link you have given. its not clear my issue. &lt;BR /&gt;
&lt;BR /&gt;
Im my code I am reading the selected block reference handle as follows.&lt;BR /&gt;
&lt;BR /&gt;
   ObjectId id = (ObjectId)revIds.GetValue(1);// from nested entity collections&lt;BR /&gt;
   Entity ent  = (Entity)tr.GetObject(id, OpenMode.ForRead);                       &lt;BR /&gt;
                        // ... and highlight the nested entity&lt;BR /&gt;
   ent.Highlight(path,true);                       &lt;BR /&gt;
   if (ent is BlockReference)&lt;BR /&gt;
   {&lt;BR /&gt;
                                BlockReference br = ent as BlockReference;&lt;BR /&gt;
                                contactName       = br.Name;&lt;BR /&gt;
                                parentContactID = br.Handle;     // getting the handle here&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
Once I got the handle I will update the sabe block reference as follows&lt;BR /&gt;
&lt;BR /&gt;
ObjectId getParentID = db.GetObjectId(false,handle, 0);&lt;BR /&gt;
Entity entParent = (Entity)tr.GetObject(getParentID, OpenMode.ForWrite, false);// Use it to open the current object! &lt;BR /&gt;
                            if (entParent is BlockReference)&lt;BR /&gt;
                            {&lt;BR /&gt;
                                BlockReference brParent = entParent as BlockReference;&lt;BR /&gt;
                                foreach (ObjectId id in brParent.AttributeCollection)&lt;BR /&gt;
                                {&lt;BR /&gt;
                                    Entity ent2 = (Entity)tr.GetObject(id, OpenMode.ForRead, false);&lt;BR /&gt;
                                    attRef = (AttributeReference)tr.GetObject(id, OpenMode.ForWrite, false);&lt;BR /&gt;
                                    if (attRef.Tag == "LOCN")&lt;BR /&gt;
                                    {&lt;BR /&gt;
                                        attRef.TextString = "[" + subContactLayer + ":" + subContactPosition + "]";&lt;BR /&gt;
                                    }&lt;BR /&gt;
                                }&lt;BR /&gt;
                            }&lt;BR /&gt;
&lt;BR /&gt;
But it is updating the original bokc attribute also...........................&lt;BR /&gt;
please replay.</description>
      <pubDate>Mon, 08 Mar 2010 08:22:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-block-refference-attribute-dont-want-to-change-the-block/m-p/2644997#M66565</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-03-08T08:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: getting entity by giving the handle name in autocad,net</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-block-refference-attribute-dont-want-to-change-the-block/m-p/3489340#M66566</link>
      <description>&lt;P&gt;my requirement is i am giving the handle name in the textbox.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with that handle name i want to zoom tha that object when i pree button&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please give logic&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2012 11:52:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-block-refference-attribute-dont-want-to-change-the-block/m-p/3489340#M66566</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-07T11:52:58Z</dc:date>
    </item>
  </channel>
</rss>

