Message 1 of 4
change block refference attribute. Dont want to change the block itself.

Not applicable
03-07-2010
09:21 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an issue regarding nesed entity.
Thanks in advace.
Herewith I explained the issue that I am facing now. Please reply as fast as possible.
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.
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.
Here is my code:
static public void CONTACTS()
{
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
string contactName = string.Empty;//to hold contact name, from xdata
System.Collections.ArrayList arrXdata = new ArrayList();//array list to save array list
PromptNestedEntityResult rs = ed.GetNestedEntity("\nSelect the contact to move:");
string contactPath = GetSymbolPath();//get the symbol path
contactPath += "Contacts//IS";//set contact path
Handle parentContactID =new Handle();
string parentContactLayerName = string.Empty;//get the parent contact layer name
string parentContactPosition = string.Empty;//get the parent contact position
string parentDesignation = string.Empty;//get the parent designation
string currentLayerName =string.Empty;
System.Collections.Generic.Dictionary dictAttributes = new System.Collections.Generic.Dictionary();
if (rs.Status == PromptStatus.OK)
{
ObjectId[] objIds = rs.GetContainers();
//Get the selected nested entity layer name and designation of the nested entity//////////////////////////////////////////////
foreach (ObjectId dd in objIds)
{
Transaction tr = doc.TransactionManager.StartTransaction();
using (tr)
{
AttributeReference attRefParent=null;
Entity en = (Entity)tr.GetObject(dd, OpenMode.ForRead);
if (en is BlockReference)
{
BlockReference rf = en as BlockReference;
Handle hn=rf.Handle; ///////////////????????? I am getting the handle here
}
}
}
}
}
}
Edited by: jithin.dcs on Mar 8, 2010 10:53 AM Edited by: jithin.dcs on Mar 8, 2010 10:54 AM
Thanks in advace.
Herewith I explained the issue that I am facing now. Please reply as fast as possible.
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.
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.
Here is my code:
static public void CONTACTS()
{
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
string contactName = string.Empty;//to hold contact name, from xdata
System.Collections.ArrayList arrXdata = new ArrayList();//array list to save array list
PromptNestedEntityResult rs = ed.GetNestedEntity("\nSelect the contact to move:");
string contactPath = GetSymbolPath();//get the symbol path
contactPath += "Contacts//IS";//set contact path
Handle parentContactID =new Handle();
string parentContactLayerName = string.Empty;//get the parent contact layer name
string parentContactPosition = string.Empty;//get the parent contact position
string parentDesignation = string.Empty;//get the parent designation
string currentLayerName =string.Empty;
System.Collections.Generic.Dictionary
if (rs.Status == PromptStatus.OK)
{
ObjectId[] objIds = rs.GetContainers();
//Get the selected nested entity layer name and designation of the nested entity//////////////////////////////////////////////
foreach (ObjectId dd in objIds)
{
Transaction tr = doc.TransactionManager.StartTransaction();
using (tr)
{
AttributeReference attRefParent=null;
Entity en = (Entity)tr.GetObject(dd, OpenMode.ForRead);
if (en is BlockReference)
{
BlockReference rf = en as BlockReference;
Handle hn=rf.Handle; ///////////////????????? I am getting the handle here
}
}
}
}
}
}
Edited by: jithin.dcs on Mar 8, 2010 10:53 AM Edited by: jithin.dcs on Mar 8, 2010 10:54 AM