Export to PDF command line help.

Export to PDF command line help.

gobluejd
Advocate Advocate
13,979 Views
71 Replies
Message 1 of 72

Export to PDF command line help.

gobluejd
Advocate
Advocate

hmsilva Has helped me get a auto PDF generator to work in windows.  The lisp replaces the qsave command and when you type qsave, it auto generates to a specific location and works really good.  I wanted to try on the MAC.  You can see whole convo here.  

 

More specifically he stared helping on the MAC but he is not a mac user.  That convo starts here.

 

I am pretty sure it can be come but need some assistance and hopefully someone can help out.

 

Basically I want to see I can create a PDF completely from the command line and use in the aucaddoc.lsp which I have confirmed loads and works.

 

 

 

 

0 Likes
Accepted solutions (1)
13,980 Views
71 Replies
Replies (71)
Message 21 of 72

gobluejd
Advocate
Advocate

Yes sorry.  In page setup for the layout, I would tell it what to plot via a window (pick points on layout - but is saved in layout)

0 Likes
Message 22 of 72

maxim_k
Consultant
Consultant
Ok. I need to think.

Maxim

Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
0 Likes
Message 23 of 72

maxim_k
Consultant
Consultant

Jeff,

 

Can you try this:

 

(defun c:qs (/ *error* echo pdf_file lst mutt old_device old_what-plot)

(defun *error* (msg)
(if mutt
(setvar 'nomutt mutt)
)
(if echo
(setvar 'cmdecho echo)
)
(cond ((not msg))
((member msg '("Function cancelled" "quit / exit abort")))
((princ (strcat "\n** Error: " msg " ** ")))
)
(princ)
);_defun error

(setq mutt (getvar 'nomutt)
echo (getvar 'cmdecho))
(setvar 'cmdecho 0)
(setvar 'nomutt 1)

(setq pdf_file (strcat (getvar "dwgprefix") (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4))))

(command "_plot" "_N" "" "" "None" pdf_file "_N" "_Y")


;(command "_.qsave")
(*error* nil)
(princ)
)

 

Again - QSAVE is commented, you need to use QS command to get PDF. There could be errors, when you call command from Model Space.

How it goes on your side?

 

Maxim


Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
0 Likes
Message 24 of 72

gobluejd
Advocate
Advocate

Yes, give me a few mintues.

0 Likes
Message 25 of 72

gobluejd
Advocate
Advocate

Same thing as before, asks printer name, I enter my default printer (same on MAC as WIN) and then a series of questions.  After printer name, it askes, print to file, I say YES, brings up dialog box to save PDF somewhere (I can pick).  If I answer no to rest of questions (save to plot setup, proceed to plot) then command exits.  PDF was created after second question, print to file.

0 Likes
Message 26 of 72

maxim_k
Consultant
Consultant
This is strange, because on my side it works with the test drawing you attached here.
Could you post Command window output from the time when you type QS at the command prompt till the "end" of the process?
Another question: do you have any plotter (printer) on your Mac? I mean plotter (printer) in the "Print & Scan" pan of Mac OS System Preferences.

Maxim

Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
0 Likes
Message 27 of 72

gobluejd
Advocate
Advocate

I have 2 printers.  See attached screens.  The screen showing PDF file popup is when I answer YES to PLOT TO FILE.

 

Screen Shot 2016-02-09 at 9.45.42 AM.pngScreen Shot 2016-02-09 at 9.46.42 AM.pngScreen Shot 2016-02-09 at 9.46.42 AM.png

0 Likes
Message 28 of 72

maxim_k
Consultant
Consultant
Are you sure you loaded correct LSP file before executing QS command?

Maxim

Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
0 Likes
Message 29 of 72

gobluejd
Advocate
Advocate

Yes - the acaddoc.lsp. I overwrote the one I had before, with your new above. Even just re-did again. Auto cad was closed.

Here was procedure.

Close Autocad.
Navigate to acaddoc.lsp in finder.  Copy lsp to desktop (cant edit in place).

Open lsp with text edit.

Select all, delete,

Copy text from your most recent post and paste.

Save file.

Copy/over write acaddoc.lsp to acad libray location.

Open ACAD and select a dwg

type QS

command runs as before.

0 Likes
Message 30 of 72

maxim_k
Consultant
Consultant
Try to create new text file, paste my last code to it, save as QS.LSP file (or give it another name).
Ooen one of your drawings. Load this file using APPLOAD command. Use QS command.
What do you see?

Maxim

Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
0 Likes
Message 31 of 72

gobluejd
Advocate
Advocate

It works flawlessy.  Wonder what issue is?

0 Likes
Message 32 of 72

maxim_k
Consultant
Consultant
I haven't tested the code with acaddoc.lsp, tomorrow will try.
Meanwhile you can add QS.LSP to Startup Suite in APPLOAD dialog, you will have approximately the same effect as with using acaddoc.lsp

Maxim

Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
0 Likes
Message 33 of 72

gobluejd
Advocate
Advocate

It works fine on its own when added to Startup Suite.  No need to mess with acaddoc.lps (as far as I can see).  I can exit out, restart and it loads fine.

0 Likes
Message 34 of 72

gobluejd
Advocate
Advocate
Thanks for the help - and just to make sure, there is no way to have it go to a different location, other than original DWG file location correct?
0 Likes
Message 35 of 72

maxim_k
Consultant
Consultant
PDF output can be redirected to any location on your Mac. Where do you want to put it?

Maxim

Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
0 Likes
Message 36 of 72

gobluejd
Advocate
Advocate

They can go here:

 

/Users/jeffreydickerson/PDF's

 

But I'd like them to go onto my Parallels Windows shared folder.

 

/Volumes/C/Users/Jeff.Dickerson/Documents/Drawings/PDF

 

If I paste the above link into FInder "Go to Folder" it works.  Hopefully it can go there.

0 Likes
Message 37 of 72

maxim_k
Consultant
Consultant
Accepted solution

Here you are:

 

 

(defun c:qs (/ *error* echo pdf_file lst mutt old_device old_what-plot)

(defun *error* (msg)
(if mutt
(setvar 'nomutt mutt)
)
(if echo
(setvar 'cmdecho echo)
)
(cond ((not msg))
((member msg '("Function cancelled" "quit / exit abort")))
((princ (strcat "\n** Error: " msg " ** ")))
)
(princ)
);_defun error

(setq mutt (getvar 'nomutt)
echo (getvar 'cmdecho))
(setvar 'cmdecho 0)
(setvar 'nomutt 1)

(if (findfile "/Volumes/C/Users/Jeff.Dickerson/Documents/Drawings/PDF")
(progn
(setq pdf_file (strcat "/Volumes/C/Users/Jeff.Dickerson/Documents/Drawings/PDF/" (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4))))
(command "_plot" "_N" "" "" "None" pdf_file "_N" "_Y")
);end PROGN
(alert "Destination folder is unavailable!")
);end IF

;(command "_.qsave")
(*error* nil)
(princ)
)

 

If "/Volumes/C/Users/Jeff.Dickerson/Documents/Drawings/PDF" is not connected (VM not running) you will get an alert and PDF will not be created.

 

 

 

Maxim


Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
Message 38 of 72

gobluejd
Advocate
Advocate
Thank you so much for your time. It is greatly appreciated.
0 Likes
Message 39 of 72

gobluejd
Advocate
Advocate

@maxim_k Has 2018 made it easier to auto publish a PDF when a DWG is saved?  You helped me just under 2 years ago and hoped there was a better solution that what you had done for me.  Thanks for you time.

0 Likes
Message 40 of 72

gobluejd
Advocate
Advocate

@maxim_k  When I load the QS.lsp and run it still says unknown command.  See screens.

 

 

0 Likes