AcDbObjectContextManager pointer to incomplete class not allowed

AcDbObjectContextManager pointer to incomplete class not allowed

karl.sch1983
Advocate Advocate
92 Views
2 Replies
Message 1 of 3

AcDbObjectContextManager pointer to incomplete class not allowed

karl.sch1983
Advocate
Advocate

I am trying to run the below code from this post

	AcString annoName(_T("Scale 1:125"));
	AcDbObjectContextManager* cManager = acdbCurDwg()->objectContextManager();
	AcDbObjectContextCollection* col = cManager->contextCollection(ACDB_ANNOTATIONSCALES_COLLECTION);
	col->removeContext(annoName);

Keep getting error - Error (active) E0393 pointer to incomplete class type "AcDbObjectContextManager" is not allowed
Can anyone guide how to proceed? I am simply trying to get the current annotation scale collection and all posts show the same approach of getting the contextManager and then the contextcollection. But it is not working for me. Please provide some guidance. I am stuck.

0 Likes
Accepted solutions (1)
93 Views
2 Replies
Replies (2)
Message 2 of 3

daniel_cadext
Advisor
Advisor
Accepted solution

Did you include the headers?

 

#include "dbObjectContextManager.h"
#include "dbObjContext.h"
#include "dbAnnotationScale.h"
#include "dbObjectContextCollection.h"
#include "dbObjectContextInterface.h"

 static void AcRxPyApp_idoit(void)
 {
     AcDbObjectContextManager* cManager = acdbCurDwg()->objectContextManager();
     AcDbObjectContextCollection* col = cManager->contextCollection(ACDB_ANNOTATIONSCALES_COLLECTION);
     for (std::unique_ptr<AcDbObjectContextCollectionIterator> iter(col->newIterator()); !iter->done(); iter->next())
     {
         AcString annoName;
         AcDbObjectContext* ctx = nullptr;
         if (iter->getContext(ctx) != eOk)
             continue;
         if(ctx->getName(annoName) != eOk)
             continue;
         acutPrintf(_T("\nName = %ls"), (const wchar_t*)annoName);
     }
 }
Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 3 of 3

karl.sch1983
Advocate
Advocate

Feeling stupid!! You are right. I was missing the 

#include "dbObjectContextManager.h"

Thank again @daniel_cadext . Really appreciate your time.