Message 1 of 11
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I am new at LISP but I found one that lets to print drawings straight from model area to pdf. I modified it a little bit and now it works perfectly, but I would like to change one thing. Right now when I am printing it creates name for PDF from DWG name and also put numbers at back. Is there any way it can create name from block attributes values. My current block "A1" its just that square with 3 attributes. How can i change that LISP can create PDF with name like A-B-C.pdf or something like that. Thanks in advance.
(vl-load-com)
(defun c:SpA1 (/ 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"
"A1"
"Millimeters"
"Landscape"
"No"
"Window"
llpt
urpt
"Fit"
"Center"
"yes"
"PSP.ctb"
"yes"
""
)
(if (/= (car x) "Model")
(command "No" "No" file "no" "Yes")
(command
file
"no"
"Yes"
)
)
)
)
)
(princ)
)
Solved! Go to Solution.