Store data entered in a form

Store data entered in a form

mecoman6GF27
Advocate Advocate
1,333 Views
7 Replies
Message 1 of 8

Store data entered in a form

mecoman6GF27
Advocate
Advocate

Hi everyone.

Do you think it is possible to memorize the data inserted in a form without using NOD?

Thanks a lot, bye.

0 Likes
Accepted solutions (1)
1,334 Views
7 Replies
Replies (7)
Message 2 of 8

_gile
Consultant
Consultant

Hi,

It depends on the kind of storing

  • In the current drawing only during the current session: you can store the data as instance members of a class or Document.UserData entries (see this topic)
  • Persistant in a drawing: typically xrecord or xdata, xrecords can be attached to a named dictionary (NOD) or an extension dictionary of some non purgeable object such as the layer "0", some symbol table, xdata should also be attached to some non purgeable object.
  • Persistant and accessible from any drawing: entries of a Registry key or data stored in an external file (.txt, .csv, .ini, .xml, .json, ...)


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 8

fieldguy
Advisor
Advisor

I have used the "dwgprops" custom category to store form information in the past.  These properties are exposed to users. Link below

https://forums.autodesk.com/t5/net/need-to-add-custom-metadata-in-the-autocad-files-dwg/m-p/9875502#... 

 

0 Likes
Message 4 of 8

mecoman6GF27
Advocate
Advocate

Hello and thanks for the replies.

I really think I'll have to use Xrecords connected to a NOD but I asked myself a question that I ask you too.

"Is it possible to create a NOD accessible only by my application and not by others? If yes, how?"

Thanks a lot, bye.

0 Likes
Message 5 of 8

fieldguy
Advisor
Advisor

I don't think you can hide anything in a dwg file. Some user who digs around will find it and mess with it.

You could try "Properties.Settings"?  Something like "MyAppnamespace.Properties.Settings.Default.somesetting".

That seems to work for text anyway (read / write).

Link: https://stackoverflow.com/questions/453161/how-can-i-save-application-settings-in-a-windows-forms-ap...  

0 Likes
Message 6 of 8

mecoman6GF27
Advocate
Advocate

Hi everyone.
I'm still evaluating the best solution for my case and I would like to ask you some questions.
How should I go about:
1. Connect a new XRecord to layer 0?
2. See the list of XRecords connected to layer 0?
3. Read all the XRecords connected to layer 0 or one in particular?
Thanks and sorry for the questions (for you they will be trivial) but I still have to learn a lot.
Bye.

0 Likes
Message 7 of 8

_gile
Consultant
Consultant
Accepted solution

Xrecords belongs to DBDictionaries and are accessible by their "name" (key) which is unique within the owner dictionary.

There's two kinds of dictionaries:

- named dictionaries that belongs to a DBDictionary (typically the Named Objects Dictionary which is the root dictionary for named dictionaries). As Xrecords they are accessible by their name.

- extension dictionaries that belongs to any DBObject.

 

So, to store some xrecords, you could either use the extension dictionary of the layer 0 or simply create a new named dictionary in the NOD.

 

You can find in this reply some extension methods to read/write xrecord data. These extension methods are extracted from a largest library: Gile.AutoCAD.Extension.

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 8 of 8

mecoman6GF27
Advocate
Advocate

hello and thank you very much to all.

0 Likes