print pdf location to dwg folder map

print pdf location to dwg folder map

larsr2866
Enthusiast Enthusiast
853 Views
10 Replies
Message 1 of 11

print pdf location to dwg folder map

larsr2866
Enthusiast
Enthusiast

Hello,

 

I have been using a lisp to automatically print to pdf with always the same pdf name (details.pdf). Only problem is that this doen't save it on the dwg folder map. Can someone help me with this?

 

(defun C:PPP (/)

(command "_.-PLOT" ;

"_yes" ;
"map02";
"Dwg To PDF.pc3" ;
"ISO full bleed A4 (210.00 x 297.00 MM)" ;
"_millimeters" ;
"_portrait"
"_no"
"_layout"
"1:1"
"0.00,0.00"
"_yes"
"mapcolor.ctb"
"_yes"
"_no"
"_no"
"_no"
"details"

"_no"
"_yes"

);_command

(princ) ;
)

0 Likes
Accepted solutions (1)
854 Views
10 Replies
Replies (10)
Message 2 of 11

dmfrazier
Advisor
Advisor

"...this doen't save it on the dwg folder map."

 

What does this mean?

0 Likes
Message 3 of 11

larsr2866
Enthusiast
Enthusiast

It creates the pdf with the correct name 'details.pdf', but i would like to automatically save this pdf in the folder of the dwg.

I hope someone could help me with this?

 

Thanks in advanve.

0 Likes
Message 4 of 11

dmfrazier
Advisor
Advisor

(setq fpath (getvar "DWGPREFIX")); set path based on current dwg

0 Likes
Message 5 of 11

larsr2866
Enthusiast
Enthusiast

It doesn't work when i use this. Am i doing something wrong?

Thanks in advance.

 

(defun C:PPP (/)

(setq fpath (getvar "DWGPREFIX"))

(command "_.-PLOT" ;

"_yes" ;
"map02";
"Dwg To PDF.pc3" ;
"ISO full bleed A4 (210.00 x 297.00 MM)" ;
"_millimeters" ;
"_portrait"
"_no"
"_layout"
"1:1"
"0.00,0.00"
"_yes"
"mapcolor.ctb"
"_yes"
"_no"
"_no"
"_no"
"details"

"_no"
"_yes"

);_command

(princ) ;
)

0 Likes
Message 6 of 11

Moshe-A
Mentor
Mentor

@larsr2866  hi,

 

take a look at this >> PLOTTOFILEPATH <<  sysvar

 

Moshe

0 Likes
Message 7 of 11

dmfrazier
Advisor
Advisor
Accepted solution

 

It's not enough just to set the variable. You have to use the variable in the name that you want the PDF file to have.

 

Replace the line that reads "details" with this:

 

(strcat fpath "details"); this concatenates the path and filename

0 Likes
Message 8 of 11

Moshe-A
Mentor
Mentor

that's right, this is only for the current session, as soon as you close\reopen AutoCAD this sysvar is reset.

 

0 Likes
Message 9 of 11

dmfrazier
Advisor
Advisor

My response was to the OP.

In the LISP he wrote, all he needs to do is modify it as I have shown. It will work no matter what drawing is open.

0 Likes
Message 10 of 11

larsr2866
Enthusiast
Enthusiast
Thanks to both! This worked perfect! 🙂
0 Likes
Message 11 of 11

Sea-Haven
Mentor
Mentor

Here is something that makes a PDF directory under the location of the dwg. So you use it with strcat your pdf name in the plot code..

 

; check that pdf directory exists
(setq dwgpre (strcat (getvar "dwgprefix") "\pdf"))
(if (= (vl-file-directory-p dwgpre) nil)
(vl-mkdir dwgpre)
)

 

 

0 Likes