Author Topic: On Drawing Close (save or No Save)  (Read 5150 times)

0 Members and 1 Guest are viewing this topic.

GumbyCAD

  • Newt
  • Posts: 84
Re: On Drawing Close (save or No Save)
« Reply #15 on: June 05, 2014, 01:35:24 AM »
Well at first glance, WOW.

I totally understand were you coming from as I am a structural guy too.  (But Draftsman turned Programmer - try hard)

I understand why you destroy the Event

But a lot of what you have I don't understand, mostly because I dont understand dictionaries.

Thanks for Sharing.  I will study it some more , need to do some reading on dictionaries first.

Stephan

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: On Drawing Close (save or No Save)
« Reply #16 on: June 05, 2014, 01:48:16 AM »
I totally understand were you coming from as I am a structural guy too.

This is the reason for writing the code.  I'm an electrical engineer, this extra job was just a pain and wanted it to go away lol

Dictionaries are pretty simple, you store and access objects by a key.  It's very fast, which is why I use it in the overridden methods to access data.

GumbyCAD

  • Newt
  • Posts: 84
Re: On Drawing Close (save or No Save)
« Reply #17 on: June 05, 2014, 01:50:53 AM »
Quote
Dictionaries are pretty simple, you store and access objects by a key.  It's very fast, which is why I use it in the overridden methods to access data.

Whats the difference between using List(of ObjectType) or Dictionary?  (VB Code sorry)

Is one better than the other?
They seam to do the same job.

Stephan

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: On Drawing Close (save or No Save)
« Reply #18 on: June 05, 2014, 02:06:04 AM »
very similar, the dictionary provides indexing.

I use a dictionary<objectId, CustomDataObject> meaning the customdataobject (value) is accessed by the objectid (key)
Each key value pair is quickly accessible by the key

This is important in the example as I am dealing with per object data and it allows me to access the correct data.

In your case, this could be applicable where you create a dictionary and upon drawing creation you construct some data about the drawing, then when the save event fires you save a copy of that data, and when the tobedestroyed event fires you delete the data from your dictionary