Poll

how to updata a AcDbViewport object?

AcDbViewport
3 (75%)
FreezeLayer
1 (25%)

Total Members Voted: 1

Author Topic: how to updata a AcDbViewport object?  (Read 8080 times)

0 Members and 1 Guest are viewing this topic.

mjguzik

  • Newt
  • Posts: 30
Re: how to updata a AcDbViewport object?
« Reply #15 on: December 31, 2007, 09:11:28 AM »
Just to close out the intent of the above workaround.  The problem was when manipulating the layer table -- changing frozen and off status. It would not update multiple viewports in paperspace without a REGENALL command.  The above was a workaround without requiring a regen and the litter on the command line.

The function is an EXPORT from the "acad.lib" file in the ARX library.  Both the ads_regen and acedRegenLayers need a declaration in a header file before implementing in a cpp file.

Regards,

MJG


Dream.Fei

  • Guest
Re: how to updata a AcDbViewport object?
« Reply #16 on: January 01, 2008, 01:01:04 AM »
Thank you~ MJG, and happy new year~

Dream.Fei

  • Guest
Re: how to updata a AcDbViewport object?
« Reply #17 on: January 02, 2008, 10:37:31 PM »
This's my project for freeze new layer on layout's viewport.
The layout has limit name with 1 to 5. when a new layerrecord append, freeze it on some layout.
On this project, I used "DocumentReactor" "DatabaseRector" and "LayoutReactor".

DocumentReactor: it's support for the MDI.
DatabaseReactor: when a new layerRecord append. call AcDbDatabaseReactor::objectAppend() method for freeze it.
LayoutReacotr: when rename the layout, updata the FreezeLayer's ID Array on the layout.

on this project, I have use "FeiOhter::ReadFileToArray" to get some layer's define from the text file. beacause I think it's too easy, so I don't post this function.

Thank's all help and I hope some one give me a suggest to optimization this project.

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 7026
  • AKA Daniel
Re: how to updata a AcDbViewport object?
« Reply #18 on: January 05, 2008, 07:34:46 AM »
This's my project for freeze new layer on layout's viewport.
The layout has limit name with 1 to 5. when a new layerrecord append, freeze it on some layout.
On this project, I used "DocumentReactor" "DatabaseRector" and "LayoutReactor".

DocumentReactor: it's support for the MDI.
DatabaseReactor: when a new layerRecord append. call AcDbDatabaseReactor::objectAppend() method for freeze it.
LayoutReacotr: when rename the layout, updata the FreezeLayer's ID Array on the layout.

on this project, I have use "FeiOhter::ReadFileToArray" to get some layer's define from the text file. beacause I think it's too easy, so I don't post this function.

Thank's all help and I hope some one give me a suggest to optimization this project.

Nice Coding  8-)

ahlzl

  • Guest
Re: how to updata a AcDbViewport object?
« Reply #19 on: March 10, 2008, 10:33:00 AM »
Ran into this problem some time ago with limited success updating layer changes in multiple viewports.  Then discovered what I believe is an undocumented function.  Hopefully this helps

Code: [Select]

// declarations
//

void __stdcall acedRegenLayers(class AcArray<class AcDbObjectId,class AcArrayMemCopyReallocator<class AcDbObjectId> > const &,int);

void applyLayerChanges();
Acad::ErrorStatus getLayerObjectIdArray();


// Implementation
//

// Usage applies changes to Layer Table forcing update and regen
//
void applyLayerChanges(void)
{
  applyCurDwgLayerTableChanges();
  if ( acdbHostApplicationServices()->workingDatabase()->tilemode() )
     ads_regen(); // Modelspace
  else {
    AcDbObjectIdArray layerIds;
    getLayerObjectIdArray(layerIds);
    acutPrintf(_T("Regenerating layout"));
    acedRegenLayers(layerIds, 0);
  }
  return;
}


// Usage return AcDbObjectIdArray of pDb LayerTable
Acad::ErrorStatus getLayerObjectIdArray(AcDbObjectIdArray& objIds, bool External, AcDbDatabase* pDb)
{
if ( pDb == NULL ) pDb =acdbHostApplicationServices()->workingDatabase();
Acad::ErrorStatus es = Acad::eOk;

AcDbLayerTable* pTable = 0;
es = pDb->getSymbolTable(pTable, AcDb::kForRead);
if ( es != Acad::eOk ) return es;

// Interate layers
//
AcDbLayerTableIterator* pIter = 0;
es = pTable->newIterator(pIter);
if ( es != Acad::eOk ) {
pTable->close();
return es;
}

for (pIter->start();!pIter->done();pIter->step())
{
AcDbLayerTableRecord* pRecord = 0;
es = pIter->getRecord(pRecord, AcDb::kForRead);
if( es == Acad::eOk ) {
if ( pRecord->isDependent() ) {
if (External == true)
objIds.append(pRecord->objectId());
}
else
objIds.append(pRecord->objectId());
}
pRecord->close();
}
delete pIter;
pIter = 0;

// Close layer table
pTable->close();
pTable = 0;
return es;
}


Never found any information on the int call of function other than trial and error.

Regards,

MJG

Study well and make progress every day.