Embedding Unique Numerical Values into Drawing Data

Embedding Unique Numerical Values into Drawing Data

saitoib
Advocate Advocate
632 Views
5 Replies
Message 1 of 6

Embedding Unique Numerical Values into Drawing Data

saitoib
Advocate
Advocate

Hi all.

 

I have learned from this site that each object in AutoCAD can store its own data.
Now, can I store my own data in each drawing data?

 

Tank you.

Saitoib
0 Likes
Accepted solutions (1)
633 Views
5 Replies
Replies (5)
Message 2 of 6

CodeDing
Advisor
Advisor
Accepted solution

@saitoib ,

 

There are 2 common ways to store your own data. XData & Dictionaries/XRecords.

 

XData is associated to an entity. Probably most commonly to graphical entities.

XData Functions:

https://help.autodesk.com/view/OARX/2020/ENU/?guid=GUID-0949AEA9-3942-42C5-8DF4-BC58758319BD

XData Afralisp Examples:

https://www.afralisp.net/autolisp/tutorials/extended-entity-data-part-1.php

 

Dictionaries & XRecords are stored in the Named Object Dictionary (The primary storage area for all non-graphical objects) and stay with the drawing.

Dictionary & XRecord Functions:

https://help.autodesk.com/view/OARX/2020/ENU/?guid=GUID-7AACB386-1AA1-4BDF-B5D7-A1E23A51CA15

Dictionary & XRecord Afralisp Examples:

https://www.afralisp.net/autolisp/tutorials/dictionaries-and-xrecords.php

 

Hope that helps. Best,

~DD

0 Likes
Message 3 of 6

saitoib
Advocate
Advocate

Thank you for sharing this important information.
I'll study it.

 

Saitoib
0 Likes
Message 4 of 6

john.uhden
Mentor
Mentor

Plus, most every, if not every, object has an extensiondictionary that can hold xrecords just like the namedobject dictionary.

Then there are helper functions like vlax-ldata-put and vlax-ldata-get which can store all kinds of things, even lists, as xrecords.  Some around here over the years have said that those two functions are dangerous or at least faulty, but I have used them a lot without any error at all.

Good luck hiding your Easter eggs somewhere clever!

John F. Uhden

0 Likes
Message 5 of 6

saitoib
Advocate
Advocate

Thank you for all your help and support.
I will do my best and study hard.

Saitoib
0 Likes
Message 6 of 6

Kent1Cooper
Consultant
Consultant

[Just a suggestion....  Don't use the "Reply to the topic" slot at the bottom of the thread.  It always shows what you post as being "in reply to" Message 1.  So if you are the originator as in this case, your posts always show up as in reply to yourself.  It can often be difficult to understand what you're replying about, whom you are thanking for their input, etc., especially if there are other intervening Messages between.  If you use the blue Reply button at the bottom right in an individual Message, it will at least be clear to whom you're replying, and if you quote at least an excerpt from their Message, it will be clearer what your reply is about, and if they have posted more than once, to which of their Messages you're replying.]

Kent Cooper, AIA