Configure an AutoLISP Plotting Command

The plotting function called by a publishing job must be declared with two parameters. The first parameter will be set by Publisher to the output file name during rendering. The second parameter can be used to pass to the function the value of the document property that is selected for the Property based option in the rendering profile described in Configure the Autodesk AutoCAD Rendering Module Options. The function can then implement logic that controls the output, for example, the sheet size.

Note:

The function must not invoke the AutoCAD EXPORT command.

The function should run an AutoCAD command with at least the input responses necessary to produce the desired output file. Providing additional input responses is optional.

The easiest way to determine the necessary input responses is to run the command manually and to record the responses that you type. Then transfer those responses to the function definition.

Following is an example of an AutoLISP function definition that implements the second parameter to retrieve the page size from the property specified by the Property based option. Depending on the value, a different corresponding printer page definition is used. The function then plots the drawing differently if the current tab shows model space or a paper space layout:

(defun PDFPlot (outfile prop)
  (setq pc3 "DWG To PDF.pc3")
  ;Set the paper size
  (setq psize
    (cond
      ((= prop "A4") "ISO expand A4 (210.00 x 297.00 MM)")
      ((= prop "A3") "ISO expand A3 (297.00 x 420.00 MM)")
      ((= prop "A2") "ISO expand A2 (420.00 x 594.00 MM)")
      ((= prop "A1") "ISO expand A1 (594.00 x 841.00 MM)")
      ((= prop "A0") "ISO expand A0 (841.00 x 1189.00 MM)")
      (T "ISO expand A3 (297.00 x 420.00 MM)")
    )
  )
  (setq orientation "L")
  ;Run the plot command
  (if (= (getvar "ctab") "Model")
     (command "-PLOT" "Y" "Model" pc3  psize "M" orientation "N"
       "E" "FIT" "C" "Y" "Monochrome.ctb" "Y" "A" outfile "N" "Y")
     (command "-PLOT" "Y" (getvar "ctab") pc3  psize "M" orientation
       "N" "Layout" "1:1" "0.00,0.00" "Y" "Monochrome.ctb" "Y" "N"
       "N" "N" outfile "N" "Y")
  )
)

2022 R2