Plotting to PDF and Programmatically Removing the Suffix "-Model"
Your suggestions are appreciated on programmatically removing the suffix "-Model" when plotting to a PDF file via script or LISP.
0
Comments
-
Explain more. Are you plotting layouts or Model ? Lots of plot layout lips out there.0
-
Hello.
The "model" suffix is attached to the output file name only when the publishing mechanism is used.
There is no setting to automatically remove the suffix.
This suffix is used to diferentiate various layout names.
If you are interested in plotting to PDF with using lisp, here is a link to an article that might be a good start point.
https://hyperpics.blogs.com/beyond_the_ui/2012/06/plotting-and-page-setups-with-autolisp.html
And, of course, there are many others.
An alternative would be to use the standard publishing mechanism and then rename the files.
For renaming, if you are accustomed with using Windows scripting (PowerShell, Batch script, VB script), you could do it this way.
Or, you could use an application that does the renaming.
Below is a link to a website with such an application.
I am not sure it is free to use, you should check this.
https://www.advancedrenamer.com/
0 -
Alan,
As you know, this request finds me now within the "80's" era model space only paradigm. I LOVE and have used layouts. Changing other's mindsets and workflows will be nearly impossible. Thanks!
Virgil,
I will check out the link to PDF creation via LISP. Thanks again!0 -
You can use the PLOT command to print to PDF in doing so you can name the print file whatever you like. To see the command line version of this command use -PLOT.
Here's an example that will prints a layout to a folder relative to the current drawing. The PrintName variable is where I've set the print filename.; Print Relative ; Sets BricsCAD's Print Output Folder to be relative to the current drawing folder (defun C:PrintRelative ( / SubFolder PrintFolder PrintName flag FullPrintName filenm) (setq SubFolder "PDF") ; define the subfolder. Set to "" if you prefer to use the current .dwg folder (setq PrintFolder (strcat (getvar 'DWGPREFIX) subfolder)) ; define the print folder we want to use (setq PrintName (strcat (vl-filename-base (getvar 'DWGNAME)) "-" (getvar 'CTAB))) ; Set the name for the print ; Check our chosen folder exists (cond ((not (vl-file-directory-p printfolder)) ; If the folder doesn't exist (setq flag (vl-mkdir printfolder)) ; Create it. Flag will be set to T if successful ) (T (setq flag T)) ; Folder already exists ) ; Tell the user where we are printing (cond (flag (princ (strcat "\nPrinting to: " printfolder))) ; Use chosen folder (T (princ (strcat "\nCouldn't set Print folder to: " PrintFolder " Printing to: " (setq PrintFolder (getvar 'PlotOutputPath)) ))) ; alternate folder ) (setq FullPrintName (strcat PrintFolder "\\" PrintName)) ; Set the folder and filename (setq flag nil) ; re-initialse our flag ; BricsCAD doesn't respect EXPERT for printing, so need to check whether the print already exists and attempt to delete ourselves (cond ((setq filenm (findfile (strcat FullPrintName ".pdf"))) ; if the print file already exists (setq flag (vl-file-delete filenm)) ; then attempt to delete. Flag will be set to T if successful ) (T (setq flag T)) ; File doesn't exist ) ; Proceed with Printing provided its ok to do so. (cond (flag (command "._PLOT" "_No" "" "" "Print As PDF.pc3" FullPrintName "_No" "_Yes")) (T (princ (strcat "\nCouldn't print: \"" PrintName ".pdf\" Check if the file is currently OPEN"))) ; i.e. check if the file is currently open in your PDF viewer! ) (prin1) )
Regards,
Jason Bourhill
BricsCAD V24 Ultimate
CAD Concepts0 -
I used to make the pdf directory under the current dwg directory, then use ghostscript to join multiple pdf's back into 1. The joining was done using lisp.
Re plotting from model if you have title blocks can plot all in one go, by reading the title size and scale etc.
Plenty of examples out there.0 -
The PUBLISH command provides this same functionality.ALANH said:I used to make the pdf directory under the current dwg directory, then use ghostscript to join multiple pdf's back into 1. The joining was done using lisp.
Regards,
Jason Bourhill
BricsCAD V24 Ultimate
CAD Concepts
0 -
Jason understand but click one button on a menu by any user and plots are done no user input required. Someone has to make the publish definition, think worst cad user in your organisation and how they could stuff it up, we also always had only 1 dwg, yes publish has advantage when multiple DWGS.
A side comment had a dwg, standard details some 50 layouts. Would do a publish of that dwg and would just do screwy stuff like plot a sheet upside down, move left etc. Spent a lot of time trying to work out why. Gave up lisp works 100% every time.
My PlotPDFA3range allows you to plot only a single or a range of layouts handy when revisions are made and only need those sheets. Easier than plot plot plot or edit a Publish list.0