Author Topic: plotting lisp  (Read 21667 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
plotting lisp
« Reply #30 on: December 08, 2003, 11:55:55 AM »
hey guys i just encountered the problem too when printing an old job which used a different printer. :cry: keep me informed on the updates thanks

dan

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
plotting lisp
« Reply #31 on: December 08, 2003, 12:45:32 PM »
Daron,

In this code pslayout = LayoutObj



Code: [Select]
   (setq
      curdwg   (vla-get-ActiveDocument (vlax-get-Acad-Object))
      pslayout (vla-get-Layout (vla-get-PaperSpace curdwg))
    )
 ; Call RefreshPlotDeviceInfo before GetPlotDeviceNames
    (vla-RefreshPlotDeviceInfo pslayout)
    (setq sty (vlax-safearray->list
      (vlax-variant-value (vla-GetPlotStyleTableNames pslayout))
    ))

    (setq cfg (vlax-safearray->list
      (vlax-variant-value (vla-Get-PlotConfigurations pslayout))
    ))


Code: [Select]
LayoutObj = #<VLA-OBJECT IAcadLayout 069c7a2c>
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
plotting lisp
« Reply #32 on: December 10, 2003, 05:05:44 PM »
Well I found the answer,
Stole this code today, :D

It sets all layouts in the drawing to a "page setup" entered by the user.
I'm going to modify to allow some sort of pick list, I guess that would have to be dcl dialog box or
a numbered list displayed on the text screen to pick from.
Anyone have a "Text Screen" pick list routine?

CAB

Code: [Select]
(defun c:psetup (/ lst page res)
 (setq lst (mapcar 'strcase (getPagesetups)))
 (while (not page)
  (setq page (strcase (getstring T "\nspecify pagesetup to apply: ")))
  (if (or (= "" page) (not (member page lst)))
   (progn (princ "\npagesetup not found") (setq page nil))
   )
  )


 (initget "All Current")
 (if
  (not
   (setq
    res
    (getkword
     "\n[All/Current]apply pagesestup to which layout(s) : ")))
  (setq res "All")
  )


 (if (= "All" res)
   ; ignore Model Space
  (foreach x (vl-remove "Model" (layoutlist)) (putPagesetup x page))
  ;(foreach x (layoutlist) (putPagesetup x page)) ; Include Model Space
  (putPagesetup (getvar "ctab") page)
  )
 (princ "\nFinished")
 (princ)
 )



; Jason Piercey . May 16th, 2003
; assign a pagesetup to a layout
; [layout] - string, layout name
; [setup] - string, pagesetup to assign
; return: T or nil
(defun putPagesetup (layout setup / layouts plots)
 (defun item-p (collection item)
  (if
   (not
    (vl-catch-all-error-p
     (vl-catch-all-apply
      '(lambda () (setq item (vla-item collection item))))))
   item
   )
  )
 (and
  (or *acad* (setq *acad* (vlax-get-acad-object)))
  (or *doc* (setq *doc* (vla-get-activedocument *acad*)))
  (setq layouts (vla-get-layouts *doc*))
  (setq plots (vla-get-plotconfigurations *doc*))
  (setq layout (item-p layouts layout))
  (setq setup (item-p plots setup))
  (not (vla-copyfrom layout setup))
  )
 )


(defun massoc (key alist / x nlist)
 (foreach x alist
  (if (eq key (car x))
   (setq nlist (cons (cdr x) nlist))
   )
  )
 (reverse nlist)
 )

; Return: list of all pagesetups defined in the current drawing or nil
(defun getPagesetups ()
 (massoc 3 (dictsearch (namedobjdict) "Acad_PlotSettings"))
 )

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: plotting lisp
« Reply #33 on: February 28, 2006, 03:27:26 PM »
Hey CAB,

Did you ever set up this routine with a dialogue to pick the pagesetups from?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: plotting lisp
« Reply #34 on: February 28, 2006, 03:55:29 PM »
If you mean "Import Page Set Up" from another drawing,
then NO. 8-)
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: plotting lisp
« Reply #35 on: February 28, 2006, 04:00:31 PM »
Not from other drawings. Just a pick list to set all tabs to a certain pagesetup. Kinda like the one in your plottabs routine minus the plotting part.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: plotting lisp
« Reply #36 on: February 28, 2006, 06:55:15 PM »
No but I threw this together.
Needs testing. :-)

Code removed, see update in another post.
« Last Edit: February 28, 2006, 10:40:41 PM 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.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: plotting lisp
« Reply #37 on: February 28, 2006, 07:10:29 PM »
No but I threw this together.
Needs testing. :-)

Seemed to work on my one drawing.  Only one layout, but it copied it over.  The only problem I had was that my titles were too long to see.
Tim

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

Please think about donating if this post helped you.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: plotting lisp
« Reply #38 on: February 28, 2006, 07:13:40 PM »
No but I threw this together.
Needs testing. :-)

bloody amazing ! , your attitude.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: plotting lisp
« Reply #39 on: February 28, 2006, 07:21:42 PM »
Updated the DCL file with wider list boxes.
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: plotting lisp
« Reply #40 on: February 28, 2006, 07:30:02 PM »
No but I threw this together.
Needs testing. :-)

bloody amazing ! , your attitude.
You'll have to clarify, I'm slow at times.
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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: plotting lisp
« Reply #41 on: February 28, 2006, 07:43:06 PM »
expressing my admiration for how helpfull you are. !
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: plotting lisp
« Reply #42 on: February 28, 2006, 07:54:04 PM »
Well thank you sir.
I love to write code & play tennis.
Neither of which I do that well compared to the talent I see here & there.
But I do it for me so that's ok. So i do it every chance I get. :-)
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: plotting lisp
« Reply #43 on: February 28, 2006, 10:47:58 PM »
The updated code is Here
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: plotting lisp
« Reply #44 on: March 01, 2006, 06:07:14 PM »
Not from other drawings. Just a pick list to set all tabs to a certain pagesetup. Kinda like the one in your plottabs routine minus the plotting part.
ron
is that what you were looking for?
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.