Jump to content

Recommended Posts

Posted

Hey guys i need a lisp routine that will plot the current dwg into a file named plot but each job has a folder named plot so i guess it would have to search and find the dwg path for the dwg folder to find the correct plot file folder for each job. any suggestions?

Posted
Hey guys i need a lisp routine that will plot the current dwg into a file named plot but each job has a folder named plot so i guess it would have to search and find the dwg path for the dwg folder to find the correct plot file folder for each job. any suggestions?

 

Are you referring to plotting to file as in, receiving a .PLT file in the location - or are you talking about PDF'ing a drawing?

 

(some people get mixed up... i know I do :oops: )

Posted

Not sure if this would work - never done it before - bit of a stab in the dark really:

 

(defun c:plt2file  (/ file fPath plt laylst layVar i)
 (vl-load-com)
 (setq i    0
       file (getfiled "Select Destination for Files"
                      (if def_file
                        def_file
                        "")
                      "plt"
                      1))
 (if (not (setq def_file file))
   (exit))

 (setq fPath (vl-filename-directory file)
       plt   (vla-get-Plot
               (vla-get-ActiveDocument
                 (vlax-get-acad-object))))

 (setq laylst (vl-remove "Model" (layoutlist))
       layVar (vlax-make-variant
                (vlax-safearray-fill
                  (vlax-make-safearray
                    vlax-vbstring
                    (cons 0 (1- (length laylst))))
                  laylst)))

 (vlp laylst)

 (repeat (length laylst)
   (vla-SetLayoutstoPlot plt layVar)
   (if (eq :vlax-true (vla-PlottoFile plt fpath))
     (setq i (1+ i))))

 (princ (strcat "\n"
                (itoa i)
                " of "
                (itoa (length laylst))
                " Layouts Plotted to File."))

 (princ))

Posted

Its all going to be a plot to file (.PLT) no converting to pdf's or anything

Posted

Hi,

 

This is a routine I created that does what you are looking for I think. You will want to adjust the plot settings to call your page setups and printer, but otherwise it should be good to go.

 


(defun C:plottofile ( / FileDiaMode DwgFilePath DwgNamed )
(setq FileDiaMode (getvar "FILEDIA"))
(setvar "FILEDIA" 0)
(setq DwgFilePath (getvar "DWGPREFIX"))
(if (/= (vl-file-directory-p (strcat DwgFilePath "Plot\\" )) T)
(progn
(vl-mkdir (strcat DwgFilePath "Plot\\"))
); progn
); if
(setq DwgNamed (substr (Getvar "DWGNAME") 1 (- (strlen (getvar "DWGNAME")) 4)))
;(command "._Plot" "No" "Model" "Your Page Setup" "Your Printer Here" "Yes" (strcat DwgFilePath DwgNamed ".plt"))
(command "._Plot" "No" "Model" "Previous Plot" "mnt-hp-c5550-1" "Yes" (strcat DwgFilePath "Plot\\" DwgNamed ".plt") "No" "Yes")
(setvar "FILEDIA" FileDiaMode)
)
[/Code]

 

Let me know if you need any help with it.

 

Have a good one.

Shawndoe

Posted

Slightly altered my first post - this should do the trick:

 

[b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:plt2file  [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] file fPath plt laylst layVar[b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]vl-load-com[/color][/b][b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] file [b][color=RED]([/color][/b][b][color=BLUE]getfiled[/color][/b] [b][color=#ff00ff]"Select Destination for Files"[/color][/b]
                      [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] def_file
                        def_file
                        [b][color=#ff00ff]""[/color][/b][b][color=RED])[/color][/b]
                      [b][color=#ff00ff]"plt"[/color][/b]
                      [b][color=#009900]1[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]not[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] def_file file[b][color=RED])[/color][/b][b][color=RED])[/color][/b]
   [b][color=RED]([/color][/b][b][color=BLUE]exit[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]

 [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] fPath [b][color=RED]([/color][/b][b][color=BLUE]strcat[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-filename-directory[/color][/b] file[b][color=RED])[/color][/b] [b][color=#ff00ff]"\\"[/color][/b][b][color=RED])[/color][/b]
       plt   [b][color=RED]([/color][/b][b][color=BLUE]vla-get-Plot[/color][/b]
               [b][color=RED]([/color][/b][b][color=BLUE]vla-get-ActiveDocument[/color][/b]
                 [b][color=RED]([/color][/b][b][color=BLUE]vlax-get-acad-object[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]

 [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] laylst [b][color=RED]([/color][/b][b][color=BLUE]vl-remove[/color][/b] [b][color=#ff00ff]"Model"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]layoutlist[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
       layVar [b][color=RED]([/color][/b][b][color=BLUE]vlax-make-variant[/color][/b]
                [b][color=RED]([/color][/b][b][color=BLUE]vlax-safearray-fill[/color][/b]
                  [b][color=RED]([/color][/b][b][color=BLUE]vlax-make-safearray[/color][/b]
                    vlax-vbstring
                    [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]0[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]1-[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]length[/color][/b] laylst[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
                  laylst[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]

 [b][color=RED]([/color][/b][b][color=BLUE]vla-SetLayoutstoPlot[/color][/b] plt layVar[b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] :vlax-true [b][color=RED]([/color][/b][b][color=BLUE]vla-PlottoFile[/color][/b] plt fpath[b][color=RED])[/color][/b][b][color=RED])[/color][/b]
   [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]strcat[/color][/b] [b][color=#ff00ff]"\n"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]itoa[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]length[/color][/b] laylst[b][color=RED])[/color][/b][b][color=RED])[/color][/b]
                  [b][color=#ff00ff]" Layouts Plotted to File."[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
   [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\nPlot Failed."[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]

Posted
PlotDwgs is a plot utility program with several unique options including plotting all open drawings, and plotting a folder of user selected drawings. Drawings may be plotted to a specified size, or by selecting the "Varies" option, the program determines the correct paper size to plot. Also included is the option of plotting all layouts in reverse order, and plotting a folder of user selected drawings in reverse order. The associated files are PlotDwgs.lsp, PlotDwgs.dcl and PlotDwgs.dvb.
Posted

Hey they all work alot better than my original routine that would plot 2 file in the last plot file folder used i appreciate it guys

Posted

I have a question... Why wouldn't you just use the publish command and when the dialog box is open click on publish options... and then set the Location (Default output locations (dwf and plot-tofile)) to the folder you want them to go to?

Posted

becuase each job has a different plot folder for orginization

Posted

I get that part, but publish allows you to tell it where all plot to file files are going to go each time you use publish, Or are you saying that each individual print is in a different folder?

Posted

no no its all in the same folder but we eliminated about 8 min of lost time because when you ploting 40 - 50 dwgs to a file you would normally have to go through and do the process for each dwg now with one click its done instead of finding the desired path.

Posted

Do me a favor. Either push F1 and read the description AutCAD gives you about the publish command or just try it out following these step by steps.

 

 

1. Have any drawing open you want and type in "publish" into the command line.

Note. A dialog box will appear with current open drawings on the list

 

2. Delete the drawings from the que by just pressing delete key twice

 

3. Press the plus key to add drawings. (any number of drawings)

Note. Check the Layout tabs or the Model tabs check boxes to get either layout or model tabs or both.

 

4. After list populates press Ctrl + A to select all drawings in the box and pull the dropdown box under Page Setup / 3D DWF, then select the page setup you want to use (or import one from another file)

 

5. Select the Publish Options... button

 

6. Select the location section under the Default output location (DWF and plot-to-file section, then click on the ... to select what folder you want the files to go to.

 

7. Select OK

 

8. Select Publish.

 

This will use the page setup selected on ALL drawings selected. If it is a plot to file (.PDF .PLT ...) then it will go to the folder selected. So for each job you just select the folder here. You can also save your setup list load a setup list move sheets up and down to print in any order wished preview plots to ensure correct. You can also just select the DWF file box (instead of the "Plotter named in page setup") to make DWF files of the prints (either one for all or separate files).

 

It's just a very powerful AutoCAD built in tool, and many people seem to not know jack about it.

  • 1 month later...
Posted

I'll take a look, but I am not the only one on this forum :P

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...