LISP to set plot file location using current drawing's file path, but on a different Drive

LISP to set plot file location using current drawing's file path, but on a different Drive

infoZ5YR2
Explorer Explorer
445 Views
2 Replies
Message 1 of 3

LISP to set plot file location using current drawing's file path, but on a different Drive

infoZ5YR2
Explorer
Explorer

I don't know if what I'm looking for is possible, but here's my situation:

All drawings live on 'Drive A'. 

All plot files live on 'Drive B'.

When plotting, I'd like the file location to default to the corresponding folder on the 'B' drive, using identifiers from the current drawing's file path.

 

The file structures for a specific project look like this: 

(drawings) A:\C{x}\{y}\{z}

(plots)         B:\Kip\Plot Files\{x}\{y}\{z}

 

The italicized portions of the file path are constant, the bold portions are project dependent but x, y, and z will be the same on each drive.

 

Does anyone know whether this can be accomplished with a LISP routine, or any other process?

 

Thank you.

0 Likes
446 Views
2 Replies
Replies (2)
Message 2 of 3

ec-cad
Collaborator
Collaborator

Since you are going to plot to a folder location, implies you will output a .pdf file ?

In Lisp, you can do the plotting and set the output path by:

(setq cur_drive (substr (getvar "dwgprefix") 1 2)); current drive

(setq cur_path (substr (getvar "dwgprefix") 3)); current path

(setq new_drive "B:")

(setq out_path (strcat new_drive cur_path)); Drive/Path for output

Then, in the plot command, assemble out_path and .pdf

 

Do you have a Lisp for plotting, if so, just post it and we can make suggestions.

 

ECCAD

 

0 Likes
Message 3 of 3

Sea-Haven
Mentor
Mentor

As a default we used a /pdf directory one level below the dwg this was automatically made if it did not exist, so yes can make a directory on B: to suit. In the example plot lisp the pdfname would have the B:\Kip\Plot Files\{x}\{y}\{z} as you suggested.

 

 

 

; check that pdf directory exists
(setq dwgpre (strcat (getvar "dwgprefix") "\pdf"))
(if (= (vl-file-directory-p dwgpre) nil)
(vl-mkdir dwgpre)
)
..... lots of code
.....
(COMMAND "-PLOT"  "Y"  "" "Print As PDF"
       "A3" "m" "LANDSCAPE"  "N"   "W"  "-6,-6" "807,560" "1=2"  "C"
       "y" "Default.ctb" "Y"	"n" "n" "n" pdfName "N" "y"
)

 

The attached is a plot layouts by range.

0 Likes