rcb007 Posted September 23, 2020 Share Posted September 23, 2020 I am trying to figure out how to attach a pdf to a certain location and scale. I thought I could browse for the file then tell it what to do from the command line. (defun c:PDFXA (/) (initdia) (command "_.-PDFAttach") (if (> (getvar "CMDACTIVE") 0) (progn (command "_None" '(1.75 0.4506 0.0)) (while (> (getvar "CMDACTIVE") 0) (command "")))) (princ) ) Thanks for any pointers! Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 23, 2020 Share Posted September 23, 2020 Hi, Something like this ? (defun c:Test (/ pdf ins scl) ;; Tharwat - 24.Sep.2020 ;; (and (or (setq pdf (findfile "C:/Users/Tharwat/Desktop/Test.pdf")) ;; Replace this path with your desired PDF full path of file. (alert "Opps, File not found <!>") ) (setq ins (getpoint "\nSpecify PDF insertion point : ")) (or (initget 6) (setq scl (getdist "\nSpecify Scale of PDF file : ")) ) (command "_.-PDFATTACH" pdf "1" "_none" ins scl "0") ) (princ) ) Quote Link to comment Share on other sites More sharing options...
rcb007 Posted September 23, 2020 Author Share Posted September 23, 2020 Awesome! Hopefully this makes sense. I am putting together a lisp as a script using (command “do this”). Is it possible to browse for the pdf and then hard code the scale and location? again. Thank you! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 24, 2020 Share Posted September 24, 2020 Do a bit more googling there is insert multi page pdf also. Look into Getfile and Findfile options about where to start looking for pdf. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 24, 2020 Share Posted September 24, 2020 7 hours ago, rcb007 said: Awesome! Hopefully this makes sense. I am putting together a lisp as a script using (command “do this”). Is it possible to browse for the pdf and then hard code the scale and location? again. Thank you! Certainly. Give the following a shot. (defun c:Test (/ pdf ins scl) ;; Tharwat - 24.Sep.2020 ;; (and (setq pdf (getfiled "Select PDF file to attach" (getvar 'DWGPREFIX) "pdf" 16)) (setq ins (getpoint "\nSpecify PDF insertion point : ")) (or (initget 6) (setq scl (getdist "\nSpecify Scale of PDF file : ")) ) (command "_.-PDFATTACH" pdf "1" "_none" ins scl "0") ) (princ) ) Quote Link to comment Share on other sites More sharing options...
rcb007 Posted September 24, 2020 Author Share Posted September 24, 2020 Thank you for this. My Question is, (And I could be thinking about this backwards), to create it in some form like the below? (defun Test (/ pdf ins scl) ;; Tharwat - 24.Sep.2020 ;; (and (setq pdf (getfiled "Select PDF file to attach" (getvar 'DWGPREFIX) "pdf" 16)) (setq ins (getpoint "\nSpecify PDF insertion point : ")) (or (initget 6) (setq scl (getdist "\nSpecify Scale of PDF file : ")) ) (command "_.-PDFATTACH" pdf "1" "_none" ins scl "0") ) (princ) ) (defun C:PDFinsTest () (command "_zoom" "_extents") (command "_rectangle" "0,0" "36,24") (TEST pdf "1,1" "0.60") (princ)) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 24, 2020 Share Posted September 24, 2020 My pleasure. This way? (defun c:PDFinsTest (/ pdf) (command "_rectangle" "0,0" "36,24") (command "_zoom" "_extents") (and (setq pdf (getfiled "Select PDF file to attach" (getvar 'DWGPREFIX) "pdf" 16 ) ) (command "_.-PDFATTACH" pdf "1" "_none" '(1.0 1.0 0.0) 0.6 "0") ) (princ) ) Quote Link to comment Share on other sites More sharing options...
rcb007 Posted September 24, 2020 Author Share Posted September 24, 2020 Thank you Thank you, so much! That is what I was looking for. I think I can edit this easily now;). Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 24, 2020 Share Posted September 24, 2020 You're welcome anytime. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.