Message 1 of 16
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I use a script to print all blocks with name "!MineMyA1-".
I got a file "Orginal2Print" from a post and modified it.
Then I pasted the frame named "!MineMyA1-" to my drawing "Destination2Print".
I use a script "Demo2pdf" via AP command then calling demo command to print all "!MineMyA1-" blocks:
It works perfectly in Orginal2Print file, but for my file "Destination2Print" it give three blank sheets
Please, how to make the lisp work in my file "Destination2Print".
Files and lisp are in the attachments
This is the used code:
(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 . "!MineMyA1-"))))
(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" ;Detailed Plot Configuration?
(car x) ;layout
"DWG TO PDF.PC3" ;Printer Name
"ISO full bleed A3 (420.00 x 297.00 MM)" ;Paper Size
"Millimeters" ;Paper Units
"Landscape" ;Orientation
"No" ;Plot Upside Down?
"Window" ;Plot Area
llpt ;x coordinate
urpt ;y coordinate
"Fit" ;Plot Scale
"Center" ;Plot Offset
"yes" ;Plot With Plotstyle?
"monochrome.ctb" ;Plot Style Name
"yes"
"" )
(if (/= (car x) "Model")
(command "No" "No" file "no" "Yes")
(command
file
"no"
"Yes"
)
)
)
)
)
(princ)
)
The post is relted to this post:
batch-plot-to-pdf-in-model-space
Solved! Go to Solution.