Author Topic: PerDocumentClassAttribute  (Read 1925 times)

0 Members and 1 Guest are viewing this topic.

Jeff H

  • Needs a day job
  • Posts: 6150
PerDocumentClassAttribute
« on: April 16, 2014, 06:52:41 PM »
Have 2014 but never used it other than opening it a couple times but looking at 2015 and adding some nice things

Quote
This custom attribute class is used to mark a type so that an instance of that type will be instantiated for each document open/opened in AutoCAD.

An application may designate as many types as desired with this attribute. When the application is loaded into AutoCAD, a new instance of the type will be instantiated for each document currently open and a reference to the document, and a new instance will be instantiated for each document opened thereafter. When a document is closed, the associated type instance will be disposed if it derives from IDisposable.

The type associated with a PerDocumentClass attribute must provide either a public constructor that takes a Document argument, or a public static Create method that takes a Document argument and returns an instance of the type. If the Create method exists, it will be used, otherwise the constructor will be used. The Document that the type instance is being created for will be passed as the Document argument so that the type instance knows which Document it is associated with


Kean

  • Newt
  • Posts: 48
Re: PerDocumentClassAttribute
« Reply #1 on: April 23, 2014, 07:20:35 AM »

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: PerDocumentClassAttribute
« Reply #2 on: April 23, 2014, 07:41:54 AM »
Thanks Kean, your blog explained it as usual.  This is a great add,  I've got some per document Palettes that I could use this with.
Revit 2019, AMEP 2019 64bit Win 10

Jeff H

  • Needs a day job
  • Posts: 6150
Re: PerDocumentClassAttribute
« Reply #3 on: April 24, 2014, 09:44:41 AM »
Thanks Kean!

Kean

  • Newt
  • Posts: 48
Re: PerDocumentClassAttribute
« Reply #4 on: April 24, 2014, 11:00:31 AM »