Author Topic: Autoplot  (Read 11307 times)

0 Members and 1 Guest are viewing this topic.

Luke

  • Guest
Re: Autoplot
« Reply #15 on: January 24, 2008, 05:27:01 PM »
Try this...

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Autoplot
« Reply #16 on: January 24, 2008, 05:29:02 PM »
Alright...try this one :)

The line (2 . "LCC_BRD_LANDSCAPE_*") is filtering out blocks that have a name LCC_BRD_LANDSCAPE_ and the asterisk is a wildcard to grab either 11x17 or 8.5x11.

Code: [Select]
(defun c:pltalot (/ ss bbox name x minpt maxpt)
  (if (setq ss
     (ssget "_x"
    '((0 . "INSERT")
      (2 . "LCC_BRD_LANDSCAPE_*")
      (410 . "Model")
     )
     )
      )
    (progn
      (setq
ss (mapcar 'vlax-ename->vla-object
   (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
   )
      )
      (mapcar
'(lambda (x)
   (setq bbox (vla-getboundingbox x 'minpt 'maxpt)
bbox (mapcar 'vlax-safearray->list (list minpt maxpt))
   )
   (command "-plot"
    "yes"
    "model"
    "Dell Laser Printer 1710"
    "Letter 8 ½ x 11 in"
    "inches"
    "landscape"
    "no"
    "window"
    (car bbox)
    (cadr bbox)
    "fit"
    "center"
    "yes"
    "monochrome.ctb"
    "yes"
    "as"
    "no"
    "yes"
    "yes"
   )
)
ss
      )
    )
  )
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Autoplot
« Reply #17 on: January 25, 2008, 12:53:35 AM »
This is untested code to show an example.
Code: [Select]
(defun c:pltalot (/ ss bbox name x minpt maxpt)
  (if (setq ss
             (ssget "_x"
                    '((0 . "INSERT") (2 . "LCC_BRD_LANDSCAPE_*") (410 . "Model"))
             )
      )
    (progn
      (setq lst (mapcar 'vlax-ename->vla-object
                        (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
                )
      )
      (foreach tb lst
        (setq bname (cdr (assoc 2 (entget tb))))
        (setq bbox (vla-getboundingbox x 'minpt 'maxpt)
              bbox (mapcar 'vlax-safearray->list (list minpt maxpt))
        )
        (cond
          ((wcmatch bname "*8?11")(goplot "DELL1710_0811_L" bbox)
          ((wcmatch bname "*11?17") (goplot "HP5000_1117_L" bbox))
        )
      )
    )
  )
  (princ)
)



   
(defun goplot (pname box)
  (cond
    ((= pname "DELL1710_0811_L")
     ;; AUTOPLOT_"Model"_DELL1710_0811_L.scr
     (command "-plot"
                    ;Detailed plot configuration? [Yes/No]
              "Yes"
                    ;Enter a layout name or [?]
              "Model"
                    ;Enter an output device name or [?]
              "Dell Laser Printer 1710"
                    ;Enter paper size or [?]
              "Letter 8 ½ x 11 in"
                    ;Enter paper units ["Inches"/Millimeters]
              "Inches"
                    ;Enter drawing orientation [Portrait/Landscape]
              "landscape"
                    ;Plot upside down? [Yes/No]
              "No"
                    ;Enter plot area [Display/"Extents"/Limits/View/Window]
              "window"
              (car box)
              (cadr box)
                    ;Enter plot scale (Plotted "Inches"=Drawing Units) or ["Fit"]
              "Fit"
                    ;Enter plot offset (x,y) or ["Center"]
              "Center"
                    ;Plot with plot styles? [Yes/No]
              "Yes"
                    ;Enter plot style table name or [?]
              "monochrome.ctb"
                    ;Plot with lineweights? [Yes/No]
              "Yes"
                    ;Enter shade plot setting ["As" displayed/Wireframe/Hidden/Rendered]
              "As"
                    ;Write the plot to a file [Yes/No]
              "No"
                    ;Save changes to page setup [Yes/No]
              "Yes"
                    ;Proceed with plot [Yes/No]
              "Yes"
     )
    )


    ((= pname "HP5000_1117_L")
     ;; AUTOPLOT_PAPER_HP5000_1117_L.scr
     (command "-plot"
                    ;Detailed plot configuration? [Yes/No]
              "Yes"
                    ;Enter a layout name or [?]
              ""
                    ;Enter an output device name or [?]
              "HP LaserJet 5000 Series PCL 6"
                    ;Enter paper size or [?]
              "11 x 17"
                    ;Enter paper units ["Inches"/Millimeters]
              "Inches"
                    ;Enter drawing orientation [Portrait/Landscape]
              "landscape"
                    ;Plot upside down? [Yes/No]
              "No"
                    ;Enter plot area [Display/"Extents"/Limits/View/Window]
              "window"
              (car box)
              (cadr box)
                    ;Enter plot scale (Plotted "Inches"=Drawing Units) or ["Fit"]
              "Fit"
                    ;Enter plot offset (x,y) or ["Center"]
              "Center"
                    ;Plot with plot styles? [Yes/No]
              "Yes"
                    ;Enter plot style table name or [?]
              "monochrome.ctb"
                    ;Plot with lineweights? [Yes/No]
              "Yes"
                    ;Scale lineweights with plot scale? [Yes/No]
              "No"
                    ;Plot paper space first? [Yes/No]
              "Yes"
                    ;Hide paperspace objects? [Yes/No]
              "No"
                    ;Write the plot to a file [Yes/No]
              "No"
                    ;Save changes to page setup [Yes/No]
              "Yes"
                    ;Proceed with plot [Yes/No]
              "Yes"
     )
    )

    ((= pname "PAPER_PDF_1117_L")
     ;; AUTOPLOT_PAPER_PDF_1117_L.scr
     (command "-plot"
                    ;Detailed plot configuration? [Yes/No]
              "Yes"
                    ;Enter a layout name or [?]
              ""
                    ;Enter an output device name or [?]
              "Adobe PDF"
                    ;Enter paper size or [?]
              "Tabloid"
                    ;Enter paper units ["Inches"/Millimeters]
              "Inches"
                    ;Enter drawing orientation [Portrait/Landscape]
              "landscape"
                    ;Plot upside down? [Yes/No]
              "No"
                    ;Enter plot area [Display/"Extents"/Limits/View/Window]
              "window"
              (car box)
              (cadr box)
                    ;Enter plot scale (Plotted "Inches"=Drawing Units) or ["Fit"]
              "Fit"
                    ;Enter plot offset (x,y) or ["Center"]
              "Center"
                    ;Plot with plot styles? [Yes/No]
              "Yes"
                    ;Enter plot style table name or [?]
              "monochrome.ctb"
                    ;Plot with lineweights? [Yes/No]
              "Yes"
                    ;Scale lineweights with plot scale? [Yes/No]
              "No"
                    ;Plot paper space first? [Yes/No]
              "Yes"
                    ;Hide paperspace objects? [Yes/No]
              "No"
                    ;Write the plot to a file [Yes/No]
              "No"
                    ;Save changes to page setup [Yes/No]
              "Yes"
                    ;Proceed with plot [Yes/No]
              "Yes"
     )
    )
  )
)
« Last Edit: January 25, 2008, 08:37:21 AM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Luke

  • Guest
Re: Autoplot
« Reply #18 on: January 25, 2008, 08:02:05 AM »
The shorter version from Ron worked perfectly.  Thank you!  Greatly appreciated.  I'm slammed with getting jobs to the shop this morning but will likely return to this post.  Thanks to all!

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Autoplot
« Reply #19 on: January 25, 2008, 08:38:13 AM »
Revised codes above, Made a correction in variable spelling.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Autoplot
« Reply #20 on: January 25, 2008, 09:23:04 AM »
The shorter version from Ron worked perfectly.  Thank you!  Greatly appreciated.  I'm slammed with getting jobs to the shop this morning but will likely return to this post.  Thanks to all!

Glad it worked for you :)...I tested it a bit after posting and could not get it to work on my end. :?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Luke

  • Guest
Re: Autoplot
« Reply #21 on: January 25, 2008, 09:31:55 AM »
I don't think I changed anything to make it work for me

Luke

  • Guest
Re: Autoplot
« Reply #22 on: January 28, 2008, 10:13:04 AM »
OK So I've made it work, different code different commands for each printer I want to possibly send to.  They have all been Model space. 

So now I'm wanting to do the same for Layout Tabs.  when my code asks for ... Enter a layout name or [?] is there a way just to tell it to print all layout tabs.  Difficulty I'm running into is that there is no consistent naming and an * does not seem to do it.

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Autoplot
« Reply #23 on: January 28, 2008, 10:22:29 AM »
CAB has a perfect app for what you want. All you will need to do is make some page setups to work with it.

http://www.theswamp.org/index.php?topic=1916.0

Here is the code above modified to plot paper space tabs:

*modified to plot tabname instead of model


Code: [Select]
(defun c:pltalot (/ ss bbox name x minpt maxpt tabname)
  (if (setq ss
     (ssget "_x"
    '((0 . "INSERT")
      (2 . "LCC_BRD_LANDSCAPE_*")
      (-4 . "<NOT")
      (410 . "Model")
      (-4 . "NOT>")
     )
     )
      )
    (progn
      (setq
ss (mapcar 'vlax-ename->vla-object
   (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
   )
      )
      (mapcar
'(lambda (x)
   (setq tabname
  (cdr (assoc 410 (entget (vlax-vla-object->ename x))))
   )
   (setvar 'ctab tabname)
   (setq bbox (vla-getboundingbox x 'minpt 'maxpt)
bbox (mapcar 'vlax-safearray->list (list minpt maxpt))
   )
   (command "-plot"
    "yes"
    tabname
    "Dell Laser Printer 1710"
    "Letter 8 ½ x 11 in"
    "inches"
    "landscape"
    "no"
    "window"
    (car bbox)
    (cadr bbox)
    "fit"
    "center"
    "yes"
    "monochrome.ctb"
    "yes"
    "as"
    "no"
    "yes"
    "yes"
   )
)
ss
      )
    )
  )
)
« Last Edit: January 28, 2008, 10:58:41 AM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Autoplot
« Reply #24 on: January 28, 2008, 10:47:17 AM »
Thanks Ron.
One thing my routine does not provide is a way to plot each tab with a different page set up for each one. Unless the Tabs are already set & you use PREVIOUS as the page set up.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Luke

  • Guest
Re: Autoplot
« Reply #25 on: January 28, 2008, 11:26:20 AM »
I do not need to plot different settings or different printers per tab.  At least not all in the same process.  May need to send all to big printer today and then send them all to PDF tomorrow.  But never some to laser and some to PDF at sam time so it will work for me.  Not sure about for others.

Ron,
Thanks!!!  This is awesome.  Code required a little tweaking to get through the plot inputs.  See changes in red... and even these changes might need changed depending on how you want your drawing to plot...

basically the few lines below the plot style input

Code: [Select]
(command "-plot"
    "yes"
    tabname
    "Dell Laser Printer 1710"
    "Letter 8 ½ x 11 in"
    "inches"
    "landscape"
    "no"
    "window"
    (car bbox)
    (cadr bbox)
    "fit"
    "center"
    "yes"
    "monochrome.ctb"
    [color=red]"yes"
    "no"
    "yes"
    "no"
    "no"
                    "yes"
                    "yes"[/color]

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Autoplot
« Reply #26 on: January 28, 2008, 11:36:18 AM »
Glad to help :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Luke

  • Guest
Re: Autoplot
« Reply #27 on: February 06, 2008, 01:50:41 PM »
Can you help me with how to make it so that I can window pick what all borders I want to plot?
« Last Edit: February 08, 2008, 09:45:46 AM by Luke »

rhino

  • Guest
Re: Autoplot
« Reply #28 on: March 25, 2009, 11:50:36 AM »
Luke

Can you help me with how to make it so that I can window pick what all borders I want to plot?

If you still need an option window select and plot - take a look at this:

http://www.theswamp.org/index.php?topic=27682.msg332354#msg332354

Luke

  • Guest
Re: Autoplot
« Reply #29 on: September 09, 2009, 02:29:15 PM »
OK so you guys all helped me with this previously.  Greatly appreciated.

Now I'm working on getting everything setup to work for 2010.

My support patha are all  looking for the correct folders.
I have apploaded the lisp.

but when I try to plot I get the following on the command line...
Quote
; error: no function definition: nil

Can anybody help trouble shoot