Please help me,
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
Solved by hmsilva. Go to Solution.
So apparently the person who set all these title blocks up in model space & paper space with different scales really need to be trained to do it properly and consistantly. Since there is no consistancy, there is no lisp routine that can do this automated for you. You would have to open each drawing and set it all up properly so you can use the Publish command the next go around.
Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales | Exchange App Store
@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
Hi hmsilva,
Thanks for your replay.
I copy this code and paste in to a notepad then save as .lsp file. after i load and type demo but its not working. Actually i dont have deep knowledge in lisp. Can u tell me is there any way to load this.
@Anonymous wrote:
Here is the drawing.
arukaroor,
are all dwg's in A3, and all in Model space?
(vl-load-com) (defun c:demo (/ dwg file hnd i len llpt lst mn mx 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))) ) (command "-plot" "yes" (car x) "DWG TO PDF.PC3" "ISO A3 (420.00 x 297.00 MM)" "Millimeters" "Landscape" "No" "Window" llpt urpt "Fit" "Center" "yes" "grayscale.ctb" "yes" "" ) (if (/= (car x) "Model") (command "No" "No" file "no" "Yes") (command file "no" "Yes" ) ) ) ) ) (princ) )
Henrique
hmsilva,
Some times i have to print in A1 and some times in A2 or A3. So i am suggesting to make pdf all in A1 size so i can print any size. In this drawing all title blocks are in model but some other drawings in layout.
@Anonymous wrote:
Woowww its working..
Thank you very much.
Can you add an option to select model / layout and page size also.
arukaroor,
the demo will plot also layouts, if the "A1-" block exist.
Paper sizes, correct scale.... I could not find in your titleblock something that allows the code to select the correct paper size/scale...
Henrique
hmsilva,
I modified the paper size and ctb. Now i can plot any size and any block. You saved my time
Thanks a lot........
@Anonymous wrote:
hmsilva,
I modified the paper size and ctb. Now i can plot any size and any block. You saved my time
Thanks a lot........
You're welcome, arukaroor
Glad it's useful for you! 🙂
Henrique
Dear Henrique,
Thank for the code.
Can you please help by changing the same code to give print to a printer instead of pdf.
Regards,
Fred
Thanks a lot for this piece of code !
My company still plots the production drawings in modelspace but with this tool i'm winning a lot of time. (considering 50+ drawings per project)
I was just wondering if there is a way to ajust this too only print blocks that are selected ?
So if I for instance have layoutblocks for an A4 print and for an A3 print, I can do those seperatly?
I'm not familiar with the syntax of Lisp otherwise I would have just edited your code.
Greets,
Wauter
it working. thank a lot. but it plotting reverse order. how can i change plot order
@hmsilva wrote:
@Anonymous wrote:Here is the drawing.
arukaroor,
are all dwg's in A3, and all in Model space?
(vl-load-com) (defun c:demo (/ dwg file hnd i len llpt lst mn mx 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))) ) (command "-plot" "yes" (car x) "DWG TO PDF.PC3" "ISO A3 (420.00 x 297.00 MM)" "Millimeters" "Landscape" "No" "Window" llpt urpt "Fit" "Center" "yes" "grayscale.ctb" "yes" "" ) (if (/= (car x) "Model") (command "No" "No" file "no" "Yes") (command file "no" "Yes" ) ) ) ) ) (princ) )
Henrique
?
Attach an example of your title block file.
i got this error after using obove lisp
on the dwg uploded above
Command: DEMO
Unknown command "DEMO". Press F1 for help.
Command: C:\Users\ali.usman\Downloads\NDW9578-17.pdf Unknown command "USMAN\DOWNLOADS\NDW9578-17.PDF". Press F1 for help.
Command: no Unknown command "NO". Press F1 for help.
Command: Yes Unknown command "YES". Press F1 for help.
Try this : Revers - Automatic batch printing
Can't find what you're looking for? Ask the community or share your knowledge.