Add objecthandle to dictionary .net

Add objecthandle to dictionary .net

Anonymous
Not applicable
345 Views
3 Replies
Message 1 of 4

Add objecthandle to dictionary .net

Anonymous
Not applicable
Hello group,
is it possible to save the handle of an object in a dictionary?
I have created a block with an attribute named pointnumber and want to save it like :
dic.SetAt(pointnumber,blockreference.Handle);

The problem is that the second parameter of the SetAt-function must be an object derived from the DBObject-class.

Thanks for replies
0 Likes
346 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
A dictionary contains objects not raw data - the objects can then contain
the data. What you can do is to use an AcDbXRecord to put in the dictionary
and have the XRecord hold the handle.

wrote in message news:4839548@discussion.autodesk.com...
Hello group,
is it possible to save the handle of an object in a dictionary?
I have created a block with an attribute named pointnumber and want to save
it like :
dic.SetAt(pointnumber,blockreference.Handle);

The problem is that the second parameter of the SetAt-function must be an
object derived from the DBObject-class.

Thanks for replies
0 Likes
Message 3 of 4

Anonymous
Not applicable
Hello.
Thank you for reply.
My solution was to save the BlockReference-object himself in the dictionary. However I don't no if this kind of doing is wasting much memory. If I discover this I will try it with xRecord.
0 Likes
Message 4 of 4

Anonymous
Not applicable
You've added an AcDbBlockReference to a dictionary? That's not good at all.
Only non-entity objects should be in dictionaries. Entities need to be in
BlockTableRecords so that their graphics will be displayed. And, there
might be other issues that come up with a BlockReference being owned by a
dictionary because AutoCAD does not expect this to ever happen.

If the BlockReference is in both a BlockTableRecord and a dictionary then
you've got a corrupt drawing because the BlockReference now has two owners.

wrote in message news:4840945@discussion.autodesk.com...
Hello.
Thank you for reply.
My solution was to save the BlockReference-object himself in the dictionary.
However I don't no if this kind of doing is wasting much memory. If I
discover this I will try it with xRecord.
0 Likes