Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Valued Contributor
mail
Posts: 98
Registered: ‎05-19-2008
Message 1 of 5 (398 Views)

Macro for 8x11 PDF quick plot button

398 Views, 4 Replies
10-03-2012 12:38 PM

I have the following macro for a quick PDF.  This works the first time you use the button, however, it does not work multiple times.  The new PDF won't override the previous one saved and cancels the command.  I would ideally like for a diaglouge box with a save prompt to appear, but I am unsure of how to do this.  Feedback would be greatly appreciated.  This is a very handy macro.

Thanks!

 

 

^C^C-PLOT;Y;;DWG TO PDF.PC3;ANSI A (8.50 X 11.00 INCHES);I;P;N;W;\\;C;Y;CLIENT.CTB;Y;;;;;^C^C

*Expert Elite*
hmsilva
Posts: 3,374
Registered: ‎12-17-2004
Message 2 of 5 (391 Views)

Re: Macro for 8x11 PDF quick plot button

10-03-2012 01:08 PM in reply to: mail

mail, try

^C^C-PLOT;Y;;DWG TO PDF.PC3;ANSI A (8.50 X 11.00 INCHES);I;P;N;W;\\;C;Y;CLIENT.CTB;Y;;;Y;;;^C^C

if the file does not exist, the macro will recalls the command, but then cancels it.

Henrique

*Expert Elite*
hmsilva
Posts: 3,374
Registered: ‎12-17-2004
Message 3 of 5 (378 Views)

Re: Macro for 8x11 PDF quick plot button

10-03-2012 03:05 PM in reply to: mail

mail,
after testing my solution I found that the "Y" when there is no pdf, will save changes to page setup...
I think is a better approach that you save this code as plt.lsp

(defun c:smileytongue:LT(/ fl)
(setq fl (strcat (getvar "dwgprefix") (getvar "dwgname")))
(setq fl (strcat (vl-string-right-trim ".dwg" fl) "-" (getvar "ctab") ".pdf"))
(if (findfile fl)
  (command "-PLOT" "Y" ""  "DWG TO PDF.PC3" "ANSI A (8.50 X 11.00 INCHES)" "I" "P" "N"
       "W" pause pause "" "C" "Y" "CLIENT.CTB" "Y" "" "" "Y" "" "")
  (command "-PLOT" "Y" "" "DWG TO PDF.PC3" "ANSI A (8.50 X 11.00 INCHES)" "I" "P" "N"
       "W" pause pause "" "C" "Y" "CLIENT.CTB" "Y" "" "" "" "")
  );if
  (princ)
  )

and use this macro in the button

^C^C(if (not c:smileytongue:lt) (load "C:/mylisp/plt"));plt

change C:/mylisp/ to your path.

Henrique

Valued Contributor
mail
Posts: 98
Registered: ‎05-19-2008
Message 4 of 5 (358 Views)

Re: Macro for 8x11 PDF quick plot button

10-04-2012 11:28 AM in reply to: mail

Henrique,

  I really appreciate your help.  I loaded the lisp and macro and changed the path, however, I get this message:

 

Command: (if (not c:smileytongue:lt) (load "F:

 

Is there something else I need to change?  Thanks

*Expert Elite*
hmsilva
Posts: 3,374
Registered: ‎12-17-2004
Message 5 of 5 (349 Views)

Re: Macro for 8x11 PDF quick plot button

10-04-2012 01:02 PM in reply to: mail

mail,

to write the way do not forget that you can only use / or \ \ if you use a single \ does not work.
See if your path is well written and see the attached file.

 

Henrique

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.