Jump to content

PDF file saving location - Need help


Recommended Posts

Posted

Hi all,

 

Currently i am using the below lisp for "creating PDF files" very Quickly which i got from this forum. This is very good & useful lisp. I don't know who wrote this lisp. thanks to him.

 

But Currently PDF file is creating where DWG file path is located. Every time i would copy & paste the created PDF files into other folder manually where i want.

Is it possible to change the PDF file saving path location to other default location except DWG file path..? Also i would like to create the "PDF file name" will be "dwg Layout name (Each separate layout name)". Please help me to fix this... I am not familiar in writing lisp...

 

Example..DWG file path is "E:\Raj\drawings" but PDF file will be saved in "E:\Raj\PDF files"

 

(defun c:test12 ( / cm )
   (setq cm (getvar 'CMDECHO))
   (setvar 'CMDECHO 0)
   (command "_.-plot" "_y"
       (if (= 1 (getvar 'TILEMODE)) "Model" (getvar 'CTAB))
       "DWG To PDF.pc3" "ARCH D (36.00 x 24.00 Inches)"
       "_M" "_L" "_N" "_E" "_F" "_C" "_Y" "monochrome.ctb" "_Y"
   )
   (if (= 1 (getvar 'TILEMODE))
       (command "_A")
       (command "_N" "_Y")
   )
   (command "_N" (strcat (getvar 'DWGPREFIX) (vl-filename-base (getvar 'DWGNAME))) "_Y" "_Y")
   (setvar 'CMDECHO cm)
   (princ)
)
(vl-load-com) (princ)

  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

  • rajeshmuthu

    12

  • MSasu

    8

  • BIGAL

    1

  • Bhull1985

    1

Posted

Maybe adjust this line:

(command "_N" (strcat (getvar 'DWGPREFIX) [color=magenta]"PDF Files\\"[/color] (vl-filename-base (getvar 'DWGNAME))) "_Y" "_Y")

Posted

Hi MSasu. Thanks for the help. But its not working. PDF file was not created...

Posted

Seems than there were some other issues with your original code; please find a fix:

(defun c:test12 ( / cm )
   (setq cm (getvar 'CMDECHO))
   (setvar 'CMDECHO 0)
   (command "_.-plot" "_y"
       (if (= 1 (getvar 'TILEMODE)) "Model" (getvar 'CTAB))
       "DWG To PDF.pc3" "ARCH D (36.00 x 24.00 Inches)"
       "_M" "_L" "_N" "_E" "_F" "_C" "_Y" "monochrome.ctb" "_Y"
   )
   (if (= 1 (getvar 'TILEMODE))
       (command "_A")
       (command "_N" "_Y")
   )
   (command (strcat (getvar 'DWGPREFIX) (vl-filename-base (getvar 'DWGNAME))) [color=red]"_N" "_Y"[/color])
   (setvar 'CMDECHO cm)
   (princ)
)
(vl-load-com) (princ)

Posted

Same thing bit different code

(setq pdfname (strcat (getvar "dwgprefix") dwgname "-" name)) ;change pdfname to 
(setq pdfname (strcat "your directory" dwgname "-" name)) ; name is layoutab name

(COMMAND "-PLOT"  "Y"  "" "dwg to Pdf"
       "Iso full bleed A3 (420.00 x 297.00 MM)" "m"    "LANDSCAPE"  "N"   "W"  "-6,-6"    "807,560" "1=2"  "C"
       "y"	  "Designlasercolour.ctb" "Y"	"n"    "n"    "n"   pdfName "N" "y"      )

Posted

Hi MSasu.. Thanks but its not working which i got Error msg "Unknown command "N".

Unknown command "Y" while using this code...

Posted

Hi BIGAL, Thanks for your help..But i got an error msg "; error: bad argument type: stringp nil"...

 

FYI.. DWG & PDF file location will be created (both folders) to each project

Posted

Rajeshmuthu, I have forced the display of prompts into code below; please run it and post here all the lines that were printed on text window (press ) after calling the command.

(defun c:test12 ( / cm )
   (setq cm (getvar 'CMDECHO))
   (setvar 'CMDECHO 1)
   (command "_.-plot" "_y"
       (if (= 1 (getvar 'TILEMODE)) "Model" (getvar 'CTAB))
       "DWG To PDF.pc3" "ARCH D (36.00 x 24.00 Inches)"
       "_M" "_L" "_N" "_E" "_F" "_C" "_Y" "monochrome.ctb" "_Y"
   )
   (if (= 1 (getvar 'TILEMODE))
       (command "_A")
       (command "_N" "_Y")
   )
   (command (strcat (getvar 'DWGPREFIX) (vl-filename-base (getvar 'DWGNAME))) "_N" "_Y")
   (setvar 'CMDECHO cm)
   (princ)
)
(vl-load-com) (princ)

Posted

Hi MSasu,

 

Here is the requested details for your use...

 

Command: test12

_.-plot Detailed plot configuration? [Yes/No] : _y

Enter a layout name or [?] : R-9 Enter an output device name or [?]

PDF>: DWG To PDF.pc3 Enter paper size or [?] :

ARCH D (36.00 x 24.00 Inches) Enter paper units [inches/Millimeters]

: _M Enter drawing orientation [Portrait/Landscape] : _L

Plot upside down? [Yes/No] : _N Enter plot area

[Display/Extents/Layout/View/Window] : _E Enter plot scale (Plotted

Millimeters=Drawing Units) or [Fit] : _F Enter plot offset (x,y) or

: _C Plot with plot styles? [Yes/No] : _Y Enter plot

style table name or [?] (enter . for none) : monochrome.ctb

Plot with lineweights? [Yes/No] : _Y Scale lineweights with plot scale?

[Yes/No] : _N Plot paper space first? [Yes/No] : _Y Hide paperspace

objects? [Yes/No] : C:\Documents and Settings\RAJ\Desktop\R-9

Command: _N Unknown command "N". Press F1 for help.

 

Command: _Y Unknown command "Y". Press F1 for help.

Posted

My fault, I had not tested the code in Layout, too. So please find below a fixed version and sorry for inconvenience.

(defun c:test12 ( / cm )
   (setq cm (getvar 'CMDECHO))
   (setvar 'CMDECHO 0)
   (command "_.-plot" "_y"
       (if (= 1 (getvar 'TILEMODE)) "Model" (getvar 'CTAB))
       "DWG To PDF.pc3" "ARCH D (36.00 x 24.00 Inches)"
       "_M" "_L" "_N" "_E" "_F" "_C" "_Y" "monochrome.ctb" "_Y"
   )
   (if (= 1 (getvar 'TILEMODE))
       (command "_A")
       (command "_N" "_Y" "_N")
   )
   (command (strcat (getvar 'DWGPREFIX) "PDF files\\" (vl-filename-base (getvar 'DWGNAME))) "_Y" "_Y")
   (setvar 'CMDECHO cm)
   (princ)
)
(vl-load-com) (princ)

Posted

Hi MSasu... Again i got the same problem... the PDF file was created in the current DWG file location only but the created PDF file name is "_Y.pdf" not the layout name.

 

FYI... Its asking that "Proceed with plot [Yes/No] :" while run this lisp at starting.

Posted

Hi bhull1985, I added one more "_Y"...Again Its not working...

 

FYI...Currently i am using AutoCAD 2007

Posted

Rajeshmuthu, please call the -PLOT command (don't miss the hyphen, it will allow to work on prompt) and do a print from Model and another one from Layout. After press and post here the dialogs to allow one of us to fix your routine.

Posted

Hi MSasu, Please see the below details for your reference..

 

Command: -plot

Detailed plot configuration? [Yes/No] :

 

Enter a layout name or [?] : R-9

Regenerating layout.

Regenerating model - caching viewports.

 

Enter a page setup name :

Enter an output device name or [?] :

Save changes to page setup [Yes/No]?

Proceed with plot [Yes/No] :

Effective plotting area: 34.93 wide by 22.60 high

 

Plotting viewport 1.

Effective plotting area: 34.46 wide by 20.45 high

 

Plotting viewport 2.

Restoring cached viewports.

Regenerating 1710 modified entities.

 

 

Command:

Restoring cached viewports - Regenerating layout.

 

Command: -PLOT

Detailed plot configuration? [Yes/No] :

 

Enter a layout name or [?] :

 

Enter a page setup name :

Enter an output device name or [?] :

Save changes to page setup [Yes/No]?

Proceed with plot [Yes/No] :

Effective plotting area: 34.93 wide by 22.60 high

 

Plotting viewport 1.

Effective plotting area: 34.46 wide by 20.45 high

 

Plotting viewport 2.

Posted

From this example seems that you have already a page setup on those drawings and want them printed with that settings (that it, since you did not choose Detailed plot configuration input mode). Is that correct?

Posted

Yes correct MSasu...but some of the drawings has Page setup already & most of the drawings has not page setup.

Posted

If there are drawings without page setup, then please do a pair (Model/Layout) of print operations in detailed mode.

Command: -plot

Detailed plot configuration? [Yes/No] : Y

Posted

Thanks for the help MSasu...But the PDF file is creating under "PDF files" where inside drawing file located folder only..I would like to save outside of dwg folder.

 

Example:- DWG file location is "E:\Raj\drawings" and PDF file would be saved in "E:\Raj\PDF files" (Outside dwg folder)..Please help me to fix this..

 

Also the PDF file is not using layout name...Since we have min. 4 layouts in dwg..

Posted

I'm not sure that understand. Please clarify, is the routine printing successfuly in fact and the issues were the location of the PDF files and their naming?

By the way, did you checked the PUBLISH feature of AutoCAD?

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