Visual LISP, AutoLISP and General Customization

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

Macro for 8x11 PDF quick plot button

346 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: 2,667
Registered: ‎12-17-2004
Message 2 of 5 (339 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: 2,667
Registered: ‎12-17-2004
Message 3 of 5 (326 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 (306 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: 2,667
Registered: ‎12-17-2004
Message 5 of 5 (297 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community