.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reply
Message 1 of 8
autodeskprogrammer
718 Views, 7 Replies

Database

I have question ,
Do you think that I can use Autocad Database structure instead of an external database. because now I combine .DWG file and .MDB file and made .ATNX file because I should save my data in a table structure.
But now I am thinking that can I save my MDB file in Auto Cad's internal data structure?

 

THANX

7 REPLIES 7
Message 2 of 8

Not entirely sure this is what you're trying to do, but if you are storing .DWG files in some data structure or blob, there is no way to read that data directly into a Database. The Database class doesn't provide a way to read a DWG file from a stream or any other source aside from disk files, so the data must be written to a file first, and then read using ReadDwgFile().

Message 3 of 8

why should I save data in to a file ? now we read data directly from DWG file for example BLOCK or other Objects that we save them in internal data structure of Autocad? I want to use this internal data struture !!!

Message 4 of 8

Sorry, your description doesn't really tell much about exactly what it is you're trying to achieve. If you want to offer a more detailed explaination, feel free to do so.

Message 5 of 8

OK, let me to explain

 

In fact I save some data in Autocad internal data structure or internal database (Extension Dictionary) and I save a lot of data in MDB file and then I make a combination of dwg and mdb files and finally a combination and make a ATNX file.

 

it's a part of my code to show where I save my data now

 

 DBObject dbObject = tr.GetObject(SelectedObjectId, OpenMode.ForRead);
                    if (dbObject.ExtensionDictionary == ObjectId.Null)
                    {
                        dbObject.UpgradeOpen();
                        dbObject.CreateExtensionDictionary();
                    }

                    DBDictionary ExtensionDictionary = (DBDictionary)tr.GetObject(dbObject.ExtensionDictionary, OpenMode.ForWrite);
                    Xrecord xrec = new Xrecord();
                    xrec.Data = new ResultBuffer(
                        new TypedValue((int)DxfCode.Text, ParentCode),
                        new TypedValue((int)DxfCode.Text, NodeCode),
                        new TypedValue((int)DxfCode.Int32, NodeType),
                        new TypedValue((int)DxfCode.Int32, ProductCode),
                        new TypedValue((int)DxfCode.Real, Angle));

                    ExtensionDictionary.SetAt("AT_INFO", xrec);

 

 

now I want to know if is it possible to save my external data (the data that I save in MDB) in Autocad?

 

actually this DLL is very complicated and it's a worked on it about three year and now I want to improve it and I prefer not to use MDB file and instead I want to use Autocad's abilities

 

 

 

THANX

Message 6 of 8
Hallex
in reply to: autodeskprogrammer

Take a look at :

Autodesk.AutoCAD.DatabaseServices.DataTable class

this is the same as Xdata you can edit rows and columns of this table

within the drawing but could not delete it, after you add this table

in to NOD dictionary as named instance it would be persistent but editable

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 7 of 8
autodeskprogrammer
in reply to: Hallex

thanx a lot , I will check it Smiley Happy

Message 8 of 8

You can store almost anything in a drawing file, but if it is not types that AutoCAD recognizes (e.g., binary data), then it becomes more difficult, but not impossible.  You can store binary data in chunks within xrecords, subject to some size limits, and there's code floating around that allows you to binary-serialize/deserialize.NET objects to/from a DWG file as well.

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost