@Moshe-A wrote:
@_anonandon ,
made update, use the last version
Useful. FYI I have noticed a couple of things (I can work around them no problem):
The clipping boundary corners P1 and P2 must be on the first PDF that is selected ??is this because of PDF order in ssget list??
is it necessary to calculate the absolute x,y of the clip?
something is strange with osnap and PDFs!
(depending how they've been created some of the pdf's i use have frames that are snappable)
if i use your lisp as above and snap to a frame then the clipping boundary is often in the wrong place.
if i modify the lisp so that ssget is before P1/P2 and zoom in a lot to snap the clipping boundary is usually in the correct place.
is i turn off osnap the clip is always correct.
??could position accuracy of a pdfunderlay vary with zoom level??
(defun c:mpdfclp (/ oldsnap p0 p1 p2 p3 p4 p5 p6 ss ctr ename elist)
(setvar "cmdecho" 0)
(command "._undo" "_begin")
;(setq oldsnap (getvar "osmode"))
;(setvar "osmode" 0)
(if (and
(princ "\n<<<< Select FIRST PDF then the others >>>>")
(setq ss (ssget '((0 . "pdfunderlay"))))
(setq p1 (getpoint "\nZOOM IN. Specify first corner point of first PDF: "))
(setq p2 (getcorner p1 "\nZOOM IN. Specify opposite corner point of first PDF: "))
)
(progn
(setq ctr 0)
(foreach ename (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
(setq ctr (1+ ctr))
(setq elist (entget ename))
(setq p0 (cdr (assoc '10 elist)))
(command "._pdfclip" ename "_delete") ; remove existing clip if exist
(if (= ctr 1)
(setq p3 (mapcar '- p1 p0) p4 (mapcar '- p2 p0))
)
(setq p5 (mapcar '+ p0 p3))
(setq p6 (mapcar '+ p0 p4))
(command "._pdfclip" ename "_New" "_Rectangular" p5 p6)
); progn
); foreach
); if
;(setvar "osmode" oldsnap)
(command "._undo" "_end")
(setvar "cmdecho" 1)
(princ)
)