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
Solved! Go to Solution.
Solved by Jason.Piercey. Go to Solution.
wow. I'm seeing what I sent you.
Was the dictionary deleted? How do you check? Is that a table search?
Scott
I just ran the commands manually and I got the same results as you
(dictremove (namedobjdict) "ACAD_DGNLINESTYLECOMP")
(command "purge" "a" "*" "n")
(command "._qsave")
But when I run it in a lisp program it doesn't work, even though I don't get errors.
The file you attached was bout 8.7mb before deleting the dictionary and purging. 1.9mb after. Is that not what you are seeing?
As for checking to see if the dictionary exists, one way to do it would be with the following.
(listdicts)
(defun listdicts () (cdrs 3 (entget (namedobjdict))) ) ; [key] - 1st element in a pair ; [lst] - list of pairs ; returns cdr of each item in [lst] ; whose car is equal to [key] (defun cdrs (key lst / rtn) (foreach x lst (if (= key (car x)) (setq rtn (cons (cdr x) rtn)) ) ) (reverse rtn) )
@srestmeyer wrote:I just ran the commands manually and I got the same results as you
(dictremove (namedobjdict) "ACAD_DGNLINESTYLECOMP")
(command "purge" "a" "*" "n")
(command "._qsave")
But when I run it in a lisp program it doesn't work, even though I don't get errors.
I am unable to replicate that behavior.
I found it. There was a variable that was nil so it wasn't running that part of the code.
Thanks again for all your help.
Scott