Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

wblock in and out of lisp

26 REPLIES 26
SOLVED
Reply
Message 1 of 27
srestmeyer
1371 Views, 26 Replies

wblock in and out of lisp

Hi all,

 

I am running -wblock in a drawing to clean it up and reduce the file size. By doing this it brings the file size down from over 9 meg to just over 1 meg by removing unused blocks that are not able to be purged out of the drawing using the purge all command.

 

My problem is, when I run the -wblock manually at the command prompt it works fine. But, when I run it inside a simple lisp routine

 

^C^C^P(command "-wblock" (strcat (getvar "dwgprefix") "CLEAN_" (getvar "dwgname"))"*") ^P^C^C

 

It appears to work fine without errors. It creates the new file with the correct file name. But it only reduces the same file size to just over 8 meg

 

Any ideas?

 

Thank in advance

Scott

26 REPLIES 26
Message 2 of 27
Jason.Piercey
in reply to: srestmeyer

Are you selecting objects when running the command manually?

Message 3 of 27
srestmeyer
in reply to: Jason.Piercey

No. I used the asterisk (*) just like the lisp

 

Thanks,

Scott

Message 4 of 27
Jason.Piercey
in reply to: srestmeyer

Can you provide a link to download the file?  I assume the 9mb is too large to post here.

Message 5 of 27
srestmeyer
in reply to: Jason.Piercey

There is no file. It's just the single line of code that isn't working. Actually, it is working (no errors) but the resulting file is not cleaned like it is when I run the -wblock command manually with the "*" input.

 

Scott

Message 6 of 27
Jason.Piercey
in reply to: srestmeyer

I understand that.  I'm asking for the dwg file, so I see if I get the same results.

Message 7 of 27
srestmeyer
in reply to: Jason.Piercey

I didn't think you would want the file since we don't know what is causing the drawings to get so bloated. It appears to be from an architectural drawing we received from a customer. and it has spread to an unknown number of drawings. We've isolated the source and now want to clean up the mess.

I have attached a zipped file for you to test.

 

Thanks,

Scott

Message 8 of 27
Jason.Piercey
in reply to: srestmeyer

I don't get the same results as you.  The file is reduced significantly regardless of which method I use.  If I -wblock manually the resulting file is 567kb.  If I cut/paste your code to the command line the resulting file is 569kb.

 

Seems that anonymous blocks are causing the bloat.  If I delete the "ACAD_DGNLINESTYLECOMP" dictionary I can then purge 7560 anonymous blocks.  After saving the file, it is now 565kb.

Message 9 of 27
srestmeyer
in reply to: Jason.Piercey

I wonder why it doesn't work for me. Maybe deleting the dictionary and purging is the better way. Where do I find the dictionary to delete it?

 

Thanks,

Scott

Message 10 of 27
Jason.Piercey
in reply to: srestmeyer

I have this as one of my toolbox functions.

 

; [dictName] - string, dictionary name
(defun deldict (dictName)
 (dictremove (namedobjdict) dictName)
 )

 

You can use it like this:

 

(deldict "ACAD_DGNLINESTYLECOMP")

Message 11 of 27
srestmeyer
in reply to: Jason.Piercey

That worked perfectly! I think I'll use that instead of the -wblock

 

Thanks very much for helping me with that

 

Scott

Message 12 of 27
Jason.Piercey
in reply to: srestmeyer

You're welcome.

Message 13 of 27
srestmeyer
in reply to: Jason.Piercey

I have one more question. This process doesn't seem to be consistent. Sometimes it will greatly reduce the file size, and other times it will reduce it not as much. do you know why this happens? Is there another process that might work better?

 

Any info is appreciated

 

THanks,

Scott

Message 14 of 27
Jason.Piercey
in reply to: srestmeyer

You deleted the dictionary and also purged?  Can you provide an additional sample file where the size is not reduced?  It's quite possible a different issue is keeping the file bloated.

Message 15 of 27
srestmeyer
in reply to: Jason.Piercey

Hi Jason,

Yes I did both, a couple of times. Attached is a sample file you requested. Perhaps you can figure out why?

 

 

Thanks,

Scott

Message 16 of 27
Jason.Piercey
in reply to: srestmeyer

That ZIP file is empty.

Message 17 of 27
srestmeyer
in reply to: Jason.Piercey

I don't know why. It had a drawing in it when I uploaded it.

Try this one

 

Message 18 of 27
srestmeyer
in reply to: Jason.Piercey

I don't know why. It had a drawing in it when I uploaded it.

Try this one

 

Message 19 of 27
srestmeyer
in reply to: srestmeyer

Excuse all the postings. I didn't realize my computer was lagging so I hit the post button a couple of times

Message 20 of 27
Jason.Piercey
in reply to: srestmeyer

What are you seeing as a file size after deleting the dictionary and purging?  I'm getting about 1.9mb.

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

Post to forums  

Autodesk Design & Make Report

”Boost