Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
*andrew.nao
Message 1 of 4 (200 Views)

PDF prints to wrong dir.

200 Views, 3 Replies
05-19-2010 07:42 AM
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]
*Gert
Message 2 of 4 (200 Views)

Re: PDF prints to wrong dir.

05-19-2010 08:04 AM in reply to: *andrew.nao
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]
*Gert
Message 3 of 4 (200 Views)

Re: PDF prints to wrong dir.

05-19-2010 08:08 AM in reply to: *andrew.nao
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]
>
>
*andrew.nao
Message 4 of 4 (200 Views)

Re: PDF prints to wrong dir.

05-20-2010 05:40 AM in reply to: *andrew.nao
thanks for your reply
I got it working
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.