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

Is it possible to create a layer that does not appear in LayerManager?

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
sdphg
747 Views, 8 Replies

Is it possible to create a layer that does not appear in LayerManager?

I want to create a layer that can only be managed by code, not by the user. So this layer must not appear in LayerManager, or user can see it in the LayerManager but can do nothing to it, that means user can not hide, delete ... Actually, I need a feature like the MS word revision history. I want to put the revision information in a protected layer, so only program can chose to show or hide it. Any ideas? thank you.
8 REPLIES 8
Message 2 of 9
khoa.ho
in reply to: sdphg

One idea is to create a layer (for Revision purpose), and put all needed entities in this layer. Then use the loop for each entity in the current space, set Entity.Visible = false if this entity (text, line, circle...) is in the "Revision" layer. By that way, users still see this layer on the Layer Manager, but don't see anything in this layer as they are invisible. This layer is also not be able to delete as it is not empty.

 

Your program will turn on or off entity visibility in the certain layer, using Entity.Visible not layer visible.

 

Message 3 of 9
FRFR1426
in reply to: khoa.ho

myLayer.IsHidden = true;

 

Maxence DELANNOY
Manager
Add-ins development for Autodesk software products
http://wiip.fr
Message 4 of 9
khoa.ho
in reply to: FRFR1426

Thanks for your good note. This is a right article about it: http://adndevblog.typepad.com/autocad/2012/05/creating-a-anonymous-layer.html

 

Message 5 of 9
jeff
in reply to: FRFR1426

 

To add to FRFR1426 comment when you change value of IsHidden the only thing I could find to get the layermanager to refresh itself was to open the the LayerTable for write.

 

So any method that changes a IsHidden property I always have had to open the LayerTable for write so it would reflect in LayerManager    

You can also find your answers @ TheSwamp
Message 6 of 9
khoa.ho
in reply to: sdphg

The new AutoCAD "Revision" feature (like Microsoft Word) can be implemented as:

 

layerTableRecord.IsHidden = true; // Hide this layer name from Layer Manager and toolbar

layerTableRecord.IsFrozen = true; // Completely hide all entities in this layer, even Ctrl-A will not select them

layerTableRecord.IsPlottable = false; // Prevent plotting this layer

 

If you still want to keep an entity with its original layer (especially a block with nested entities in multiple layers) to restore back, use Entity.Visible = false to hide it from the screen. You may think to use Entity.XData to mark the entity is 'Revision" entity to restore back later.

 

However, if an entity with Entity.Visible = false, it still can be selected by Ctrl-A (select all). You can make them more protected by store it into a Frozen layer, not Off layer.

 

Message 7 of 9
sdphg
in reply to: khoa.ho

Thank you khoa.ho, your solution sounds good, I will give it a shot, and thank you all guys.
Message 8 of 9
khoa.ho
in reply to: sdphg

Once you are done with your test, please mark it as accepted solution to help later readers. I will also give me a try on that. Thanks.

 

Message 9 of 9
sdphg
in reply to: khoa.ho

No problem, your solution sounds very reasonable, I will post the my test in details.

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost