Do not know what of the demos you guys are using.... I download the first one on the list and opened on visual studio 2005, removed the debug to a2008, did the compile and open it using lutz reflector and getting something like:
[CommandMethod("addAnEnt")]
public void AddAnEnt()
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
PromptKeywordOptions getWhichEntityOptions = new PromptKeywordOptions("Which entity do you want to create? [Circle/Block] : ", "Circle Block");
PromptResult getWhichEntityResult = ed.GetKeywords(getWhichEntityOptions);
if (getWhichEntityResult.Status == PromptStatus.OK)
{
switch (getWhichEntityResult.StringResult)
{
case "Circle":
{
PromptPointOptions getPointOptions = new PromptPointOptions("Pick Center Point : ");
PromptPointResult getPointResult = ed.GetPoint(getPointOptions);
if (getPointResult.Status == PromptStatus.OK)
{
PromptDistanceOptions getRadiusOptions = new PromptDistanceOptions("Pick Radius : ");
getRadiusOptions.BasePoint = getPointResult.Value;
getRadiusOptions.UseBasePoint = true;
PromptDoubleResult getRadiusResult = ed.GetDistance(getRadiusOptions);
if (getRadiusResult.Status == PromptStatus.OK)
{
Database dwg = ed.Document.Database;
Transaction trans = dwg.TransactionManager.StartTransaction();
try
{
Circle circle = new Circle(getPointResult.Value, Vector3d.ZAxis, getRadiusResult.Value);
((BlockTableRecord) trans.GetObject(dwg.CurrentSpaceId, OpenMode.ForWrite)).AppendEntity(circle);
trans.AddNewlyCreatedDBObject(circle, true);
trans.Commit();
}
catch (Exception exception1)
{
ProjectData.SetProjectError(exception1);
Exception ex = exception1;
ed.WriteMessage("problem due to " + ex.Message);
ProjectData.ClearProjectError();
}
finally
{
trans.Dispose();
}
}
}
break;
}
case "Block":
{
PromptStringOptions blockNameOptions = new PromptStringOptions("Enter name of the Block to create : ");
blockNameOptions.AllowSpaces = false;
PromptResult blockNameResult = ed.GetString(blockNameOptions);
if (blockNameResult.Status == PromptStatus.OK)
{
Database dwg = ed.Document.Database;
Transaction trans = dwg.TransactionManager.StartTransaction();
try
{
BlockTableRecord newBlockDef = new BlockTableRecord();
newBlockDef.Name = blockNameResult.StringResult;
BlockTable blockTable = (BlockTable) trans.GetObject(dwg.BlockTableId, OpenMode.ForRead);
if (!blockTable.Has(blockNameResult.StringResult))
{
blockTable.UpgradeOpen();
blockTable.Add(newBlockDef);
trans.AddNewlyCreatedDBObject(newBlockDef, true);
}
Point3d VB$t_struct$S0 = new Point3d(0.0, 0.0, 0.0);
Circle circle1 = new Circle(VB$t_struct$S0, Vector3d.ZAxis, 10.0);
VB$t_struct$S0 = new Point3d(20.0, 10.0, 0.0);
Circle circle2 = new Circle(VB$t_struct$S0, Vector3d.ZAxis, 10.0);
VB$t_struct$S0 = new Point3d(40.0, 20.0, 0.0);
Circle circle3 = new Circle(VB$t_struct$S0, Vector3d.ZAxis, 10.0);
VB$t_struct$S0 = new Point3d(60.0, 30.0, 0.0);
Circle circle4 = new Circle(VB$t_struct$S0, Vector3d.ZAxis, 10.0);
VB$t_struct$S0 = new Point3d(80.0, 40.0, 0.0);
Circle circle5 = new Circle(VB$t_struct$S0, Vector3d.ZAxis, 10.0);
newBlockDef.AppendEntity(circle1);
newBlockDef.AppendEntity(circle2);
newBlockDef.AppendEntity(circle3);
newBlockDef.AppendEntity(circle4);
newBlockDef.AppendEntity(circle5);
trans.AddNewlyCreatedDBObject(circle1, true);
trans.AddNewlyCreatedDBObject(circle2, true);
trans.AddNewlyCreatedDBObject(circle3, true);
trans.AddNewlyCreatedDBObject(circle4, true);
trans.AddNewlyCreatedDBObject(circle5, true);
PromptPointOptions blockRefPointOptions = new PromptPointOptions("Pick insertion point of Block : ");
PromptPointResult blockRefPointResult = ed.GetPoint(blockRefPointOptions);
if (blockRefPointResult.Status != PromptStatus.OK)
{
trans.Dispose();
}
else
{
BlockReference blockRef = new BlockReference(blockRefPointResult.Value, newBlockDef.ObjectId);
((BlockTableRecord) trans.GetObject(dwg.CurrentSpaceId, OpenMode.ForWrite)).AppendEntity(blockRef);
trans.AddNewlyCreatedDBObject(blockRef, true);
trans.Commit();
}
}
catch (Exception exception2)
{
ProjectData.SetProjectError(exception2);
Exception ex = exception2;
ed.WriteMessage("a problem occured because " + ex.Message);
ProjectData.ClearProjectError();
}
finally
{
trans.Dispose();
}
}
break;
}
}
}
}
[CommandMethod("addData")]
public void addData()
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
PromptEntityResult getEntityResult = ed.GetEntity("Pick an entity to add an Extension Dictionary to : ");
if (getEntityResult.Status == PromptStatus.OK)
{
Transaction trans = ed.Document.Database.TransactionManager.StartTransaction();
try
{
Entity ent = (Entity) trans.GetObject(getEntityResult.ObjectId, OpenMode.ForRead);
if (ent.ExtensionDictionary.IsNull)
{
ent.UpgradeOpen();
ent.CreateExtensionDictionary();
}
DBDictionary extensionDict = (DBDictionary) trans.GetObject(ent.ExtensionDictionary, OpenMode.ForRead);
try
{
ObjectId entryId = extensionDict.GetAt("MyData");
ed.WriteMessage("\nThis entity already has data...");
Xrecord myXrecord = (Xrecord) trans.GetObject(entryId, OpenMode.ForRead);
foreach (TypedValue value in myXrecord.Data)
{
ed.WriteMessage("\n" + value.TypeCode.ToString() + " . " + value.Value.ToString());
}
}
catch (Exception exception1)
{
ProjectData.SetProjectError(exception1);
extensionDict.UpgradeOpen();
Xrecord myXrecord = new Xrecord();
TypedValue[] VB$t_array$S0 = new TypedValue[5];
TypedValue VB$t_struct$S1 = new TypedValue(70, 1);
VB$t_array$S0[0] = VB$t_struct$S1;
TypedValue VB$t_struct$S2 = new TypedValue(1, "MyStockData");
VB$t_array$S0[1] = VB$t_struct$S2;
TypedValue VB$t_struct$S3 = new TypedValue(40, 51.9);
VB$t_array$S0[2] = VB$t_struct$S3;
TypedValue VB$t_struct$S4 = new TypedValue(40, 100.0);
VB$t_array$S0[3] = VB$t_struct$S4;
TypedValue VB$t_struct$S5 = new TypedValue(40, 320.6);
VB$t_array$S0[4] = VB$t_struct$S5;
ResultBuffer data = new ResultBuffer(VB$t_array$S0);
myXrecord.Data = data;
extensionDict.SetAt("MyData", myXrecord);
trans.AddNewlyCreatedDBObject(myXrecord, true);
if (this.myPalette != null)
{
try
{
foreach (TreeNode node in this.myPalette.TreeView1.Nodes)
{
if (Operators.ConditionalCompareObjectEqual(node.Tag, ent.ObjectId.ToString(), false))
{
TreeNode childNode = node.Nodes.Add("Extension Dictionary");
foreach (TypedValue value in myXrecord.Data)
{
childNode.Nodes.Add(value.ToString());
}
goto Label_0302;
}
}
}
finally
{
IEnumerator VB$t_ref$L1;
if (VB$t_ref$L1 is IDisposable)
{
(VB$t_ref$L1 as IDisposable).Dispose();
}
}
}
Label_0302:
ProjectData.ClearProjectError();
}
trans.Commit();
}
catch (Exception exception2)
{
ProjectData.SetProjectError(exception2);
Exception ex = exception2;
ed.WriteMessage("a problem occured because " + ex.Message);
ProjectData.ClearProjectError();
}
finally
{
trans.Dispose();
}
}
}
[CommandMethod("addDataToNOD")]
public void addDataToNOD()
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
Transaction trans = ed.Document.Database.TransactionManager.StartTransaction();
try
{
DBDictionary nod = (DBDictionary) trans.GetObject(ed.Document.Database.NamedObjectsDictionaryId, OpenMode.ForRead);
try
{
ObjectId entryId = nod.GetAt("MyData");
ed.WriteMessage("\nThis entity already has data...");
Xrecord myXrecord = (Xrecord) trans.GetObject(entryId, OpenMode.ForRead);
foreach (TypedValue value in myXrecord.Data)
{
ed.WriteMessage("\n" + value.TypeCode.ToString() + " . " + value.Value.ToString());
}
}
catch (Exception exception1)
{
ProjectData.SetProjectError(exception1);
nod.UpgradeOpen();
Xrecord myXrecord = new Xrecord();
TypedValue[] VB$t_array$S0 = new TypedValue[5];
TypedValue VB$t_struct$S0 = new TypedValue(70, 1);
VB$t_array$S0[0] = VB$t_struct$S0;
TypedValue VB$t_struct$S1 = new TypedValue(1, "MyCompanyDefaultSettings");
VB$t_array$S0[1] = VB$t_struct$S1;
TypedValue VB$t_struct$S2 = new TypedValue(40, 51.9);
VB$t_array$S0[2] = VB$t_struct$S2;
TypedValue VB$t_struct$S3 = new TypedValue(40, 100.0);
VB$t_array$S0[3] = VB$t_struct$S3;
TypedValue VB$t_struct$S4 = new TypedValue(40, 320.6);
VB$t_array$S0[4] = VB$t_struct$S4;
ResultBuffer data = new ResultBuffer(VB$t_array$S0);
myXrecord.Data = data;
nod.SetAt("MyData", myXrecord);
trans.AddNewlyCreatedDBObject(myXrecord, true);
ProjectData.ClearProjectError();
}
trans.Commit();
}
catch (Exception exception2)
{
ProjectData.SetProjectError(exception2);
Exception ex = exception2;
ed.WriteMessage("a problem occurred because " + ex.Message);
ProjectData.ClearProjectError();
}
finally
{
trans.Dispose();
}
}