(defun pdf2lst (s1 del) (setq xcnt 0) (setq xbeg 1) (setq xlst nil) (setq l1 (strlen s1)) (while (<= xcnt l1) (setq xcnt (1+ xcnt)) (if (= (substr s1 xcnt 1) del) (progn (setq xlst (append xlst (list (substr s1 xbeg (- xcnt xbeg))))) (setq xbeg (+ xcnt 1)) ) ) ) (if (< xbeg xcnt) (setq xlst (append xlst (list (substr s1 xbeg (- xcnt xbeg))))) ) xlst ) (setq cmdecho (getvar "CMDECHO")) (setvar "CMDECHO" 0) (setq wfil (scad_getfiled "Select World File" (getvar "DWGPREFIX") "TFW;JGW" 0)) (if (/= wfil nil) (progn (setq kl(strlen wfil)) ;get the path of the file (setq root(substr wfil 1 (- kl 4))) ;get the extension of the file (setq fext(strcase (substr wfil (- kl 2) 3))) (cond ((= fext "TFW") (progn ; accept both extensions TIF and TIFF (setq ifil (strcat root ".TIF")) (if (not (findfile ifil)) (setq ifil (strcat root ".TIFF")) ) )) ((= fext "JGW") (setq ifil (strcat root ".JPG")) ) ) ; test if the image file and the geoinfo attached exist (if (and (findfile wfil) (findfile ifil)) (progn (setq fh (open wfil "r")) (setq xdim (atof (read-line fh))) (setq rotR (atof (read-line fh))) ;rotation term for row (setq rotC (atof (read-line fh))) ;rotation term for column (use on rotc (setq ydim (atof (read-line fh))) ;Invert the ydim (setq ydim (* -1.0 ydim)) (setq xcor (atof (read-line fh))) ; use the y without to change it's sign (setq ycor (atof (read-line fh))) (close fh) (command "-IMAGE" "_A" ifil "0,0" "1" "0") (setq hnd (entlast)) (if (/= hnd nil) (progn (setq ent (entget hnd)) (if (= (cdr (assoc 0 ent)) "IMAGE") (progn (setq hgt (nth 2 (assoc 13 ent))) (setq wdt (nth 1 (assoc 13 ent))) ; azimuth of line in the drawing (one is sin another is cos) (setq aziX (atan2 xdim rotR)) ; AutoCAD is not using both variables (setq aziy (atan2 ydim rotR)) ; getting true cell dimensions (setq xdim (/ (abs xdim) (cos azix))) (setq ydim (/ (abs ydim) (cos aziy))) ; adjusting by height - 0.5 pixel (setq ydif (* (- hgt 0.5) (* (cos aziy) ydim))) (setq ycor (- ycor ydif)) (setq xdif (* (- hgt 0.5) (* (sin aziy) ydim))) (setq xcor (+ xcor xdif)) ; adjusting by 0.5 pixel (setq ydif (* -0.5 (* (sin aziy) xdim))) (setq ycor (- ycor ydif)) (setq xdif (* 0.5 (* (cos azix) ydim))) (setq xcor (- xcor xdif)) (setq n10 (list 10 xcor ycor 0.0)) (setq ent (subst n10 (assoc 10 ent) ent)) (setq n11 (list 11 (* (cos azix) xdim) (* (sin azix) xdim) 0.0)) (setq ent (subst n11 (assoc 11 ent) ent)) (setq n12 (list 12 (* -1 (* (sin aziy) ydim)) (* (cos aziy) ydim) 0.0)) (setq ent (subst n12 (assoc 12 ent) ent)) (entmod ent) (princ "\nDone.") )) )) ) (progn (alert (strcat "Image Not Found!\n" ifil)) )) )) ; (setvar "CMDECHO" cmdecho) (princ)