no Layer selection troubles

no Layer selection troubles

Anonymous
Not applicable
393 Views
3 Replies
Message 1 of 4

no Layer selection troubles

Anonymous
Not applicable
Hi all,

In my application the user can select an entity and modify some properties via a dialog of mine. Once the dialog is closed i have to refresh my entity. To do so, i use an "easy" way: i delete the old entity and draw a new one. Everything works fine so far.

The problem occurs when i select an entity to change a properties which tell me that i have to draw it in another layer. When i delete my old entity, the selection set is empty of course. At this time the layer control in the toolbar seems to get lost and show me no layer at all (It looks similar when you select a few objects from different layers).

I wouldn't mind this behavior if it was only that. But the real problem occurs when i click on this layer control (to select a layer for instance) and actually do NOT select anything and just click somewhere else. AutoCAD crashes then...

I checked system's variables using sysVarChanged() and find out that CLAYER is not changed. So I tried to manually set a layer after my 'refresh' operation, but i couldn't find a proper solution. I see CLAYER changing, but the layer control in the toolbar still behaves the same way.

I noticed if I select any entities in my drawing after the refresh, then the layer control show the entity's layer and then I can use the layer control as usual without crashes.

I wonder if it's an AutoCAD's issue or maybe something about document's lock.

Any clues about that ?
thanks
0 Likes
394 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
I wrote to ADN support about my problem. They couldn't give me an interesting answer yet. But in the meanwhile i modified a sample of code to show the bug.

There is a small description in the ents.cpp header how to reproduce the issue. It's actually very simple.

As you can see in the code, I found a workaround. But I would like to know more about the issue... AutoCAD's bug ?

Any comments welcome 😉
0 Likes
Message 3 of 4

OysteinW
Advocate
Advocate
Hi, one thing you can try, is to use the function AcDbEntity::setVisibility(AdDb::kInvisible); after AcDbEntity::erase(); If not, the ent's will still be visible, wich can casue problems because they actually are erased...

But I haven't quite figured out why you need to erase the entities in the first place..(?)
0 Likes
Message 4 of 4

Anonymous
Not applicable
Hi,
I know my "refresh" procedure is weird, but just let's pretend it's normal 😉

I tried your suggestion and it still crash unfortunately. Anyway now i use the no-ACRX_CMD_REDRAW trick to avoid this bug.

I got an answer from Autodesk's support, they could reproduce the issue and told me that's an AutoCAD's bug. So I'll keep using my trick for a while... till they fix AutoCAD or I change my refresh way 😉
0 Likes