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

AutoCAD 2008 AcDbLayerTableRecord::setIsFrozen bug

8 REPLIES 8
Reply
Message 1 of 9
Anonymous
842 Views, 8 Replies

AutoCAD 2008 AcDbLayerTableRecord::setIsFrozen bug

       

       static TCHAR szNewLayerName[100] = _T("");
        Acad_System::GetInputString(_T("LayerName:"),szNewLayerName);
        AcDbObjectId idLayer = Acad_System::GetLayerIDFromName(szNewLayerName);
        if (idLayer.isNull()) return;
        AcDbLayerTableRecordPointer pLayer(idLayer,AcDb::kForWrite);
        pLayer->setIsFrozen(!pLayer->isFrozen());

 

    first, make sure that there are some entitys on some layer(for example, "A", ), and make sure that your selected layer is not the CAD's current layer.   then execut the code above . you will find that the layer status in the CAD toolbar change as your desire. but the entitys on the selected layer are not.  I have to use command "re" to refresh. I believe this is a bug.  because setIsLock and setIsOff work well while setIsFrozen not.

8 REPLIES 8
Message 2 of 9
owenwengerd
in reply to: Anonymous

Take a look at the applyCurDwgLayerTableChanges function.

--
Owen Wengerd
ManuSoft
Message 3 of 9
Alexander.Rivilis
in reply to: Anonymous


@cnngtdly wrote:
[...]I believe this is a bug.  because setIsLock and setIsOff work well while setIsFrozen not.[...]

It is not a bug. It is by design. Otherwise, AutoCAD would have to find all the entities (iterate database), which belong to this layer and make them invisible. And if your program will freeze immediately thousands of layers? How long you would be ready to wait? And you freeze the layers, and then once with applyCurDwgLayerTableChanges used an altered state of the 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
Expert Elite Member

Message 4 of 9
Anonymous
in reply to: Alexander.Rivilis

yes, I understand your worry about the efficency , but "setIsOff " can also make the entitys belonging a layer invisialble. but "setIsOff" can do it automaticly without "applyCurDwgLayerTableChanges" .   "setIsOff" and "setIsFrozen" , these two function, both make entitys invisible,   I guess , "setIsOff" makes the layer invisible.  and "setIsFrozen" makes all the entitys belonging to a certain layer invisible, so  "setIsFrozen" takes more time, is that right?

Message 5 of 9
Anonymous
in reply to: owenwengerd

Nice to see you, my dear friend, are you also an engineer like Alexander? 

you are good at ARX coding. I have been working on ARX for years, but still did not quite understand it.

Message 6 of 9
owenwengerd
in reply to: Anonymous

I am an artist, not an engineer. Further to Alexander's reply, Off layers still generate display list geometry, whereas frozen layers do not, therefore thawing a layer requires a regen. Turning a layer On or Off does not; the geometry is already generated, it only needs to be displayed or hidden.

--
Owen Wengerd
ManuSoft
Message 7 of 9
Anonymous
in reply to: owenwengerd

I am afraid only applyCurDwgLayerTableChanges() is not enough. I added this global function , but the invisible entiys did not appear again untill I zoom the whole window. 

Message 8 of 9
Alexander.Rivilis
in reply to: Anonymous


@cnngtdly wrote:

I am afraid only applyCurDwgLayerTableChanges() is not enough. I added this global function , but the invisible entiys did not appear again untill I zoom the whole window. 


I hope that you close AcDbLayerTable and all AcDbLayerTableRecords before you call  applyCurDwgLayerTableChanges(). Other way is calling ads_regen():

void ads_regen();

 

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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
Expert Elite Member

Message 9 of 9
Anonymous
in reply to: Alexander.Rivilis

I can guarantee that AcDbLayerTable and all AcDbLayerTableRecords have been closed . but still not work in AutoCAD 2008 .  I feel a little confused.

 

        static TCHAR szNewLayerName[100] = _T("");
        Acad_System::GetInputString(_T("LayerName:"),szNewLayerName);
        AcDbObjectId idLayer = Acad_System::GetLayerIDFromName(szNewLayerName);
        if (idLayer.isNull()) return;
        {
            AcDbLayerTableRecordPointer pLayer(idLayer,AcDb::kForWrite);
            pLayer->setIsFrozen(!pLayer->isFrozen());
        }

        applyCurDwgLayerTableChanges();

 

the entitys on the selected layer can disappear normally, but won't appear again untill "regen" or "zoom".

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

Post to forums  

Autodesk Design & Make Report

”Boost