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

Need preview of old blocks

12 REPLIES 12
Reply
Message 1 of 13
thomas_climawest
519 Views, 12 Replies

Need preview of old blocks

Hi everyone,

at my new workplace I'm supposed to use a vast company-specific block library.

For some reason the block were saved (back in 1999) without name, only numbers.

So I have to literally go through all the blocks to find oout what is what.

 

I don't know much about LISP but enough to know that there is a way to have autocad do this;

  • open
  • purge (while we're at  it 🙂 )
  • zoom extents
  • save (at another location if the lisp requires it, I don't know)
  • open next drawing in directory

This way i get a preview.

 

 

Much obliged

 

Manu

12 REPLIES 12
Message 2 of 13
mid-awe
in reply to: thomas_climawest

I'm working it out but what is the file name structure? (ex. 001, 01, 1, etc.)
Message 3 of 13

Try a Search.  I put "Drawing Preview" in the Search window and got a lot of hits, some of which look like pretty much the same question [though I didn't dig into all of them].

Kent Cooper, AIA
Message 4 of 13

The filename is constituted out of 4 numbers.

Very curious how you're going to do it...
Message 5 of 13
mid-awe
in reply to: thomas_climawest

Are the numbers consecutive (ex. 0001, 0002, 0003)
Message 6 of 13
alanjt_
in reply to: mid-awe

ScriptPro should do what you want.

Message 7 of 13

No not consecutive, I'm afraid.
I can make that happen with a rename...
Message 8 of 13
dgorsman
in reply to: thomas_climawest

Have you considered using the DWG Convert function in TrueView?

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 9 of 13
alanjt_
in reply to: thomas_climawest
Message 10 of 13
mid-awe
in reply to: thomas_climawest

Ok, I see that you've already recieved an example, but since I told you that I was doing it, here goes another approach.

(DEFUN C:POB (/ DIR DIRF)
  (SETQ	DIR  "C:/DWG/FILES/DIRECTORY/"
	DIRF (VL-DIRECTORY-FILES DIR "*.DWG" 1)
  )
  (FOREACH IDX DIRF
    (IF	(VLA-ACTIVATE (VLA-OPEN (VLA-GET-DOCUMENTS (VLAX-GET-ACAD-OBJECT)) (STRCAT DIR IDX) :VLAX-FALSE))
      (AND (VL-CMDF "-PURGE" "A" "*" "N")
	   (VL-CMDF "ZOOM" "E" PAUSE)
      )
    )
  )
)

 I understand why you got all the suggestions for scripts, but my version will simply pause for you to save or close the current active drawing.

 

Smiley Happy

Message 11 of 13

Hi,

 

Just copy your drawings to C:\THUMB

load this lisp and type UTB for running!

 

;; drawing purger for thumbnail update purpose
;; By Abbas Aqdam
(defun C:UTB ( / path files dwg sf )
(if (or (= (getvar "SDI") 0) (> (getvar "DBMOD") 0))
   (alert "Please: \n\n1-SAVE and close all open drawing!\n\n2-Set SDI to 0")
   (progn
      (setq path "C:\\THUMB\\")
      (setq files (vl-directory-files path "*.dwg" 1))
      (if (> (length files) 0)
         (progn
            (setq sf (open (strcat path "T.SCR") "w"))
            (write-line "Filedia" sf)
            (write-line "0" sf)
            (foreach dwg files
               (write-line "open" sf)
               (write-line (strcat "\"" path dwg "\"") sf)
               (write-line "(command \"purge\" \"a\" \"*\" \"N\")" sf)
               (write-line "(command \"zoom\" \"e\" \"zoom\" \"s\" \"0.95x\")" sf)
               (write-line "qsave" sf)
            );foreach
            (write-line "Filedia" sf)
            (write-line "1" sf)
            (close sf)
            (command "script" (strcat path "t.scr"))
         );progn
         (Alert (strcat "There is no dwg files in " path "!"))
      );if
   );progn
);if
);defun

 

 Thanks,

Abbas

Message 12 of 13
pbejse
in reply to: dgorsman


@dgorsman wrote:

Have you considered using the DWG Convert function in TrueView?


1+ 

Message 13 of 13
thomas_climawest
in reply to: pbejse

Wow, there are several paths to follow here.

I'm going to try all 'till I find what works best.

 

Thanks a bunch guys, you're the best!

 

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

Post to forums  

Autodesk Design & Make Report

”Boost