• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Visual LISP, AutoLISP and General Customization

    Reply
    *andrew.nao

    PDF prints to wrong dir.

    164 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]
    Please use plain text.
    *Gert

    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]
    Please use plain text.
    *Gert

    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]
    >
    >
    Please use plain text.
    *andrew.nao

    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
    Please use plain text.