@Anonymous wrote:
Please help me,
I want to know is there any lisp for printing multiple blocks to pdf at once?
I have hundreds of drawing and each drawing have many title blocks in model/Layout in different size (all title blocks are in blocks named A1). So if i use publish command, i have to open all 100 drawings and make page setup for all title blocks. It is waste of time. So i am looking for a program which print a specific blocks one by one (instead of selecting a window/layout/extends) in model or layout converting to pdf at once. Hope you understand the matter. Help would be appreciated (I am really sorry for my poor English).
Hello arukaroor and welcome to the Autodesk Community!
Firstly, I fully agree with Paul Li's.
To plot one dwg at a time, and ss a starting point, if your title blocks are not dynamic, perhaps something like this will do the trick...
Untested...
(vl-load-com)
(defun c:demo (/ dwg file hnd i len llpt lst mn mx sc ss tab urpt)
(if (setq ss (ssget "_X" '((0 . "INSERT") (2 . "A1"))))
(progn
(repeat (setq i (sslength ss))
(setq hnd (ssname ss (setq i (1- i)))
tab (cdr (assoc 410 (entget hnd)))
lst (cons (cons tab hnd) lst)
)
)
(setq lst (vl-sort lst '(lambda (x y) (> (car x) (car y)))))
(setq i 0)
(foreach x lst
(setq file (strcat (getvar 'DWGPREFIX)
(substr (setq dwg (getvar 'DWGNAME)) 1 (- (strlen dwg) 4))
"-"
(itoa (setq i (1+ i)))
".pdf"
)
)
(if (findfile file)
(vl-file-delete file)
)
(vla-getboundingbox (vlax-ename->vla-object (cdr x)) 'mn 'mx)
(setq llpt (vlax-safearray->list mn)
urpt (vlax-safearray->list mx)
len (distance llpt (list (car urpt) (cadr llpt)))
sc (fix (/ 841.0 len))
)
(command "-plot"
"yes"
(car x)
"DWG TO PDF.PC3"
"ISO A1 (841.00 x 594.00 MM)"
"Millimeters"
"Landscape"
"No"
"Window"
llpt
urpt
(strcat (itoa sc) ":1")
"Center"
"yes"
"grayscale.ctb"
"yes"
""
)
(if (/= (car x) "Model")
(command "No" "No" file "no" "Yes")
(command
file
"no"
"Yes"
)
)
)
)
)
(princ)
)
Hope this helps,
Henrique