ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

set off a layer

9 REPLIES 9
Reply
Message 1 of 10
leonimas
433 Views, 9 Replies

set off a layer

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

9 REPLIES 9
Message 2 of 10
owenwengerd
in reply to: leonimas

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.

--
Owen Wengerd
ManuSoft
Message 3 of 10
leonimas
in reply to: owenwengerd

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

Message 4 of 10
owenwengerd
in reply to: leonimas

Try ads_regen() to update the display.

--
Owen Wengerd
ManuSoft
Message 5 of 10
leonimas
in reply to: owenwengerd

I've tried acedUpdateDisplay() but nothing ...

 

ads_regen() where is ? VS2010 doesn't find this function ...

Message 6 of 10
owenwengerd
in reply to: leonimas

Here is the declaration:

 

void ads_regen(void);

 

--
Owen Wengerd
ManuSoft
Message 7 of 10
leonimas
in reply to: leonimas

ads_regen() doesn't works ... 😞

Message 8 of 10
owenwengerd
in reply to: leonimas

In what context is your code executing? Test it in a standard command function to determine whether context affects your results.

--
Owen Wengerd
ManuSoft
Message 9 of 10
leonimas
in reply to: owenwengerd

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

 

Message 10 of 10
owenwengerd
in reply to: leonimas

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.

--
Owen Wengerd
ManuSoft

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost