Message 1 of 13
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've got a lisp that inserts PDFs into a specific spot. How do I make this automatically end after no more pages are in the PDF file? Max any file will have is 8 pages, but many will have less. Each page has a specific spot it needs to go if it exists. Right now this kinda works, just have to hit esc after it fails when it can't find a page number. But I'd like something a little more elegant. Any other suggestions on improvement also welcomed, I'm still learning.
(defun c:photosims (/ e1 e2 e3 e4 p1 p2 p3 p4 filepath pdfpath sims pagetotal pagenum)
(setq e1 '(67.509680 211.320400))
(setq p1 '(81.009680 211.320400))
(setq e2 '(94.509680 227.320400))
(setq p2 '(108.009680 227.320400))
(setq e3 '(67.509680 227.320400))
(setq p3 '(81.009680 227.320400))
(setq e4 '(94.509680 211.320400))
(setq p4 '(108.009680 211.320400))
(setq filepath (getvar "dwgprefix"))
(setq pdfpath (vl-string-subst "\\Photo Sims\\" "\\Drawings\\CDs\\" filepath))
(setq sims (getfiled "Select Photo Sims" pdfpath "pdf" 8))
; (setq pagetotal (getreal "\nType Total Number of Pages: "))
; (setq pagenum 1)
(command "clayer" "G-XREF PURPOSE1")
(command "-pdfattach" sims 1 e1 1 0 )
(command "-pdfattach" sims 2 p1 1 0 )
(command "-pdfattach" sims 3 e2 1 0 )
(command "-pdfattach" sims 4 p2 1 0 )
(command "-pdfattach" sims 5 e3 1 0 )
(command "-pdfattach" sims 6 p3 1 0 )
(command "-pdfattach" sims 7 e4 1 0 )
(command "-pdfattach" sims 8 p4 1 0 )
(princ))
Solved! Go to Solution.