Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PDF prints to wrong dir.

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
311 Views, 3 Replies

PDF prints to wrong dir.

Hello folks,
hoping someone might have a solution for this that maybe im not seeing.
this lisp code is supposed to write a dwg to a pdf in the same directory as
the dwg
sometimes it works sometimes it doesn't, more doesn't then does.

does anyone see why it wouldn't save to the same directory as the dwg
any help is appreciated

[code]
(defun printpdf (/ fileloc filenam)
(setq fileloc (strcat (getvar "dwgprefix") (vl-filename-base (getvar
"dwgname"))))
(setq filenam (vl-filename-base (getvar "dwgname")))

(command "-plot""y" "" "DWG To PDF.pc3" "ANSI expand A (8.50 x 11.00
Inches)" "I" "P" "N" "E" "F" "" "Y" "nao.ctb" "Y" "" filenam
"n" "y")
)
[\code]
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

maybe its a problem, if the file already exists
you could
(vl-file-delete filenam)
i guess it doesn´t crash, if the file does not exist
and the filenam should be
(setq FILENAM (strcat (getvar "DWGPREFIX") (vl-filename-base (getvar
"DWGNAME"))))


andrew.nao wrote:
> Hello folks,
> hoping someone might have a solution for this that maybe im not seeing.
> this lisp code is supposed to write a dwg to a pdf in the same directory as
> the dwg
> sometimes it works sometimes it doesn't, more doesn't then does.
>
> does anyone see why it wouldn't save to the same directory as the dwg
> any help is appreciated
>
> [code]
> (defun printpdf (/ fileloc filenam)
> (setq fileloc (strcat (getvar "dwgprefix") (vl-filename-base (getvar
> "dwgname"))))
> (setq filenam (vl-filename-base (getvar "dwgname")))
>
> (command "-plot""y" "" "DWG To PDF.pc3" "ANSI expand A (8.50 x 11.00
> Inches)" "I" "P" "N" "E" "F" "" "Y" "nao.ctb" "Y" "" filenam
> "n" "y")
> )
> [\code]
Message 3 of 4
Anonymous
in reply to: Anonymous

ups sorry
(setq FILENAME (strcat (getvar "DWGPREFIX) (substr (getvar "DWGNAME") 1
(- (strlen (getvar "DWGNAME")) 4))))

Gert wrote:

> maybe its a problem, if the file already exists
> you could
> (vl-file-delete filenam)
> i guess it doesn´t crash, if the file does not exist
> and the filenam should be
> (setq FILENAM (strcat (getvar "DWGPREFIX") (vl-filename-base (getvar
> "DWGNAME"))))
>
>
> andrew.nao wrote:
>
>>Hello folks,
>>hoping someone might have a solution for this that maybe im not seeing.
>>this lisp code is supposed to write a dwg to a pdf in the same directory as
>>the dwg
>>sometimes it works sometimes it doesn't, more doesn't then does.
>>
>>does anyone see why it wouldn't save to the same directory as the dwg
>>any help is appreciated
>>
>>[code]
>>(defun printpdf (/ fileloc filenam)
>>(setq fileloc (strcat (getvar "dwgprefix") (vl-filename-base (getvar
>>"dwgname"))))
>>(setq filenam (vl-filename-base (getvar "dwgname")))
>>
>>(command "-plot""y" "" "DWG To PDF.pc3" "ANSI expand A (8.50 x 11.00
>>Inches)" "I" "P" "N" "E" "F" "" "Y" "nao.ctb" "Y" "" filenam
>>"n" "y")
>>)
>>[\code]
>
>
Message 4 of 4
Anonymous
in reply to: Anonymous

thanks for your reply
I got it working

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost