Author Topic: Storing Non-graphical drawing related settings or assembly lists  (Read 2795 times)

0 Members and 1 Guest are viewing this topic.

Atook

  • Swamp Rat
  • Posts: 1029
  • AKA Tim
What's the best way to store some settings or assembly lists for a drawing that aren't tied to any graphical entities?

These settings are on a per drawing basis, so saving them to the registry doesn't really make sense.

I've heard of folks writing xData to layer 0, but it this doesn't seem quite right.

Extension dictionaries seem to be tied to objects, unless I'm misunderstanding what I've read so far.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Storing Non-graphical drawing related settings or assembly lists
« Reply #1 on: June 20, 2015, 03:36:02 AM »
Hi,

You can add named dictionaries to the root  NamedObjectDictionary (NOD).
This AU class may be helpfull.
Speaking English as a French Frog

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Storing Non-graphical drawing related settings or assembly lists
« Reply #2 on: June 22, 2015, 10:18:26 AM »
Note there is a difference between "object" and "entity".  Entities are lines, circles, and most of the graphical content in a drawing; they are also objects.  Objects include things like text styles, extension dictionaries, and XRecords.  Extension dictionaries can be added to objects; since extension dictionaries are objects you can add nested extension dictionaries.  As noted there is a special dictionary (NOD) available for managing your own data.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Atook

  • Swamp Rat
  • Posts: 1029
  • AKA Tim
Re: Storing Non-graphical drawing related settings or assembly lists
« Reply #3 on: June 22, 2015, 12:25:02 PM »
Thanks for the replies, both of you. It looks like a named dictionary in the NOD is the intended way of doing this.

Would it be considered bad practice to put an extension dictionary on a layer, to make it more persistent to purges, wblock, etc?

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: Storing Non-graphical drawing related settings or assembly lists
« Reply #4 on: June 22, 2015, 01:21:50 PM »
I don't think the built in PURGE touches custom entries in the NOD.  I do know it won't touch non-empty entries.
Revit 2019, AMEP 2019 64bit Win 10

Jeff H

  • Needs a day job
  • Posts: 6150
Re: Storing Non-graphical drawing related settings or assembly lists
« Reply #5 on: June 22, 2015, 01:53:44 PM »
Thanks for the replies, both of you. It looks like a named dictionary in the NOD is the intended way of doing this.

Would it be considered bad practice to put an extension dictionary on a layer, to make it more persistent to purges, wblock, etc?

Extension Dictionaries are not entities and do not have a property for layer.
There is a property for TreatElementsAsHard I think it is called to make sure everything is cloned inside the dictionary.

Atook

  • Swamp Rat
  • Posts: 1029
  • AKA Tim
Re: Storing Non-graphical drawing related settings or assembly lists
« Reply #6 on: June 22, 2015, 02:15:38 PM »
Extension Dictionaries are not entities and do not have a property for layer.
There is a property for TreatElementsAsHard I think it is called to make sure everything is cloned inside the dictionary.

Thanks Jeff, what I meant was writing an extension dictionary  to a layer. Sounds like I should just put the dictionary in NOD and not worry about it.

TreatElementsAsHard seems like a good property to know.

« Last Edit: June 22, 2015, 02:55:25 PM by Atook »

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Storing Non-graphical drawing related settings or assembly lists
« Reply #7 on: June 22, 2015, 05:09:41 PM »
I'd only add one to a layer if it was "describing" that layer e.g. a layer that should have a certain color, so the layer would have a top-level container dictionary, which contains an XRecord with a color value.

I don't think doing so would make the layer resistant to purging; have a look in the DXF documentation for hard vs. soft pointers and purging.  Only items which have no hard references can be purged (hence, entities with a reference to a specific layer render the layer non-purgeable).
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Storing Non-graphical drawing related settings or assembly lists
« Reply #8 on: June 23, 2015, 09:02:51 AM »
I think he's looking for something that can withstand a wblock .. ie (command "._-wblock" filename "*").

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: Storing Non-graphical drawing related settings or assembly lists
« Reply #9 on: June 23, 2015, 05:54:06 PM »
adding data to layer 0 instead of NOD will not solve the effect wblocking has on things.
The fact is, its easy to leave behind NOD data if you wblock all to a new drawing.

If I were you, I would put in the NOD, and also have coomands to export to text file and import in, because life in the dwg world does require wblocking all to a new drawing here and there.
If you have users smart enough to get rid of NOD data, or careless enough that they do not understand wblocking a drawing out does not bring the data, you have bigger problems.
I've done "added data" so many ways now, I know exactly what approaches work and don't for a set of issues, so describe what you are worried about with using the NOD.
James Maeding