<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Help with Lisp for plotting in PDF in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020503#M9070</link>
    <description>&lt;P&gt;I think we need we need to wait for elias to comment about why not using true sheet sizes and Mview to scale objects in say "Model" the intention of using layouts. Otherwise why not just use plot extents to one known sheet size.&lt;/P&gt;</description>
    <pubDate>Sat, 14 Sep 2024 05:28:01 GMT</pubDate>
    <dc:creator>Sea-Haven</dc:creator>
    <dc:date>2024-09-14T05:28:01Z</dc:date>
    <item>
      <title>Help with Lisp for plotting in PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020195#M9066</link>
      <description>&lt;P&gt;Hi everyone!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try to write a lisp that does the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;asks the user to select the opposite corners of a window in the layout space&lt;/LI&gt;&lt;LI&gt;uses these coordinates to calculate the size of the paper needed to plot (x and y)&lt;/LI&gt;&lt;LI&gt;depending on the size it chooses between some already existing paper sizes (eg 1000x1000 in this case)&lt;/LI&gt;&lt;LI&gt;plots (preview) the selected window in the paper&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Unfortunately it doesn't work for some reason.. Can anyone help me in this? Is it a syntax error? Is it about the type (float) of the variables? Something else?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(DEFUN C:PDF (/ x1 x2 y1 y2 x y p1 p2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;;get the coordinates of the 2 opposite corners of the window&lt;BR /&gt;(setq p1 (getpoint "\nPick first corner of window: \n"))&lt;BR /&gt;(setq p2 (getcorner p1 "\nPick opposite corner of window: \n"))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;;isolate x and y coordinates&lt;/P&gt;&lt;P&gt;(setq x1 (float(car p1)))&lt;BR /&gt;(setq y1 (float(cadr p1)))&lt;BR /&gt;(setq x2 (float(car p2)))&lt;BR /&gt;(setq y2 (float(cadr p2)))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;;calculate paper size needed&lt;/P&gt;&lt;P&gt;(setq x (- x2 x1))&lt;BR /&gt;(setq y (- y2 y1))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;;if lets say x=1000mm plot preview in paper size 1000x1000 (etc)&lt;/P&gt;&lt;P&gt;(IF (= x 1000.0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(COMMAND "-PAGESETUP" "AutoCAD PDF (High Quality Print).pc3" "User 1 (1000.00 x 1000.00 MM)" "M" "P" "N" "W" p1 p2 "1=1" "C" "Y" "acad.ctb" "Y" "N" "N" "N")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;(COMMAND "PREVIEW")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;); end IF&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;);end DEFUN&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2024 22:32:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020195#M9066</guid>
      <dc:creator>elias.kanellakis</dc:creator>
      <dc:date>2024-09-13T22:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Lisp for plotting in PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020207#M9067</link>
      <description>&lt;P&gt;For me it fails since I don't have this custom paper size:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;User 1 (1000.00 x 1000.00 MM)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also I assume after creating the pagesetup you want to run plot preview then you need to change this from:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(IF (= x 1000.0)
(COMMAND "-PAGESETUP" "AutoCAD PDF (High Quality Print).pc3" "User 1 (1000.00 x 1000.00 MM)" "M" "P" "N" "W" p1 p2 "1=1" "C" "Y" "acad.ctb" "Y" "N" "N" "N")
(COMMAND "PREVIEW")
); end IF&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;To this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(if (= x 1000.0)
 (progn ; if condition is true then
  (COMMAND "_.-PAGESETUP" "AutoCAD PDF (High Quality Print).pc3" "User 1 (1000.00 x 1000.00 MM)" "_M" "_P" "_N" "_W" p1 p2 "1=1" "_C" "_Y" "acad.ctb" "_Y" "_N" "_N" "_N")
  (COMMAND "_.PREVIEW")
 ) ; progn
 (alert "X is not equal to 1000") ; if condition is false else
); end if&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 13 Sep 2024 22:45:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020207#M9067</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2024-09-13T22:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Lisp for plotting in PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020376#M9068</link>
      <description>&lt;P&gt;Why are you not using true paper sizes and matching Title blocks, A 1000x1000 is not a normal size, A0 is close 1189x841. Your plotting to pdf but I don't think there is a general Plotter with a 1000+ wide roll could be wrong.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is plenty of lisp examples about match title block and plot to pdf at true 1:1 scale. I have one that looks at each title block in a layout and they can be different sizes and or orientation, portrait or landscape. For me just click on a menu button and watch the sheets being produced.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2024 02:14:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020376#M9068</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-09-14T02:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Lisp for plotting in PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020451#M9069</link>
      <description>&lt;P&gt;Since there's no lisp method I know of that makes it possible for the user to create a custom paper size in the pc3 on the fly and the &lt;STRONG&gt;pagesetup&lt;/STRONG&gt; command requires an already created paper size to successfully complete a pagesetup, what &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12613952"&gt;@elias.kanellakis&lt;/a&gt;&amp;nbsp;wants to do in selecting a window to create a &lt;STRONG&gt;pagesetup&lt;/STRONG&gt; on the fly fails.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But a workaround could be to look for the closes standard&amp;nbsp;&lt;STRONG&gt;portrait A size&lt;/STRONG&gt;&amp;nbsp;paper (since the pagesetup in the code is for portrait) that will accommodate.&lt;/P&gt;&lt;P&gt;Then if found complete the &lt;STRONG&gt;pagesetup&lt;/STRONG&gt; else alert the user:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; PDF prompts user to select window to calculate paper size for page setup
; OP:
; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020195/highlight/false#M471647
(DEFUN C:PDF (/ x1 x2 y1 y2 x y p1 p2 pprsiz)
;get the coordinates of the 2 opposite corners of the window
(setq p1 (getpoint "\nPick first corner of window: \n"))
(setq p2 (getcorner p1 "\nPick opposite corner of window: \n"))
;isolate x and y coordinates
(setq x1 (float(car p1)))
(setq y1 (float(cadr p1)))
(setq x2 (float(car p2)))
(setq y2 (float(cadr p2)))
;calculate paper size needed
(setq x (- x2 x1))
(setq y (- y2 y1))
(if (&amp;lt;= x y) (setq x y)(setq y x)) ; find larger size
(cond ; find portrait standard full bleed A size sheets that fit
 ((&amp;lt;= x 210)(setq pprsiz "ISO full bleed A4 (210.00 x 297.00 MM)"))
 ((&amp;lt;= x 297)(setq pprsiz "ISO full bleed A3 (297.00 x 420.00 MM)"))
 ((&amp;lt;= x 420)(setq pprsiz "ISO full bleed A2 (420.00 x 594.00 MM)"))
 ((&amp;lt;= x 594)(setq pprsiz "ISO full bleed A1 (594.00 x 841.00 MM)"))
 ((&amp;lt;= x 841)(setq pprsiz "ISO full bleed A0 (841.00 x 1189.00 MM)"))
 (t (setq x nil))
)
(if x ; if matches found for standard A portrait paper size 
 (progn ; then condition is true 
  (COMMAND "_.-PAGESETUP" "AutoCAD PDF (High Quality Print).pc3" pprsiz "_M" "_P" "_N" "_W" p1 p2 "1=1" "_C" "_Y" "acad.ctb" "_Y" "_N" "_N" "_N")
  (COMMAND "_.PREVIEW")
 ) ; progn
 (alert (strcat "Not Supported for Larger than standard A Paper Size of: " (rtos y 2 2))) ; else condition is false
); end if
(princ)
) ; defun&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2024 04:10:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020451#M9069</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2024-09-14T04:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Lisp for plotting in PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020503#M9070</link>
      <description>&lt;P&gt;I think we need we need to wait for elias to comment about why not using true sheet sizes and Mview to scale objects in say "Model" the intention of using layouts. Otherwise why not just use plot extents to one known sheet size.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2024 05:28:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020503#M9070</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-09-14T05:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Lisp for plotting in PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020774#M9071</link>
      <description>&lt;P&gt;Hi, thanx for the replies&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, 1000x1000 paper is just for example, I don't want to actually plot this size.. But I want to be able to plot in different custom paper sizes each time (not just the standard A0, A1, etc.) without entering the pagesetup window..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will have ALREADY CREATED let's say 20-30 custom paper sizes (e.g. 300x400, 350x400, 400x450, ... , 1000x1000 ec).. I want the lisp to compare the size of the rectangular window I select to these paper sizes and decides which one is the most suitable (with an if-else function) ... Let's say it calculates x=360mm and y=460mm, so it plots in the 400x500 paper that already exists in my computer..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2024 10:45:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020774#M9071</guid>
      <dc:creator>elias.kanellakis</dc:creator>
      <dc:date>2024-09-14T10:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Lisp for plotting in PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020782#M9072</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;yes something like this, I will just have the custom papers already created (let's say 20 - 30 different sizes) and let the lisp find the wright one..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This should work, i 'll thest it later..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanx :))&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2024 10:50:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020782#M9072</guid>
      <dc:creator>elias.kanellakis</dc:creator>
      <dc:date>2024-09-14T10:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Lisp for plotting in PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020818#M9073</link>
      <description>&lt;P&gt;Glad to have helped….cheers!!!&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2024 11:23:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020818#M9073</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2024-09-14T11:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Lisp for plotting in PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020876#M9074</link>
      <description>&lt;P&gt;I would instead use page setups. With page setup one can define any printing property he likes. If there is no defined paper size, use print server properties to define non standard dimension. Assign name to print setup with the name of output pdf file and that's it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun c:batch_plot_pdf_modelspace ( / )
	(vlax-for item (vla-get-plotconfigurations (vla-get-ActiveDocument (vlax-get-acad-object)))
		(if (not(wcmatch (vla-get-name item) "*Model*"))
			(vl-cmdf
				"_.-plot" 
				"No"
				"Model"
				(vla-get-Name item)
				(vla-get-ConfigName item)
				(strcat (getvar 'dwgprefix) (vla-get-Name item) ".pdf")
				"No"
				"Yes"
			)
		)
	)
	(princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2024 12:43:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-for-plotting-in-pdf/m-p/13020876#M9074</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2024-09-14T12:43:41Z</dc:date>
    </item>
  </channel>
</rss>

