mostafa badran Posted September 22, 2013 Share Posted September 22, 2013 hello everybody can someone help me to create lisp to export multiple DWG to separate PDF not by publish command i want to do from lisp Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 23, 2013 Share Posted September 23, 2013 You need 2 things a script and a plot lisp Search here there are lots of examples of plotting routines using lisp for multi layouts etc Search BIGAL + Plotting Quote Link to comment Share on other sites More sharing options...
troggarf Posted September 23, 2013 Share Posted September 23, 2013 Here's a break down to create PDFs using a script and script pro. If you have a lisp routine that already has the printing to PDF set up, you simply need to load it and run it from the script. http://www.cadtutor.net/forum/showthread.php?76974-Up-and-Running-with-the-2013-Core-Console&highlight=scriptpro ~Greg Quote Link to comment Share on other sites More sharing options...
ReMark Posted September 23, 2013 Share Posted September 23, 2013 A quick search turned up three different routines, all in the same thread, at The Swamp for plotting to a PDF via lisp. Quote Link to comment Share on other sites More sharing options...
mostafa badran Posted September 23, 2013 Author Share Posted September 23, 2013 thanks for cooperation I think it's’ difficult matter Quote Link to comment Share on other sites More sharing options...
ReMark Posted September 23, 2013 Share Posted September 23, 2013 I don't necessarily agree with you. Have you tried using "DWG to PDF"+"lisp" as your search criteria? Quote Link to comment Share on other sites More sharing options...
mostafa badran Posted September 24, 2013 Author Share Posted September 24, 2013 ReMark thank you I Will do Quote Link to comment Share on other sites More sharing options...
howiez69 Posted October 3, 2013 Share Posted October 3, 2013 Mostafa, how many DWG are you wanting to print, and how hard/easy is it to get a list of them. Is it always the same set of drawings like a certain project, or will it be dynamic every time? I worked on a project recently where we needed to print several pages of one DWG into one PDF, the opposite of what you want, but maybe our approach will work. We did in fact use the publish routine, I cheated, and wrote a DSD with LSP. You could manually make a publish setup, save that DSD and then modify the code below to write a DSD that does what you need. (defun c:PUBLISH_PDF ( / file ;file name for TEMP.DSD OldFda ;system variable FILEDIA pathtxt ;path where drawing is saved to write TEMP.DSD nosheets ;number of PDF pages to print *error* ;error trap ) ;end variables (vl-load-com) (defun *error* ( msg ) (setvar "FILEDIA" OldFda) ;sets system variable FILEDIA back to original value (setvar "EXPERT" Save_Expert) ;sets system variable EXPERT back to original value (princ "error: ") (princ msg) (princ) ) (setvar "CTAB" "Layout1") ;changes to paperspace and tab named Layout1 (setq OldFda (getvar "FILEDIA")) ;reads current system variable FILEDIA value (setvar "FILEDIA" 0) ;sets FILEDIA to 0 so no dialog boxes popup (setq Save_Expert (getvar "EXPERT")) ;reads current system variable EXPERT value (setvar "EXPERT" 2) ;sets EXPERT to 2 so no dialog boxes popup (command "._-PSETUPIN" "c:\\folder\\template.dwt" "*") ;imports all page setups from drawing template c:\folder\template.dwt (setvar "EXPERT" Save_Expert) ;sets system variable EXPERT back to original value (setq pathtxt (strcat (getvar "dwgprefix") "TEMP.DSD")) ;sets path for DSD file from current drawing saved location (setq file (open (strcat (getvar "dwgprefix") "TEMP.DSD") "w")) ;opens DSD file for writing ;I USED A SELECTION SET HERE TO PICK A BORDER IN PAPERSPACE TO RECOGNIZE HOW MANY PAGES TO PRINT ;YOU'll NEED YOUR WAY OF SELECTING YOUR MULTIPLE DRAWINGS ;**********START OF DSD FILE********** ;**********START HEADER********** (write-line "[DWF6Version]" file) (write-line "Ver=1" file) (write-line "[DWF6MinorVersion]" file) (write-line "MinorVer=1" file) ;**********END OF HEADER********** ;**********START OF LAYOUTS/DWG TO PLOT********** !!!repeat this section for each of your layouts or dwgs to plot (write-line "[DWF6Sheet:PDF Sheet 1]" file) (write-line (strcat "DWG=" (getvar "dwgprefix")(substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4)) ".dwg")file) (write-line "Layout=Layout1" file) ;layout to plot (write-line "Setup=Sheet_1" file) ;page setup name to use (write-line (strcat "OriginalSheetPath=" (strcat(getvar "dwgprefix")(substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4))".dwg") )file) (write-line "Has Plot Port=0" file) (write-line "Has3DDWF=0" file) ;**********END OF 'ONE' LAYOUT TO PLOT********** !!!repeat previous section for each of your layouts or dwgs to plot ;**********START OF DSD FOOTER********** (write-line "[Target]" file) (write-line "Type=6" file) ;change to "TYPE=5" for multiple output files, "TYPE=6" for single output file (write-line (strcat "DWF=" (strcat(getvar "dwgprefix")(substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4))".pdf") )file) (write-line (strcat "OUT="(strcat(getvar "dwgprefix") )) file) (write-line "PWD=" file) ;**********END OF DSD FOOTER********** ;**********END OF DSD FILE********** (close file) ;closes DSD file (command "_.delay" 2000) ;system delay before starting publish command so DSD file closes (command "-Publish" pathtxt ) ;start publish command with TEMP.DSD file just created (setvar "FILEDIA" OldFda) ;sets system variable FILEDIA back to original value (command "_.delay" 2000) ;system delay before deleting TEMP.DSD so publish routine has time to release it (vl-file-delete pathtxt) ;deletes TEMP.DSD file ; (startapp "explorer /e," (getvar "dwgprefix")) ;comment out this line if you don't want file explorer to open with PDF location (princ) );defun Hopefully this will get you pointed in the right direction. I'll be making a post shortly asking how to optimize my code, as my selection set routine(not shown here) is very inefficient. ~HowieZ Quote Link to comment Share on other sites More sharing options...
mostafa badran Posted October 3, 2013 Author Share Posted October 3, 2013 thank you howiez69 I will try the code and tell you about result Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 4, 2013 Share Posted October 4, 2013 Another example http://www.cadtutor.net/forum/showthread.php?69132-Printing-LISP-Help...&highlight=Printing-LISP Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.