This is the dotNet newsgroup.
He's not talking about the ActiveX method you describe,
although that may be faster if there's a lot of XDATA.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
"TomD" wrote in message news:4937638@discussion.autodesk.com...
I'm not the most experienced XData person, but I've never experienced what
you're describing.
The GetXData method should return the XData for ONLY the application name
specified. You'd have to post your SkorXData code. If I had to guess,
based on this information, I'd say you have the GetXData parameters wrong.
If passed with an empy string for the appname, you may get the results
you're describing, I don't know.
"Laurence Skoropinski" wrote in message
news:4937038@discussion.autodesk.com...
You appear to be able to add xdata to an entity with different application
names with multiple calls to the XData property, yet to extract them there
only appears to be a way to get all applicationnames from the XData
property.
The question is there a way to extract only the applicationnamed xdata I am
interested in, or do I just accept walking the xdata buffer until I find the
application name I want and then process it?
Below function just proves multiple calls with different application names
works, note SkorXData is my helper class for xdata.
[CommandMethod("TEST1", CommandFlags.Modal)]
public static void TestCommand_1()
{
Database db = HostApplicationServices.WorkingDatabase;
Editor Ed = AppServ.Application.DocumentManager.MdiActiveDocument.Editor;
TransactionManager tm = db.TransactionManager;
Transaction trans = tm.StartTransaction();
string AppName = "LOZTEST";
SkorXData.CreateXDAppName(AppName);
try
{
BlockTableRecord btr = (BlockTableRecord)trans.GetObject(db.CurrentSpaceId,
OpenMode.ForWrite);
Point3d CtrPt = new Point3d(10, 20, 30);
Point2d TestPt = new Point2d(100, 200);
Circle circle = new Circle(CtrPt, Vector3d.ZAxis, 2);
ObjectId CircleID = btr.AppendEntity(circle);
//=============xdata==========================================
ResultBuffer buf = new ResultBuffer();
buf.Add( new TypedValue((int) DxfCode.ExtendedDataRegAppName, AppName));
SkorXData.AddTypeToBuf(ref buf, "Test Text");
SkorXData.AddTypeToBuf(ref buf, 123456789);
circle.XData = buf;
SkorXData.CreateXDAppName("TESTXDATA");
ResultBuffer buf2 = new ResultBuffer();
buf2.Add( new TypedValue((int) DxfCode.ExtendedDataRegAppName,
"TESTXDATA"));
SkorXData.AddTypeToBuf(ref buf2, "Test Xdata");
SkorXData.AddTypeToBuf(ref buf2, 987654321);
circle.XData = buf2;
trans.AddNewlyCreatedDBObject(circle, true);
trans.Commit();
}
catch( Autodesk.AutoCAD.Runtime.Exception e )
{
Ed.WriteMessage("Error: " + e.Message);
}
finally
{
trans.Dispose();
}
}