Hi to all,
I want to set off a layer; I've writted the following code (autocad 2012):
err = pLayerTable->getAt(_T("TEXT_DESCR"), layerId);
if(err != Acad::eOk)
{
MessageBox(acadHandle, acadErrorStatusText(err), _T("Titolo"), MB_ICONERROR);
return;
}
acdbOpenObject(pLayerTableRecord, layerId, AcDb::kForWrite);
pLayerTableRecord->setIsOff(Adesk::kTrue);
pLayerTableRecord->close();
pLayerTable->close();
but the "bulb lamp" icon of the TEXT_DESCR layer, keeps the same yellow state ...
How to simulate (with objectarx) the _LAYOFF command ?
Best Regards
Leonard
Your thread title is misleading, as your question is actually about how to trigger an update of the UI to reflect your programmatic changes. I don't know the answer offhand, but fixing your title may attract more attention. BTW, your code snippet fails to close the layer table in the err != Acad::eOk case.
Sorry,
I expressed myself badly ... the title it's ok, I want to disappear a graphic
entity of a block, and this entity is drawn with the layer "TEXT_DESCR".
If I use the 'setIsOff()' function the entity doesn't disappear ...
Thanks
Leonard
I've tried acedUpdateDisplay() but nothing ...
ads_regen() where is ? VS2010 doesn't find this function ...
In what context is your code executing? Test it in a standard command function to determine whether context affects your results.
Hi,
the code is the following (inside an autocad command):
static void ASTSIced_ICEDInsert () {
....
err = pDwgDb->getLayerTable(pLayerTable, AcDb::kForRead);
if(err != Acad::eOk)
{
MessageBox(acadHandle, acadErrorStatusText(err), _T("Title"), MB_ICONERROR);
return;
}
if (pLayerTable->has(_T("TEXT_DESCR")))
{
err = pLayerTable->getAt(_T("TEXT_DESCR"), layerId);
if(err != Acad::eOk)
{
MessageBox(acadHandle, acadErrorStatusText(err), _T("Titolo"), MB_ICONERROR);
pLayerTable->close();
return;
}
acdbOpenObject(pLayerTableRecord, layerId, AcDb::kForWrite);
pLayerTableRecord->setIsOff(Adesk::kTrue);
pLayerTableRecord->close();
//acedUpdateDisplay();
//ads_regen();
}
pLayerTable->close()
....
}
...
ACED_ARXCOMMAND_ENTRY_AUTO(CIcedApp, ASTSIced, _ICEDInsert, ICEDInsert, ACRX_CMD_MODAL, NULL);
Best Regards
Leonard
Some things to try:
1) Does a manual _REGEN at the command prompt (after running your command) update the display as you expect? If not, then maybe the problem is your expectations instead of the code.
2) If you are targeting a specific block, perhaps opening all block references of that block and calling recordGraphicsModified() will trigger an update.