Jump to content

PDFAttach at a particular location and scale


rcb007

Recommended Posts

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!

Link to comment
Share on other sites

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)
)

 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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)
)

 

Link to comment
Share on other sites

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))

 

Link to comment
Share on other sites

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)
)

 

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...