Author Topic: Autoplot  (Read 11336 times)

0 Members and 2 Guests are viewing this topic.

Luke

  • Guest
Autoplot
« on: January 11, 2008, 03:18:08 PM »
OK So I'm not asking how to do it...  YET :wink:

But do you think it is possibe to write a , lisp, script, VBA whatever...  that could recognize all of MY title blocks in a drawing.  8-1/2" x 11" and 17" in various scales, all in model space and plot eack one individually on it's own piece of paper?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Autoplot
« Reply #1 on: January 11, 2008, 03:19:21 PM »
Yes.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Luke

  • Guest
Re: Autoplot
« Reply #2 on: January 11, 2008, 03:29:50 PM »
I meant to add, all with the click of 1 button...

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Autoplot
« Reply #3 on: January 11, 2008, 03:33:22 PM »
Yes.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Guest

  • Guest
Re: Autoplot
« Reply #4 on: January 11, 2008, 03:34:54 PM »
I would think it would be kind of easy (if the title blocks are actually blocks).

Just thinking out loud...

Program would search for matching block names, find their position and extents and print based on that information.  If they aren't blocks, I think you'd have a hard time doing this auto-magically.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Autoplot
« Reply #5 on: January 11, 2008, 03:38:41 PM »
I would think it would be kind of easy (if the title blocks are actually blocks).

Just thinking out loud...

Program would search for matching block names, find their position and extents and print based on that information.  If they aren't blocks, I think you'd have a hard time doing this auto-magically.
x2
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Luke

  • Guest
Re: Autoplot
« Reply #6 on: January 11, 2008, 03:46:13 PM »
Yes they are actually blocks.

OK So currently I do some other / different "magic" plotting.  All I do is run a script the does all the plotting from the command line instead of through the onscreen menu.  This only works if there is only 1 title block in the model space or a different script if there is one title block in the Paper space.

When I try that it does not provide an option for plotting by block.

I do not think I want to do it through a VBA routine just because I know nothing about Visual Basic.

So for now I'm thinking I need to do it through a lisp.  Would you say that is correct?

Guest

  • Guest
Re: Autoplot
« Reply #7 on: January 11, 2008, 03:50:08 PM »
You don't actually plot "by block" - you get the coordinates of the block and use that as your window for plotting.

And it would most likely be easier/less code to do it in LSP than VBA.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Autoplot
« Reply #8 on: January 11, 2008, 03:58:01 PM »
Here is a quick starter. You will have to go through your plot options and fill in as necessary as well as modify the ssget filter to the block names you are looking for.

HTH

Code: [Select]
(defun c:pltalot (/ ss bbox name x minpt maxpt)
  (if (setq ss
     (ssget "_x"
    '((0 . "INSERT") (2 . "8.5x11,11x17,22x34") (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))
name (vla-get-name x)
   )
   (cond ((= name "8.5x11")
  (command "-plot" "y" "go through prompts and plot window and use bbox for values". . . . . . .)
)
((= name "11x17")
  (command "-plot" "y" "go through prompts and plot window and use bbox for values". . . . . . .)
)
((= name "22x34")
  (command "-plot" "y" "go through prompts and plot window and use bbox for values". . . . . . .)
)
   )
)
ss
      )
    )
  )
)
« Last Edit: January 11, 2008, 04:04:10 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Luke

  • Guest
Re: Autoplot
« Reply #9 on: January 11, 2008, 04:58:50 PM »
I'll have to mess with it Mon.  Thanks for getting me started.  Much appreciated.

Have agreat weekend

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Autoplot
« Reply #10 on: January 11, 2008, 06:03:05 PM »
You too :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Luke

  • Guest
Re: Autoplot
« Reply #11 on: January 24, 2008, 04:51:36 PM »
I'm not having luck getting it to work.  Can you help.  Red are the items I'm thinking I need to update to match my plot settings and block names, etc.  but I'm not sure if should be updating others or if I should not be changing something I'm changing. 

Also not quite sure what info of mine is suppose to replace "INSERT" "8.5x11,11x17,22x34" "Model"

As is it is giving me the following error...
; error: misplaced dot on input

Code: [Select]
(defun c:pltalot (/ ss bbox name x minpt maxpt)
  (if (setq ss
     (ssget "[color=red]_x[/color]"
    '((0 . "[color=red]INSERT[/color]") (2 . "[color=red]8.5x11,11x17,22x34[/color]") (410 . "[color=red]Model[/color]"))
     )
      )
    (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))
name (vla-get-name x)
   )
   (cond ((= name "[color=red]8.5x11[/color]")
  (command "-plot" "y" "[color=red]go through prompts and plot window and use bbox for values[/color]". . . . . . .)
)
((= name "[color=red]11x17[/color]")
  (command "-plot" "y" "[color=red]go through prompts and plot window and use bbox for values[/color]". . . . . . .)
)
((= name "[color=red]22x34[/color]")
  (command "-plot" "y" "[color=red]go through prompts and plot window and use bbox for values[/color]". . . . . . .)
)
   )
)
ss
      )
    )
  )
)
Posted on: January 11, 2008, 03:50:08 pmPosted by: Matt W 
Insert Quote
You don't actually plot "by block" - you get the coordinates of the block and use that as your window for 

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Autoplot
« Reply #12 on: January 24, 2008, 05:04:18 PM »
See below:

Code: [Select]
(defun c:pltalot (/ ss bbox name x minpt maxpt)
  (if (setq ss
     (ssget "_x"
    '((0 . "INSERT") (2 . "8.5x11,11x17,22x34") (410 . "Model"));;name of your different size titleblocks separated by commas (2 . "
     )
      )
    (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))
name (vla-get-name x)
   )
   (cond ((= name "8.5x11")
  (command "-plot" "y" "model" "printer" "papersize" "inches\mm" "portrait\lanscape");;see below for typical prompts when using -plot
)
((= name "11x17")
  (command "-plot" "y" "go through prompts and plot window and use bbox for values")
)
((= name "22x34")
  (command "-plot" "y" "go through prompts and plot window and use bbox for values")
)
   )
)
ss
      )
    )
  )
)
;;;Command: -plot
;;;Detailed plot configuration? [Yes/No] <No>: y
;;;Enter a layout name or [?] <Model>:
;;;Enter an output device name or [?] <\\aqua-srv01\HP LaserJet 5Si PCL 5e>:
;;;Enter paper size or [?] <Letter>:
;;;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] <Display>:
;;;Enter plot scale (Plotted Inches=Drawing Units) or [Fit] <Fit>:
;;;Enter plot offset (x,y) or [Center] <0.00,0.00>:
;;;Plot with plot styles? [Yes/No] <Yes>:
;;;Enter plot style table name or [?] (enter . for none) <>:
;;;Plot with lineweights? [Yes/No] <Yes>:
;;;Enter shade plot setting [As displayed/Wireframe/Hidden/Visual styles/Rendered]
;;;<As displayed>:
;;;Write the plot to a file [Yes/No] <N>:
;;;Save changes to page setup [Yes/No]? <N>
;;;Proceed with plot [Yes/No] <Y>:
;;;Effective plotting area:  4.82 wide by 10.48 high

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Luke

  • Guest
Re: Autoplot
« Reply #13 on: January 24, 2008, 05:11:32 PM »
Are you saying I don't need to modify any of the code at the beginning? 

Yes I'm pretty sure I understand the plot command portion.  I'm already doing that in other applications.  Only works for a single title block in model space or a single per paper tab.  But much more efficient than going through the plot command on screen.


ronjonp

  • Needs a day job
  • Posts: 7529
Re: Autoplot
« Reply #14 on: January 24, 2008, 05:16:05 PM »
Can you post a sample DWG?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC