Delete layer problem

Delete layer problem

Anonymous
Not applicable
434 Views
1 Reply
Message 1 of 2

Delete layer problem

Anonymous
Not applicable
hi I am able to delete layer successfully using my code as below

AcDbLayerTable *pTable = 0;
Acad::ErrorStatus es = acdbCurDwg()->getLayerTable(pTable,
AcDb::kForRead);
if(es == Acad::eOk)
{
AcDbLayerTableRecord *pRec = 0;
if(pTable->has("LAYER TO DELETE"))
{
if(pTable->getAt("LAYER TO DELETE", pRec, AcDb::kForWrite) == Acad::eOk)
{
pRec->erase();
pRec->close();
}
}
pTable->close();
}

after delete i am calling applyCurDwgLayerTableChanges() function as well.

My problem is the name of deleted layer remains there in Layer Manager Combo box / Dialog.

How to remove this layer entry.

thanks in advance.

Best regards,
Santosh
0 Likes
435 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
You're not checking the status of erase( ). Are you sure that's succeeding?

-Rich


wrote in message news:[email protected]...
hi I am able to delete layer successfully using my code as below

AcDbLayerTable *pTable = 0;
Acad::ErrorStatus es = acdbCurDwg()->getLayerTable(pTable,
AcDb::kForRead);
if(es == Acad::eOk)
{
AcDbLayerTableRecord *pRec = 0;
if(pTable->has("LAYER TO DELETE"))
{
if(pTable->getAt("LAYER TO DELETE", pRec, AcDb::kForWrite) == Acad::eOk)
{
pRec->erase();
pRec->close();
}
}
pTable->close();
}

after delete i am calling applyCurDwgLayerTableChanges() function as well.

My problem is the name of deleted layer remains there in Layer Manager Combo
box / Dialog.

How to remove this layer entry.

thanks in advance.

Best regards,
Santosh
0 Likes