Jump to content

Recommended Posts

Posted

This, maybe, by far the easiest routine ever on this forum but I need someone's help to guide me through it.

So basically I changed the settings under Auto Publish to produce PDF on a specified location for me. It simply checks the auto publish, invoke the command by saving the drawing, then unchecks the option.

Does anyone know of a setting variable to change the "pen assignment" similar to "-plot" where you can go deep into the setting. I know there are 12000 posts on this topic and each time someone suggests to plot. In my experience, it takes way too much time to plot 50-90 tabls using this method.

simply by selecting the tabs and going to publish, I get this:

 

image.png.0ba49bb2ac4967839e525d5ef63cc571.png

my question is about the page setup or pen assignment and how to incorporate this on an autopublish routine.

;;;AUTOMATICPUB:
(defun c:PDF (/)
  (setvar "AUTOMATICPUB" 1)
  (command "QSave")
  (setvar "AUTOMATICPUB" 0)
  (princ)
) ;END DEFUN

image.png.9ad5323e4ba42c497e90dfae0f5d8b2b.png

Currently, in my case, I am able to produce a satisfactory result only if the tabs I am working with have been set to correct setting or else it produce a Frankenstien PDF.

Thanks 

Posted

I think you need to copy your page setup across multiple tabs :

 

   https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/apply-page-setup-to-multiple-layouts/td-p/4650781


or across multiple drawings :

 

  https://forums.autodesk.com/t5/autocad-forum/change-default-page-setup-accross-multiple-drawings/td-p/4584017

 

I did write a batch app that does both plot & publish , its constantly under construction but it contains some company specific routines and its getting (too) fat , allmost 8000 lines last time I checked (and I use lines 140 characters wide) so if I would use the standard vlisp formatting the number of lines would probably double haha. But now I think about it , I haven't added the option to publish multiple tabs (rarely use them for most of the time I work with wirering diagrams and loop diagrams) ...mm , think I'm gonna hit the 10.000 lines soon ;-) I can PM the routine but in its current form don't think its wise to post it.

 

Posted

Here is plot pdf layouts by range, have a look I avoid publish, if you have multiple dwgs then probably use publish, the other alternative for me is to use aeccoreconsole with plot layout range.plotA3Pdfrange.lsp

Posted

@BIGAL

@Roy_043

Can you help again guys.

I get it to generate  single PDFs under pdfName variable, but Cannot , for the life of me, get it to work to combine PDF.

I even followed your steps under this post by you in 2015.

 

I just simply want it to combine them under the (getvar 'dwgname) in C:Temp

I am getting my single PDFs from C:Temp/PDF/*.*

 

Could you please help me get this gs.exe to execute. I do have the program installed and the location is correctly mapped.

Thanks

;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;;
;;						 PUBLISH-LIST-LAYOUT-PDF ==> PLOT TABS										    ;;
;;						 LM:FiltListBox          ==> LEE MAC LISTBOX DCL & IGAL AVERBUH							    ;;
;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;;

(defun c:PUBLISH-LIST-LAYOUT-PDF ( / itm lst BACKGROUNDPLT )

   (setq BACKGROUNDPLT (getvar 'BACKGROUNDPLOT))
   (setvar "BACKGROUNDPLOT" 0)
   (setvar 'TRAYTIMEOUT 1)

   (setq lst (LM:FiltListBox "Select Layouts to Plot" (layoutlist) T ))
   (foreach itm lst ;; For every 'itm' in the list given by 'lst'
   (setvar 'LTSCALE 1)
   (setvar 'PSLTSCALE 0)
   (setvar 'CTab itm)
   (setq plotnames '())
   (setq dwgname (GETVAR "dwgname"))

   (setq plotnames (getvar "dwgname"))
   (setq pdfName (strcat "C:\\Temp\\PDF\\"(getvar "Ctab")))  
   (setq plotnames (cons pdfName plotnames))     
   (COMMAND  "-PLOT" "N" "" "" "" pdfName "N" "Y")

   (princ (strcat "\nPlotting Layout \"" itm "\" "  )) 

   ) ;; end foreach
   (setq trgfile (strcat "C:\\Temp\\" dwgname ".pdf"))
   (if (not combinepdf)(load "mergepdfs"))
   (combinepdf gsExe plotnames trgFile )

   (setq plotnames nil
         val1 nil
         val2 nil
   )	 
(princ)
   (if (= (getvar "tilemode") 0) (setvar "tilemode" 1)) ; Go back to MSPACE
                                         
(princ)
) ;END DEDUN


(defun KGA_String_Join (strLst delim)
 (if strLst
   (apply
     'strcat
     (cons
       (car strLst)
       (mapcar '(lambda (a) (strcat delim a)) (cdr strLst))
     )
   )
   ""
 )
) ;END DEFUN
(setq gsexe "C:\\Program Files\\gs\\gs9.50\\bin\\gswin64c.exe")
(defun CombinePdf (gsExe srcFileLst trgFile)
 (startapp
   (strcat
     gsExe " "
     "-dBATCH -dNOPAUSE -dQUIET -sDEVICE=pdfwrite "
     "-sOutputFile=\"" trgFile "\" "
     "\"" (KGA_String_Join srcFileLst "\" \"") "\""
   )
 )
) ;END DEFUN


;;------------------------------------------------------------------------------------------------------------------------------------------------------------------;;
;;									   END OF 										    ;;
;;							          [PUBLISH-LIST-LAYOUT-PDF]									    ;;
;;------------------------------------------------------------------------------------------------------------------------------------------------------------------;;



;;------------------=={ Filtered List Box }==-----------------;;
;;                                                            ;;
;;  Displays a list box interface from which the user may     ;;
;;  select one or more items. Includes an edit box filter     ;;
;;  to enable the user to filter the displayed list of items. ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2013 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  msg - List box dialog title                               ;;
;;  lst - List of strings to display in the list box          ;;
;;  mtp - Boolean flag to determine whether the user may      ;;
;;        select multiple items (T=Allow Multiple)            ;;
;;------------------------------------------------------------;;
;;  Returns:  List of selected items, else nil.               ;;
;;------------------------------------------------------------;;

(defun LM:FiltListBox ( msg lst mtp / _addlist dch dcl des rtn tmp )

   (defun _addlist ( key lst )
       (start_list key)
       (foreach x lst (add_list x))
       (end_list)
       lst
   )

   (if
       (and
           (setq dcl (vl-filename-mktemp nil nil ".dcl"))
           (setq des (open dcl "w"))
           (write-line
               (strcat
                   "filtlistbox : dialog { label = \"" msg "\"; spacer;"
                   ": list_box { key = \"lst\"; width = 50; fixed_width = true; height = 15; fixed_height = true; allow_accept = true; "
                   "multiple_select = " (if mtp "true" "false") "; }"
                   ": edit_box { key = \"flt\"; width = 50; fixed_width = true; label = \"Filter:\"; }"
                   "spacer; ok_cancel; }"
               )
               des
           )
           (not (close des))
           (< 0 (setq dch (load_dialog dcl)))
           (new_dialog "filtlistbox" dch)
       )
       (progn
           (_addlist "lst" (setq tmp lst))
           (set_tile "lst" (setq rtn "0"))
           (set_tile "flt" "*")
           (action_tile "lst" "(setq rtn $value)")
           (action_tile "flt"
               (vl-prin1-to-string
                  '(progn
                       (setq flt (strcat "*" (strcase $value) "*"))
                       (_addlist "lst" (setq tmp (vl-remove-if-not '(lambda ( x ) (wcmatch (strcase x) flt)) lst)))
                       (set_tile "lst" (if (< (atoi rtn) (length tmp)) rtn (setq rtn "0")))
                   )
               )
           )
           (setq rtn
               (if (= 1 (start_dialog))
                   (mapcar '(lambda ( x ) (nth x tmp)) (read (strcat "(" rtn ")")))
               )
           )
       )
   )
   (if (< 0 dch)
       (setq dch (unload_dialog dch))
   )
   (if (and (= 'str (type dcl)) (findfile dcl))
       (vl-file-delete dcl)
   )
   rtn
) ;END LM:FiltListBox

 

 

 

Posted
15 hours ago, BIGAL said:

Do you have the mergepdfs lisp ? mergepdfs.lsp

yeah I got that one but cannot figure out how to combine the files with a list under scrFileLst I think...

@BIGAL

I tried to use (*) to pick them up but I think I have to create a list.

(setq srcFileLst  '("C:\\Temp\\*.pdf"))

could you help please!

Posted (edited)

2 things check mergepdfs and change the Ghostscript path to where you saved it. 

 

The scrfilelst is just that a list of the pdf names you can run Ghostscript manually from command line.

Ok to do manually got to Window bottom left type cmd, this will put you in command mode,

type Cd c:\Temp,

type Dir *.pdf > scrfilelst.txt /b,

open in Notepad and add the "" at start and end easier in word use replace ^p with """"^p

You should be able to run gsexe now manualy look at lisp for command line sequence.

 

You can make the lisp variable and butcher mergepdf to just run gsexe, by add (setq srcfilelst '( as 1st line and ) as last line copy and paste to Autocad and variable list is made.

Edited by BIGAL

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...