Entity Visible property not working

1
archana_saini
4/29/2015 9:25 AM

Hi

The "Entity Visible property not working".

Code:
foreach (DxfEntity entity in ActiveCadEditControl.Model.Entities)
{
entity.Visible = false;
ActiveCadEditControl.CreateDrawables(entity);
ActiveCadEditControl.Refresh();
propertyGrid.SelectedObject = entity;
}

But Entity is still Visible but not enabled.

Thanks
Archana Saini

archana_saini
5/4/2015 6:55 AM

Hi

Any update?


Wout
5/5/2015 10:40 AM

Hi,

There are 2 ways of doing it. With or without undo/redo.

Here's the simple way without redo/undo (changing the first entity as an example):

C# Code:
DxfEntity entity = ActiveCadEditControl.Model.Entities[0];
entity.Visible = false;
ActiveCadEditControl.UpdateDrawables(entity, false);

Or the same, but with redo/undo:

C# Code:
DxfEntity entity = ActiveCadEditControl.Model.Entities[0];
bool oldVisible = entity.Visible;
Command command = new Command(
    entity,
    () => entity.Visible = false,
    () => entity.Visible = oldVisible
);
CommandWrapper commandWrapper = new CommandWrapper(command, entity, ChangeType.Modify);
ActiveCadEditControl.CommandInvoker.Do(commandWrapper);
ActiveCadEditControl.AddCommand(commandWrapper);

- Wout

Wout
5/5/2015 10:42 AM

By the way, the CreateDrawables call you did won't work because it will try to add new drawables for the specified entity. It does not affect any existing drawables.

- Woiut

archana_saini
5/12/2015 4:32 AM

Hi Wout

Thanks !!

Regards
Archana Saini

1