toberino Posted May 25, 2012 Share Posted May 25, 2012 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 Quote Link to comment Share on other sites More sharing options...
ReMark Posted May 25, 2012 Share Posted May 25, 2012 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. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 25, 2012 Share Posted May 25, 2012 The simple answer is to place 'something' on those layers to prevent them from being included in a standard purge. 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). Quote Link to comment Share on other sites More sharing options...
ReMark Posted May 25, 2012 Share Posted May 25, 2012 Devious...but very effective. Remind me not to get on your bad side Renderman. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 25, 2012 Share Posted May 25, 2012 Devious...but very effective. Remind me not to get on your bad side Renderman. 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. ... Here's a freebie. Quote Link to comment Share on other sites More sharing options...
ReMark Posted May 25, 2012 Share Posted May 25, 2012 If we worked together there would be chaos and mayhem. And that's just the good stuff. Quote Link to comment Share on other sites More sharing options...
Patrick Hughes Posted May 25, 2012 Share Posted May 25, 2012 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. Quote Link to comment Share on other sites More sharing options...
nestly Posted May 26, 2012 Share Posted May 26, 2012 The simple answer is to place 'something' on those layers to prevent them from being included in a standard purge. .... 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. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 26, 2012 Share Posted May 26, 2012 .... 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: Quote Link to comment Share on other sites More sharing options...
Dadgad Posted May 26, 2012 Share Posted May 26, 2012 .... 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? Mightn't creating a saved view with LAYERSNAPSHOT be another way to go? Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 26, 2012 Share Posted May 26, 2012 Has anyone used layer snapshots since +/-2006? 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. Quote Link to comment Share on other sites More sharing options...
Dadgad Posted May 26, 2012 Share Posted May 26, 2012 Has anyone used layer snapshots since +/-2006? 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. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 26, 2012 Share Posted May 26, 2012 (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. Quote Link to comment Share on other sites More sharing options...
Dadgad Posted May 26, 2012 Share Posted May 26, 2012 (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. 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. Quote Link to comment Share on other sites More sharing options...
CyberAngel Posted May 29, 2012 Share Posted May 29, 2012 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. Quote Link to comment Share on other sites More sharing options...
Jeff H Posted May 30, 2012 Share Posted May 30, 2012 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. hideLayers.dwg Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 30, 2012 Share Posted May 30, 2012 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. 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). Quote Link to comment Share on other sites More sharing options...
Dadgad Posted May 30, 2012 Share Posted May 30, 2012 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. 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. Quote Link to comment Share on other sites More sharing options...
CyberAngel Posted May 30, 2012 Share Posted May 30, 2012 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. Quote Link to comment Share on other sites More sharing options...
Jeff H Posted May 30, 2012 Share Posted May 30, 2012 :: 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.