TheSwamp

CAD Forums => CAD General => Topic started by: craigr on May 06, 2009, 09:48:48 AM

Title: I screwed up!!! (Delete Layer)
Post by: craigr on May 06, 2009, 09:48:48 AM
When I am totally finished with a dwg, I have a large checkmark block called .DONE.dwg that I put on the dwg. It is on the Defpoints Layer so it won't print. When I am totally finished with all 100 dwgs for that Job, I run a batch utility that uses the command 'delete layer' which I delete the layer Defpoints which gets rid of my DONE block. - So I thought.

Now I find out that the block is erased but remains in the dwg and cannot be purged!!

How do I get rid of this block definition?

craigr
Title: Re: I screwed up!!! (Delete Layer)
Post by: M-dub on May 06, 2009, 09:50:39 AM
I'm a little confused...
When you do a LIST on it, what is it called?
Title: Re: I screwed up!!! (Delete Layer)
Post by: Matt__W on May 06, 2009, 09:53:30 AM
QSELECT

Select the block(s) and press the DEL key.
Title: Re: I screwed up!!! (Delete Layer)
Post by: craigr on May 06, 2009, 09:53:42 AM
You can't do a list on it, because it doesn't appear in the the dwgs.

But, it IS there if you try the purge command and select 'View items that cannot be purged'.

If I try to bring the block back into the dwg again, it doesn't appear on the screen and doesn't even bring the defpoints layer into the dwg again. It's kinda like it just craps out and does nothing, but without any error message.
Title: Re: I screwed up!!! (Delete Layer)
Post by: Matt__W on May 06, 2009, 09:54:59 AM
Sounds like it's an empty block.

Use QSELECT and delete them all in one shot (of course, you'll have to do this to all drawings).





But if it doesn't have anything in it, and you're done with the drawings, does it really matter? :?
Title: Re: I screwed up!!! (Delete Layer)
Post by: M-dub on May 06, 2009, 09:56:48 AM
But if it doesn't have anything in it, and you're done with the drawings, does it really matter? :?

Probably not, but it bugs him.  It would bug me too... enough to look into it for a while at least.
Title: Re: I screwed up!!! (Delete Layer)
Post by: Bob Wahr on May 06, 2009, 09:58:59 AM
Sounds like it's an empty block.

Use QSELECT and delete them all in one shot (of course, you'll have to do this to all drawings).
+1

If you want to see them first, try typing -INSERT DONE= Y cancel
Title: Re: I screwed up!!! (Delete Layer)
Post by: craigr on May 06, 2009, 10:00:16 AM
Well, it's more than it just Bugs me - (though it does).

We often re-use dwgs if they work for other jobs. So, if the dwg is reused, I cannot bring the 'done' block in again.

Attached are the 2 dwgs. Try to bring the 'done' into the 'titleblock' and you will see what I mean.

craigr
Title: Re: I screwed up!!! (Delete Layer)
Post by: Matt__W on May 06, 2009, 10:08:31 AM
Well, it's more than it just Bugs me - (though it does).
When this has happened to me in the past, I've redefined the block by drawing a big arse square as the only entity.  Then when you click YES to the "Do you want to redefine this block" message you can quickly see where your blocks are because now you've got a bunch of squares all over the place.


We often re-use dwgs if they work for other jobs.
Tsk tsk tsk...    *walks away shaking head*
Title: Re: I screwed up!!! (Delete Layer)
Post by: Bob Garner on May 06, 2009, 10:19:38 AM
I've found the Defpoints layer does strange things I don't understand.  So I, and everybody in the office, leave this layer alone and substitute a layer named "no plot" for this function.  And life goes happily along for everyone.

Bob G.
Title: Re: I screwed up!!! (Delete Layer)
Post by: Rob... on May 06, 2009, 10:21:55 AM
The done block is indeed an empty block on layer "0" in the title block drawing. When you delete the defpoints layer it just redefines the block without the object (anonymous block "A$C7D7A5000") that is on defpoints which creates an empty block. When you insert the block do you put it on defpoints?
Title: Re: I screwed up!!! (Delete Layer)
Post by: Matt__W on May 06, 2009, 10:23:23 AM
Creating Your Own Non-plotting Layers Instead of Using Defpoints
http://usa.autodesk.com/adsk/servlet/ps/dl/item?siteID=123112&id=3268084&linkID=9240615

 :wink:
Title: Re: I screwed up!!! (Delete Layer)
Post by: craigr on May 06, 2009, 10:49:47 AM
I've found the Defpoints layer does strange things I don't understand.  So I, and everybody in the office, leave this layer alone and substitute a layer named "no plot" for this function.  And life goes happily along for everyone.

Bob G.

Yes.... I have read in the Swamp before to stay away from the Defpoints layer, but like a dummy, I figured this was simple enough that it wouldn't hurt to use it in this case. - So I been bit!!

I did the QSelect thing mentioned above and was able to get rid of the block, but how do I do it with with a macro, because - QSelect apparently isn't an option in LT? I would REALLY like to run my Batch prg and run thru the MANY dwgs that I have done this to in the last couple of months. Doing dwg by dwg is not an option.

craigr
Title: Re: I screwed up!!! (Delete Layer)
Post by: Rob... on May 06, 2009, 10:51:34 AM
Try inserting the block on the defpoints layer instead of "0".
Title: Re: I screwed up!!! (Delete Layer)
Post by: Matt__W on May 06, 2009, 10:51:43 AM
I did the QSelect thing....QSelect apparently isn't an option in LT?
So then... how did you...?  Wha...??!?
Title: Re: I screwed up!!! (Delete Layer)
Post by: craigr on May 06, 2009, 10:52:29 AM
Oops, I meant to say that -QSelect is not an option.

Title: Re: I screwed up!!! (Delete Layer)
Post by: Matt__W on May 06, 2009, 10:52:39 AM
Try inserting the block on the defpoints layer instead of "0".
Auuuuuggghhh!!!! DON'T USE DEFPOINTS!!!

Creating Your Own Non-plotting Layers Instead of Using Defpoints
http://usa.autodesk.com/adsk/servlet/ps/dl/item?siteID=123112&id=3268084&linkID=9240615
 :wink:
Title: Re: I screwed up!!! (Delete Layer)
Post by: Matt__W on May 06, 2009, 10:53:28 AM
Oops, I meant to say that -QSelect is not an option.
Oh, okay.

Yeah, there's no command line version of QSELECT.
Title: Re: I screwed up!!! (Delete Layer)
Post by: craigr on May 06, 2009, 10:54:15 AM
Any other idea of how to select this from the command line?
Title: Re: I screwed up!!! (Delete Layer)
Post by: Rob... on May 06, 2009, 10:54:23 AM
Oops, sorry. I didn't read the whole reply.
Title: Re: I screwed up!!! (Delete Layer)
Post by: craigr on May 06, 2009, 10:58:12 AM
I will NEVER, NEVER, NEVER use Defpoints again - I will slap the hands of anyone in this company that does!!


I appears that the Defpoints layer IS the problem. I changed the block from Defpoints to 'NoPlot' and reproduced the process and it works fine - no remnants of the 'Done' block left in the dwg when 'Laydelete' is used.

But, there HAS to be some way of getting rid of the OLD one from all of those dwgs without doing dwg by dwg.

craigr
Title: Re: I screwed up!!! (Delete Layer)
Post by: Bob Wahr on May 06, 2009, 11:05:43 AM
unfortunately for you, LT does not lend itself well to automation.
Title: Re: I screwed up!!! (Delete Layer)
Post by: M-dub on May 06, 2009, 11:07:36 AM
Instead of fixing all that's been done at the end of this job, why don't you fix the drawings that need fixing at the beginning of the next job?
Title: Re: I screwed up!!! (Delete Layer)
Post by: Jeff_M on May 06, 2009, 11:10:40 AM
Craig, do have access to a full version of Acad? If so, it would be quite simple to fix those other dwgs. If not, I'd be happy to do it for you if you could post them to an FTP site (or the Lillypad if OK with Mark....how much space do these dwgs take up?).
Title: Re: I screwed up!!! (Delete Layer)
Post by: craigr on May 06, 2009, 11:13:18 AM
I appreciate the offer, but alot of our dwgs are Security dwgs that are private and cannot be shared with anyone but the owner.

Thanks anyway.

craigr
Title: Re: I screwed up!!! (Delete Layer)
Post by: MP on May 06, 2009, 11:15:39 AM
What if we did it with our eyes closed?
Title: Re: I screwed up!!! (Delete Layer)
Post by: Matt__W on May 06, 2009, 11:33:08 AM
Can you write a script to delete blocks called DONE and run it on multiple drawings?
Title: Re: I screwed up!!! (Delete Layer)
Post by: Jeff_M on May 06, 2009, 11:36:05 AM
What if we did it with our eyes closed?
That's pretty much what I'd be doing, since I'd use ObjectDBX to do the work....the drawings would never even be opened for viewing. :-) But, I do understand why they can't be let out of the office.
Title: Re: I screwed up!!! (Delete Layer)
Post by: MP on May 06, 2009, 11:39:11 AM
exactly + exactly :)
Title: Re: I screwed up!!! (Delete Layer)
Post by: craigr on May 07, 2009, 11:33:05 AM
The Current job, I spent the time to go thru all 100ish pages 'cleaning' them of this block. - I just HATE when things aren't 'right'.

I still haven't come up with a way to do this thru a macro, but haven't give up yet.


There just HAS to be another way around the barn with LT.

craigr
Title: Re: I screwed up!!! (Delete Layer)
Post by: Bob Wahr on May 07, 2009, 11:47:57 AM
There just HAS to be another way around the barn with LT.
There is another way around the barn, but it too involves manually taking each step.  LT doesn't do this.
Title: Re: I screwed up!!! (Delete Layer)
Post by: craigr on May 07, 2009, 11:50:04 AM
Sometimes LT Sucks - but then again, 'you get what you pay for'

AND, I am the one that screwed up, not LT  :-(

craigr
Title: Re: I screwed up!!! (Delete Layer)
Post by: Krushert on May 07, 2009, 11:51:56 AM
Try inserting the block on the defpoints layer instead of "0".
Auuuuuggghhh!!!! DON'T USE DEFPOINTS!!!

Creating Your Own Non-plotting Layers Instead of Using Defpoints
http://usa.autodesk.com/adsk/servlet/ps/dl/item?siteID=123112&id=3268084&linkID=9240615
 :wink:
Thanks for the link.  Now I can say to my users "... becuase I and Autodesk say so you @#$%^&*!
Title: Re: I screwed up!!! (Delete Layer)
Post by: Bob Wahr on May 07, 2009, 11:55:20 AM
Sometimes LT Sucks - but then again, 'you get what you pay for'

AND, I am the one that screwed up, not LT  :-(

craigr
I'm neither knocking LT, nor you.  I'm just saying that LT doesn't have the functionality that you require to automate this.
Title: Re: I screwed up!!! (Delete Layer)
Post by: craigr on May 07, 2009, 11:56:46 AM
I know, I know, - I'm just venting.

I appreciate yours as well as the others comments / suggestions.

craigr
Title: Re: I screwed up!!! (Delete Layer)
Post by: M-dub on May 07, 2009, 12:00:52 PM
It's very likely that you can't automate it, but sometimes, you've just got to find a different way to do things.  Maybe instead of going around the barn, go over it.  :)

I really wish I had the time to make an attempt at it.
Title: Re: I screwed up!!! (Delete Layer)
Post by: craigr on May 07, 2009, 12:03:45 PM
Now, it has become more of a challege than anything else.

I gotten enough 'You can't automate it' comments that I want to "go over the barn".

Trouble is, that I also don't have the time to devote to it. - Maybe down the road some.

craigr
Title: Re: I screwed up!!! (Delete Layer)
Post by: Jeff_M on May 07, 2009, 01:11:49 PM
craig, a couple things, some of which has already been covered I think but figure if I put everything in one place it would help.

1. The reason the block can't be purged is because it has been inserted on layer 0, twice. When you use the LAYDEL command to rid the drawing of defpoints layer it just makes it so you can't see those inserts since there is no longer any object on that layer. So the work process is doing exactly what you tell it, but it's not what you intended.

2. As others suggested, using
-insert
done=
y
will redefine the block to match that of the original done.dwg, providing the done.dwg is in the support path. This WILL bring back the defpoints layer and the block will again be visible. (I just tested this in acad2009, I don't think LT does this any differently.) If the DONE.DWG is NOT in the default support search path, providing the actual path to it on the right of the equals sign will do the same thing.

3. Leaving the checkmark inside the block, afaik, on the defpoints layer isn't going to hurt anything. Although I would change it to my own noplot layer. What is failing you is that the INSERT is done on layer 0. You need the INSERT of the DONE block to be made to a layer of it's own that can be deleted and purged....such as a DONE layer. Then you can use the LAYDEL command on the DONE layer and be done :-) .

4. None of that is going to help any past projects, as I can't think of a way to select just the blocks named DONE in the drawing without using either QSELECT, FILTER, or a lisp program....none of which are available to you in an automated script. But it should help you going forward.

edit: fixed some typo's
Title: Re: I screwed up!!! (Delete Layer)
Post by: M-dub on May 07, 2009, 01:21:08 PM
Good job, Jeff.

It's got me thinking, anyway.
Title: Re: I screwed up!!! (Delete Layer)
Post by: M-dub on May 07, 2009, 01:26:51 PM
To add to it, DONE.dwg is (in my own terms) a block of a block.  Some others I guess, would call Done.dwg a container drawing.

I was thinking about starting with a redefined version of DONE.dwg but I'm not sure if the new version would also have to contain a block called A$C7D7A5000.
Title: Re: I screwed up!!! (Delete Layer)
Post by: Jeff_M on May 07, 2009, 01:31:44 PM
No, it wouldn't Mike. If a redefine of the DONE block is going to be done, just a pline for the checkmark on a noplot layer would be all that's required. I didn't dig that deep to notice that the checkmark was itself a block....that would be the first thing to change. I see now that others have noted this already.
Title: Re: I screwed up!!! (Delete Layer)
Post by: M-dub on May 07, 2009, 01:33:47 PM
I just noticed it for the first time, myself. :)
Title: Re: I screwed up!!! (Delete Layer)
Post by: M-dub on May 07, 2009, 01:43:21 PM
I was just wondering if (For the sole purpose of cleaning up old drawings) you could create a redefined version on a garbage layer that you don't care if you delete or not.
Redefine the block in each drawing by inserting the "fake" or "sacrificial" DONE block from a different location.
LAYDEL to delete the garbage layer and everything on it
You should then be able to purge the DONE block out of there.
Then, insert a NEW version of DONE that was created on a NOPLOT layer.

Does that sound doable?  Even if it's doable, does it fix the problem?
Title: Re: I screwed up!!! (Delete Layer)
Post by: M-dub on May 07, 2009, 01:46:02 PM
Oh yeah... and I think all of the above could be done in a script or a macro, too.
Title: Re: I screwed up!!! (Delete Layer)
Post by: Jeff_M on May 07, 2009, 01:46:36 PM
The problem still remains that the block has already been inserted on layer 0. Redefining the block won't change that.....and you cannot delete layer 0 to remove the offending inserts, and that's what makes the block unpurgable.
Title: Re: I screwed up!!! (Delete Layer)
Post by: M-dub on May 07, 2009, 01:56:47 PM
The problem still remains that the block has already been inserted on layer 0. Redefining the block won't change that.....and you cannot delete layer 0 to remove the offending inserts, and that's what makes the block unpurgable.

D'oh!

Forgot that 'minor' detail!

Not giving up yet.
Title: Re: I screwed up!!! (Delete Layer)
Post by: Bob Wahr on May 07, 2009, 02:01:08 PM
some tweaking to fit based on drawing setup might be needed, but something like this, while sloppy as hell and potentially damaging, might do it.

LINE -100000,-100000 @1000<45
-BLOCK DEMO 0,0 L
ERASE C -150000,-150000 -50000,-50000
-PURGE A Y
Title: Re: I screwed up!!! (Delete Layer)
Post by: craigr on May 07, 2009, 02:09:16 PM
WOW!!!

You folks are SOOOOO far above me, but I will try to make sense of it.

I followed most of it though.

Thanks again for devoting so much time to my problem.

This place and you folks are GREAT!!

craigr
Title: Re: I screwed up!!! (Delete Layer)
Post by: M-dub on May 07, 2009, 02:11:11 PM
some tweaking to fit based on drawing setup might be needed, but something like this, while sloppy as hell and potentially damaging, might do it.

LINE -100000,-100000 @1000<45
-BLOCK DEMO 0,0 L
ERASE C -150000,-150000 -50000,-50000
-PURGE A Y


That's a good point, Bob!  I've done that in the past where I had to delete a block that was in the exact same location on each drawing, but as you said, it is potentially damaging if it's not in the same location or if something else happens to share the same space.

Craig, are the blocks in the same location of each drawing?
Title: Re: I screwed up!!! (Delete Layer)
Post by: Bob Wahr on May 07, 2009, 02:13:06 PM
basically what I did was drew a line way off in space and redefined the block so that the way off in space line was it.  Then you can erase with a crossing way off in space that will snag them all but hopefully not anything that should stay in your drawing.  After that, you can purge away because the blocks are gone.
Title: Re: I screwed up!!! (Delete Layer)
Post by: craigr on May 07, 2009, 02:13:12 PM
No, unfortunately they are not.

But, that sounds like like a good idea.

I will have to make a macro that puts them in the same place on each future dwg.

craigr
Title: Re: I screwed up!!! (Delete Layer)
Post by: Bob Wahr on May 07, 2009, 02:14:33 PM
some tweaking to fit based on drawing setup might be needed, but something like this, while sloppy as hell and potentially damaging, might do it.

LINE -100000,-100000 @1000<45
-BLOCK DEMO 0,0 L
ERASE C -150000,-150000 -50000,-50000
-PURGE A Y


That's a good point, Bob!  I've done that in the past where I had to delete a block that was in the exact same location on each drawing, but as you said, it is potentially damaging if it's not in the same location or if something else happens to share the same space.

Craig, are the blocks in the same location of each drawing?
Dude, I gave him 10 billion square units to work with, how far off can they be?
Title: Re: I screwed up!!! (Delete Layer)
Post by: M-dub on May 07, 2009, 02:16:24 PM
The problem still remains that the block has already been inserted on layer 0. Redefining the block won't change that.....and you cannot delete layer 0 to remove the offending inserts, and that's what makes the block unpurgable.

D'oh!

Forgot that 'minor' detail!

Not giving up yet.

Thinking out loud...

Is there a way to move everything from layer 0 to a different layer from the command line?

never mind... I thought that would do something for us that it isn't going to do...
Title: Re: I screwed up!!! (Delete Layer)
Post by: M-dub on May 07, 2009, 02:18:55 PM
some tweaking to fit based on drawing setup might be needed, but something like this, while sloppy as hell and potentially damaging, might do it.

LINE -100000,-100000 @1000<45
-BLOCK DEMO 0,0 L
ERASE C -150000,-150000 -50000,-50000
-PURGE A Y


That's a good point, Bob!  I've done that in the past where I had to delete a block that was in the exact same location on each drawing, but as you said, it is potentially damaging if it's not in the same location or if something else happens to share the same space.

Craig, are the blocks in the same location of each drawing?
Dude, I gave him 10 billion square units to work with, how far off can they be?

You're right... I didn't notice that big line was being put inside the block.

That SHOULD do it.
Title: Re: I screwed up!!! (Delete Layer)
Post by: Jeff_M on May 07, 2009, 02:26:36 PM
Bob, that sounds like it just might work. Except, Erase "c" will not work (I don't think) when the objects &/or selected points aren't visible, so a Zoom Extents will be needed before & after the selection/erasure.
Title: Re: I screwed up!!! (Delete Layer)
Post by: Bob Wahr on May 07, 2009, 02:28:37 PM
good point.  Also, I'm sure craigr would figure it out on his own, but I just typed that into the browser, didn't check prompts in acad, so they might be off somewhat
Title: Re: I screwed up!!! (Delete Layer)
Post by: T.Willey on May 07, 2009, 05:37:43 PM
I'm creating a script writer in C# that will create a script file outside of Acad, so anyone can use it.  Then you just call the script from Acad, and wha'la.  It is almost done, will post when it is.
Title: Re: I screwed up!!! (Delete Layer)
Post by: T.Willey on May 07, 2009, 06:59:15 PM
Here it is.  The source code, exe, and a pic.

Code: [Select]
/*
 * Created by SharpDevelop.
 * User: Tim Willey
 * Date: 5/7/2009
 * Time: 9:30 AM
 *
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using System.Drawing;
using System.Windows.Forms;
using System.IO;

namespace WindosApps
{
/// <summary>
/// Description of ScriptWriter2.
/// </summary>
public partial class ScriptWriter2 : Form
{
public ScriptWriter2()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();

//
// TODO: Add constructor code after the InitializeComponent() call.
//
}

[STAThread]
public static void Main(string[] args)
{
Application.Run(new ScriptWriter2());
}

void CanBtnClick(object sender, EventArgs e)
{
this.Close();
}

void SelectDrawingsBtnClick( object sender, System.EventArgs e )
{
if ( FileBtn.Checked ) {
System.Windows.Forms.OpenFileDialog Dia = new System.Windows.Forms.OpenFileDialog();
Dia.DefaultExt = "dwg";
Dia.Filter = "AutoCAD Darwings (*.dwg)|*.dwg;*.dxf";
Dia.Multiselect = true;
Dia.Title = "Select drawings to plot.";
if (Dia.ShowDialog() == DialogResult.OK) {
string[] FileNames = Dia.FileNames;
Array.Sort( FileNames );
foreach ( string str in FileNames ) {
DwgBox.Items.Add( str );
}
}
}
else {
System.Windows.Forms.FolderBrowserDialog Dia = new System.Windows.Forms.FolderBrowserDialog();
Dia.ShowNewFolderButton = false;
Dia.Description = ( FldrBtn.Checked ? "Select folder of drawings." : "Select top folder of drawings." );
if ( Dia.ShowDialog() != DialogResult.OK ) return;
DirectoryInfo Di = new DirectoryInfo( Dia.SelectedPath );
FileInfo[] Files = Di.GetFiles( "*.dwg", ( FldrBtn.Checked ? SearchOption.TopDirectoryOnly : SearchOption.AllDirectories ) );
foreach ( FileInfo fi in Files ) {
DwgBox.Items.Add( fi.FullName );
}
}
}

void DrawingSelectionStyleButtonClick ( object sender, System.EventArgs e )
{
FileBtn.Checked = false;
FldrBtn.Checked = false;
FldrSubBtn.Checked = false;
RadioButton Rb = sender as RadioButton;
Rb.Checked = true;
}

void CloseOptionClick ( object sender, System.EventArgs e )
{
CloseBtn.Checked = false;
CnSaveBtn.Checked = false;
RadioButton Rb = sender as RadioButton;
Rb.Checked = true;

}

void SelectPathButtonClick ( object sender, System.EventArgs e )
{
System.Windows.Forms.FolderBrowserDialog Dia = new System.Windows.Forms.FolderBrowserDialog();
Dia.Description = "Select folder to place script file within.";
if ( Dia.ShowDialog() != DialogResult.OK ) return;
PathBox.Text = Dia.SelectedPath + "\\MyScript.scr";
}

void CreateScript ( object sender, System.EventArgs e )
{
using ( StreamWriter Sw = new StreamWriter(PathBox.Text) ) {
foreach ( string str in DwgBox.Items ) {
Sw.WriteLine( "_.Open" );
Sw.WriteLine( "\"" + str + "\"" );
foreach ( string cmd in CmdBox.Lines ) {
Sw.WriteLine( cmd );
}
Sw.WriteLine( CloseBtn.Checked ? "_.Close _yes" : "_.Qsave _.Close" );
}
Sw.WriteLine( "" );
}
this.Close();
}
}
}