Jump to content

Keep layers from being deleted or purged


toberino

Recommended Posts

Good afternoon!

 

Is there a way to "lock" layers so that they cannot be deleted or purged from a drawing?

 

I have a template with all titleblocks, layers, dim styles, and such, all set up. But since there are a small group of layers that are not actually used in the drawing or template they are "purgable" or "deletable". As far as I understand locking the layer locks the geometry to keep it from being edited so it will not work for what I am thinking.

Does anyone know of a way to do this?

 

Thanks,

 

Nate

Link to comment
Share on other sites

  • Replies 32
  • Created
  • Last Reply

Top Posters In This Topic

  • BlackBox

    8

  • ReMark

    5

  • Jeff H

    5

  • Dadgad

    5

Top Posters In This Topic

Posted Images

I can't think of a way to lock the layers in any manner that would prevent them from being deleted/purged from a drawing unless one of the lisp gurus here can think of something.

Link to comment
Share on other sites

The simple answer is to place 'something' on those layers to prevent them from being included in a standard purge. :thumbsup:

 

The more (perhaps overly?) complex answer would be to code yourself an Object Reactor that recreates the layer(s) programmatically if a user does purge the layer(s). FIREdevil.gif

Link to comment
Share on other sites

Devious...but very effective. Remind me not to get on your bad side Renderman.:shock:

 

Necessity is the mother of invention, my friend, and not my very, very, very dark side. ;)

 

Besides, methinks you'd enjoy the 'tech' you'd be equipped with, were we to work together. :geek: ... Here's a freebie.

Link to comment
Share on other sites

But since there are a small group of layers that are not actually used in the drawing or template they are "purgable" or "deletable".

 

So, go ahead and purge or delete them. If you need them back at some point then insert the dwt and bam! there they are.

Link to comment
Share on other sites

The simple answer is to place 'something' on those layers to prevent them from being included in a standard purge. :thumbsup:

.... like putting a line or a point for each layer you want to "protect" in a block, then nesting that block in the title block.

Link to comment
Share on other sites

.... like putting a line or a point for each layer you want to "protect" in a block, then nesting that block in the title block.

 

One of the guys I do software development with (part-time, 2nd job), has a trick where he uses .NET to add anonymous blocks which cannot be exlploded. :wink:

Link to comment
Share on other sites

.... like putting a line or a point for each layer you want to "protect" in a block, then nesting that block in the title block.

 

I like that one nestly, not quite as nefarious as RendeMan's suggestion, the deviousness of which I find highly commendable. Or should I say inspired? :shock:

Mightn't creating a saved view with LAYERSNAPSHOT be another way to go?

Link to comment
Share on other sites

Has anyone used layer snapshots since +/-2006? :unsure: I use layer states regularly, but they only manage layers that already exist in the drawing, layers that are in the layer state but not the drawing are ignored.

 

FWIW - I've never actually employed the 'devious' suggestions; rather I learned of these ideas from completing AU courses, and working at my 2nd job.

 

** Edit - It's not about being devious, it's about the preservation of data ultimately. Admittedly, restoration of layers is a simple task as compared to storing parameter Objects to the Application.DocumentManager.MdiActiveDocument.UserData Hashtable. Just saying.

Link to comment
Share on other sites

Has anyone used layer snapshots since +/-2006? :unsure: I use layer states regularly, but they only manage layers that already exist in the drawing, layers that are in the layer state but not the drawing are ignored.

 

FWIW - I've never actually employed the 'devious' suggestions; rather I learned of these ideas from completing AU courses, and working at my 2nd job.

 

** Edit - It's not about being devious, it's about the preservation of data ultimately. Admittedly, restoration of layers is a simple task as compared to storing parameter Objects to the Application.DocumentManager.MdiActiveDocument.UserData Hashtable. Just saying.

 

Personally if I am setting up views I usually turn off the layer snapshot option, it just seemed to be a reasonably obscure way to try and preserve layers which could, as you say easily be reinstalled from the .dwt.

 

I forget, would the STANDARDS command with a .DWS file restore them if they had been removed?

 

I didn't take your post to mean that you had used that technique, nor that you were a virtual ne'er do well, I was just remarking on how creative it was.

 

I haven't actually tested my suggestion, but I suspect that if layers are saved in a NAMED VIEW LAYER SNAPSHOT, they will be exempted from the PURGE command, certainly could be wrong on that one.

Just thinking out loud. :) :beer:

Link to comment
Share on other sites

:offtopic:

 

(TellUser "No worries; I've not used the Standards command myself (at least not yet), but that is one of the items on my to-do list as we continue to implement Civil 3D here.")

TellUser sub-function, and other Sapi tools. :geek:

Link to comment
Share on other sites

:offtopic:

 

(TellUser "No worries; I've not used the Standards command myself (at least not yet), but that is one of the items on my to-do list as we continue to implement Civil 3D here.")

TellUser sub-function, and other Sapi tools. :geek:

 

Standards won't restore any layers, it will check and make them conform though.

I've only used it a few times when checking a bunch of drawings, but it is a good tool, and there are a few options to consider.

Link to comment
Share on other sites

Here's another devious idea. For each layer you want to preserve, make it current and create a block. You can't create an empty block, but you can edit it and delete the contents. What you're left with is a block reference that has an End Definition entity on that layer. It won't purge as long as there's an instance of the block, but the block won't affect anything because it's empty. Put these blocks in your template and purge away.

Link to comment
Share on other sites

Here's another devious idea. For each layer you want to preserve, make it current and create a block. You can't create an empty block, but you can edit it and delete the contents. What you're left with is a block reference that has an End Definition entity on that layer. It won't purge as long as there's an instance of the block, but the block won't affect anything because it's empty. Put these blocks in your template and purge away.

 

:: Without testing ::

 

If there's a non-anonymous block entity in the drawing's database, then they can be deleted. If the block entities can be deleted, then the block references can be purged, no?

 

Never tested this idea but no reactors etc... but for poops and giggles see if you can purge layer 1 and layer 2 from drawing.

 

Opening this drawing just repeatedly causes a fatal error (attached), Jeff.

 

ct_hidelayers.error.png

 

Not sure if it matters, but I'm using AutoCAD 2013 (ADN License), ObjectARX 2011-2013 installed, Visual Studio 2010 Express, and 11 Beta installed (.NET Frameworks 4.0, 4.5 Beta) in case you've nested a .NET object in the database. Windows 7 Ultimate x64 (MSDN License).

Link to comment
Share on other sites

Never tested this idea but no reactors etc... but for poops and giggles see if you can purge layer 1 and layer 2 from drawing.

 

That worked pretty well Jeff. :thumbsup:

Using 2012 I was able to open it without issue.

 

You would definitely have to really want to purge it, as it is pretty well camouflaged.

Highly unlikely that a casual abuser would inadvertently delete them.

I got it, but figured better not to post it, and spoil the fun for others. :beer:

Link to comment
Share on other sites

If there's a non-anonymous block entity in the drawing's database, then they can be deleted. If the block entities can be deleted, then the block references can be purged, no?

 

That's true. For my scheme to work, you'd have to keep an instance of each block in the drawing. It would take some work to delete them, however. They'd show up on a list of available blocks, but since they contain no objects, they wouldn't interfere with anything else, and you can't select them by accident (I checked). Another bonus is that you don't need to do any programming.

Link to comment
Share on other sites

:: Without testing ::

 

If there's a non-anonymous block entity in the drawing's database, then they can be deleted. If the block entities can be deleted, then the block references can be purged, no?

 

 

 

Opening this drawing just repeatedly causes a fatal error (attached), Jeff.

 

[ATTACH=CONFIG]35046[/ATTACH]

 

Not sure if it matters, but I'm using AutoCAD 2013 (ADN License), ObjectARX 2011-2013 installed, Visual Studio 2010 Express, and 11 Beta installed (.NET Frameworks 4.0, 4.5 Beta) in case you've nested a .NET object in the database. Windows 7 Ultimate x64 (MSDN License).

I not seeing how a block being anonymous keeps it from being deleted. You can hide 'named BlockReferences' just the same as anonymous blocks.

The only difference is a casual user could get to the entites inside the definition through the block editor but would still have hidden empty BlockReference.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...