Jump to content

Recommended Posts

Posted

I use this routine to print my plans in pdf quickly...

 

the problem is that sometimes it saves the generated pdf in the folder of my documents

 

I want them to be generated and saved in the folder where the file is located my dwg...

 

(defun C:impdf ( / name rotulo)
(setq name (getvar "dwgname"))
(setq rotulo (substr name 1 32))

(command "TILEMODE" "0" "" "'_.zoom" "_e" "" "_plot" "y" "Presentación1" "DWG To PDF.pc3" "ANSI B (11.00 x 17.00 Inches)" "m" "L" "N" "E" "F" "C" "Y" "1.ctb" "Y" "N" "N" "N" rotulo "N" "" "N" "Y")
(command "_CLOSE" "Y")

(princ) 
);c.defun 

 

 

 

 

Posted (edited)

 

Edited by mhupp
  • Like 2
Posted

You can also work out what to change in your code, If you start the plot command in the command line (_plot), it will give you all the options that your LISP has preselected one after another. Make a note of them as it runs through the plot command and you can change these above to suit your needs.

  • Like 1
  • Agree 1
Posted

WHAT I NEED IS FOR YOU TO SAVE THE PDF IN THE SAME FOLDER AS THE DWG WITHOUT BEING ASKED

  • Dislike 1
Posted (edited)

No need to yell 😛

 

(defun C:impdf ( / name rotulo)
  (setq path (getvar 'dwgprefix))
  (setq fn (vl-filename-base (getvar 'dwgname)))
  (setq rotulo (strcat path "\\" fn ".pdf"))

 

Edited by mhupp
  • Like 1
  • Agree 1
Posted

I am not a member of The Lisperatti, so this may not be of interest to you.

 

Are you familiar with the Automatic Publish functionality of Autocad?

As shown in the screenshot.

I don't USE it, but I know that it will automagically create a new folder for your PDFs, once setup.

As I recall in the same folder as your original dwgs., but configurable.

 

image.thumb.png.1c11d009686b98e076460ab79ded153c.png

 

  • Agree 1
Posted

What I reckon you can do is to read the hints above and work it out now.

 

MHupp has given you a little LISP that creates the PDF filename and path as rotulo, it might need a tiny change to make it work. You can run this from your LISP either copy and paste into it or with (setq rotulo (IMPDF)) and you are good to go

  • Like 1
Posted

Create a pdf directory under current dwg location. Part of my plot routines yes does auto.

 

; check that pdf directory exists
(setq dwgpre (strcat (getvar "dwgprefix") "\pdf"))
(if (= (vl-file-directory-p dwgpre) nil)
(vl-mkdir dwgpre)
)
.....................

(setq dwgname (GETVAR "dwgname"))
(setq lendwg (strlen dwgname))
(setq dwgname (substr dwgname 1 (- lendwg 4)))
........................................................

(setq pdfname (strcat dwgpre "\\" dwgname "-" (getvar "ctab") ".pdf" )) ; pdf name 

 

  • Like 1

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