Try different values of LAYOUTREGENCTL..
Try to redraw all entities on the affected layers.
AcDbObjectIdArray arrObjectsToRedraw; //Your entities on the affected layers for (int i=0; i<arrObjectsToRedraw.length(); i++) { es = acdbOpenObject(pEntity, arrObjectsToRedraw[i], AcDb::kForWrite); if (es==Acad::eOk) { pEntity->recordGraphicsModified(); pEntity->close(); } }
Hope that helps.
--Thomas
Try to call ads_regen() after freezing all layers.
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
hi, Alexander
I use Autocad 2014 and 2010, maybe I can't use this method, in VS2010, it fails to find this symble.
thx,
nolan
@nolanjian wrote:
hi, Alexander
I use Autocad 2014 and 2010, maybe I can't use this method, in VS2010, it fails to find this symble.
thx,
nolan
You can use ads_regen in all AutoCAD versions since 2000.
With AutoCAD 2014 you have to add next definition (as far as this function is not documented and is not defined in any of .h-files):
void ads_regen(void);
Also you have to link with accore.lib
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
I have made some changed to your code and tested it successfully with AutoCAD 2018. No additional ads_regen() was required.
I'm not sure what made the difference at the end. This is my general advice:
void cmdFreezeCurLayerInAllVPs() { Acad::ErrorStatus es; AcDbObjectIdArray ListPV; AcDbObjectIdArray ListLayers; AcDbViewport *PView0; AcDbObjectId Id0; int i; AcDbLayerTableRecord *Clayer0; AcDbDictionary *pDic=0; AcDbDictionaryIterator *pDicIter=0; AcDbLayout *pLayout=0; Id0 = acdbHostApplicationServices()->workingDatabase()->clayer(); ListLayers.append(Id0); es = acdbOpenObject(Clayer0, Id0, AcDb::kForWrite); if (es != Acad::eOk) return; else { Clayer0->setVPDFLT(true); Clayer0->close(); } es = acdbHostApplicationServices()->workingDatabase()->getLayoutDictionary(pDic, AcDb::kForRead); if (es != Acad::eOk) return; else { AcDbObjectIdArray allViewportIDs; if (pDicIter = pDic->newIterator()) { for (; !pDicIter->done(); pDicIter->next()) { es = pDicIter->getObject((AcDbObject*&)pLayout, AcDb::kForRead); // don't need kForWrite if (es == Acad::eOk) { if (pLayout->modelType() == Adesk::kFalse) { AcDbObjectIdArray vpsInLayout(pLayout->getViewportArray()); if (!vpsInLayout.isEmpty()) { vpsInLayout.removeFirst(); // remove the paperspace VP ListPV.append(vpsInLayout); // Just collect them all } } pLayout->close(); } } delete pDicIter; } pDic->close(); } // Now freeze the Layer all VPs for (i = 0; i < ListPV.length(); i++) // Start with i=0 because paperspace VPs are already removed { Id0 = ListPV.at(i); es = acdbOpenObject(PView0, Id0, AcDb::kForWrite); if (es == Acad::eOk) { es = PView0->freezeLayersInViewport(ListLayers); PView0->close(); } } }