Owen told us why worldDraw() can be called before there is a Document object for the database being opened, but explicitly loading and initializing your managed code is not the problem.
The problem is that your managed code is dependent on the Document object representing the drawing file being opened, which is not available at the point when worldDraw() is first called.
You must change your approach, to eliminate that dependence (perhaps associating instances of your managed type with a Database rather than a Document), although I still don't like the idea of having that kind of dependence to start with.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm
wrote in message news:6054393@discussion.autodesk.com...
Hi, I am having a Solution which Contains 3 Projects.
1. MyHelper - A C# project which contains a class called MyCircle which will have a static member called NoofCircles (integer). It contains a callback delegate for DocumentCreated and it is added to the newly created document within Initialize() (of IExtensionApplication). The instance for the class MyClass will be created in the callback method for DocumentCreated and the NoofCircles is initialized to 5.
2. MyConcentricCircle - ObjectDBX project which will get the count from the MyHelper::NoofCircles and draws Concentric Circle accordingly.
3. UI - Command to create a Concentric Circle. Now, when i load the dlls into autocad, first, the MyHelper's Initialize() is called so that, NoofCircles is initialized to 5.
Then, When i give the command to create a circle, it create 5 concentric circles by getting the Count from the MyHelper project's MyCircle::NoofCircles.
Then i save it. Closed the document and reopened the document again.
But at that time, WorldDraw gets called before the DocumentCreated callback of MyHelper Class, before where an instance of MyCircle will be created and NoofCircles Initialized to 5.
Could anyone kindly tell me why WorldDraw of the Custom Object is called before On_kLoadDwgMsg and DocumentCreated callback methods are called?
Thank You in Advance.
Regards,
Vignesh. S Edited by: Vignesh_CPT on Oct 20, 2008 5:38 PM