store custom binary data inside a drawing file

store custom binary data inside a drawing file

GeryKnee
Advocate Advocate
623 Views
4 Replies
Message 1 of 5

store custom binary data inside a drawing file

GeryKnee
Advocate
Advocate

 

Hello,

I need to store binary data that contain information about the document iside the drawing

For Examble i have data stored into the MyDat.dat binary file

If my information was a simple integer value i sould store it to document using userI1..5 System variables (which autocad stores with the drawing)

The system variables someone can keep stored in the drawing are 5 integers (userI1..5) and 5 reals (userR1..5)

There are aditionally 5 strings (userS1..5) who are lost by saving and closing the document.

So, i have no the ability sto store long binary information inside the drawing.

If it's bossible

 a) To store the contents (the stream) of MyDat.dat file to drawing (dwg file) so that i don't need to keep a separate file.

 b) to Retreive the data from drawing and store them to a temporay MyDat.dat file , and handle them.

I don't see something that helps me looking at the object model 's ActiveDocument object properties and methods.

 

Can anyone help me in this?

Gery

0 Likes
624 Views
4 Replies
Replies (4)
Message 2 of 5

BlackBox_
Advisor
Advisor

Not sure of the complexity of your binary data, but you have several a few options.

 

If you're not so good at coding, then the simplest way would be to add your own custom SystemVariable(s) as I show in this thread, just be sure to set the StorageType XmlAttribute's value to Database Type, so the data will be saved to the drawing (available in 2015+ only).

 

If you're adept at coding, or using 2014 (and older), then you might instead simply store your data to NOD (Named Object Dictionary) via XRecord, unless storing to individual Objects via XData is more ideal (again, not sure of the context of your binary data).

 

Cheers


"How we think determines what we do, and what we do determines what we get."

Sincpac C3D ~ Autodesk Exchange Apps

0 Likes
Message 3 of 5

GeryKnee
Advocate
Advocate

I use the Acad2006 vers.

As I see in object model , document property got the Dictionaries property wich has

  1)  the GetXData methode

  2)  the SetXData methode

My Data are binary (the contents of my binary file) - a stream of bytes

As I use Delphi (Pascal) to manipulate the acad ole sould i know a way to store data

if i use the following

 var MyData:array of byte;

 Wich is the DataType for this ?

0 Likes
Message 4 of 5

dgorsman
Consultant
Consultant

Stupid question time: why does it have to be stored as binary data?

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 5 of 5

braudpat
Mentor
Mentor

 

Hello

 

I am not at all a programmer but this document can help you if you plan to use Dictionnaries & Xrecords ...

 

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


0 Likes