Author Topic: pagesetup lisp  (Read 15005 times)

0 Members and 1 Guest are viewing this topic.

dubb

  • Swamp Rat
  • Posts: 1105
pagesetup lisp
« on: November 04, 2004, 01:27:57 PM »
i have copied somebody elses's stuff but i modified it. tell me what you think. im a total noOb, please bear with me. this a lisp routine that will import pagesetups from a file. if i new more i would make it so that it doesnt have to reference files and rather make pagesetups through variables. it works for me but is this common practice in lisp?

Quote

;loads pagesetups for 1"=1'-0"
(defun C:123624(/ Save_Expert)
  (setq Save_Expert (getvar "EXPERT"))
  (setvar "EXPERT" 2)
  (command "_.-PSETUPIN" "S:/WYNN-CAD/pagesetups/12_36x24.dwg" "*")
  (setvar "EXPERT" Save_Expert)
  (princ)
)

;loads pagesetups for 3/4"=1'-0"
(defun C:163624(/ Save_Expert)
  (setq Save_Expert (getvar "EXPERT"))
  (setvar "EXPERT" 2)
  (command "_.-PSETUPIN" "S:/WYNN-CAD/pagesetups/16_36x24.dwg" "*")
  (setvar "EXPERT" Save_Expert)
  (princ)
)

;loads pagesetups for 1/4"=1'-0"
(defun C:483624(/ Save_Expert)
  (setq Save_Expert (getvar "EXPERT"))
  (setvar "EXPERT" 2)
  (command "_.-PSETUPIN" "S:/WYNN-CAD/pagesetups/48_36x24.dwg" "*")
  (setvar "EXPERT" Save_Expert)
  (princ)
)

;loads pagesetups for 1/4"=1'-0"
(defun C:483624(/ Save_Expert)
  (setq Save_Expert (getvar "EXPERT"))
  (setvar "EXPERT" 2)
  (command "_.-PSETUPIN" "S:/WYNN-CAD/pagesetups/48_36x24.dwg" "*")
  (setvar "EXPERT" Save_Expert)
  (princ)
)

;loads pagesetups for paperspace 36x24
(defun C:ps3624(/ Save_Expert)
  (setq Save_Expert (getvar "EXPERT"))
  (setvar "EXPERT" 2)
  (command "_.-PSETUPIN" "S:/WYNN-CAD/pagesetups/PS_36x24.dwg" "*")
  (setvar "EXPERT" Save_Expert)
  (princ)
)

ronjonp

  • Needs a day job
  • Posts: 7527
pagesetup lisp
« Reply #1 on: November 04, 2004, 01:40:20 PM »
Why don't you save all pagesetups in one file so you don't have to have a lisp for each one? They are easily accessible in the pulldown.

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

M-dub

  • Guest
pagesetup lisp
« Reply #2 on: November 04, 2004, 01:50:13 PM »
Quote from: ronjonp
Why don't you save all pagesetups in one file so you don't have to have a lisp for each one? They are easily accessible in the pulldown.

Ron


I'll second that notion....That's what I use and it is SuWEEEET!

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
pagesetup lisp
« Reply #3 on: November 04, 2004, 01:56:43 PM »
Then load them with the click of a button
^C^CDel_Pagesetups;^C^C.-PSETUPIN "PageSetups.dwg" "*"
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.

M-dub

  • Guest

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
pagesetup lisp
« Reply #5 on: November 04, 2004, 02:21:16 PM »
This subject goes way back. :)
PageSetup
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.

M-dub

  • Guest
pagesetup lisp
« Reply #6 on: November 04, 2004, 02:27:00 PM »
...and still growing!  :)

dubb

  • Swamp Rat
  • Posts: 1105
pagesetup lisp
« Reply #7 on: November 04, 2004, 02:36:00 PM »
THANK YOU GUYS....a menu bar would be nicer. the reason why i have it this because i want just the setups that i need for each drawing.

when i use
Code: [Select]

^C^CDel_Pagesetups;^C^C.-PSETUPIN "PageSetups.dwg" "*"


i get
Quote

Command: .-PSETUPIN Enter file name: "S:/WYNN-CAD/pagesetups/12_36x24.dwg"
Enter user defined page setup(s) to import or [?]: "*"
Page setup "11x17" already exists. Redefine it? [Yes/No] <N>: *Cancel*

Page setup "12_36x24" already exists. Redefine it? [Yes/No] <N>: *Cancel*


so i use hotkeys. and later i will make a pull down menu and a toolbar

M-dub

  • Guest
pagesetup lisp
« Reply #8 on: November 04, 2004, 02:37:47 PM »
Did you load Del_Pagesetups first?

M-dub

  • Guest
pagesetup lisp
« Reply #9 on: November 04, 2004, 02:38:41 PM »
Here's what I use in my button macro:
Code: [Select]
^C^C(load"O:/Drawings/Menus-Blocks/LISP/Del_Pagesetups.lsp") Del_Pagesetups;^C^C.-PSETUPIN "O:/Drawings/SupportforCAD/AutoCAD-2004-Support/PageSetups.dwg" "*" PLOT;

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
pagesetup lisp
« Reply #10 on: November 04, 2004, 02:47:43 PM »
In cas you did not get the link by m-dub
Code: [Select]
;;  Function to delete all user plot set ups
(defun c:Del_Pagesetups (/ curdwg pslayout x)
  (vl-load-com)
  (setq
    curdwg   (vla-get-ActiveDocument (vlax-get-Acad-Object))
    pslayout (vla-get-Layout (vla-get-PaperSpace curdwg))
  ) ;_ end of setq
  ;; Call RefreshPlotDeviceInfo before GetPlotDeviceNames
  (vla-RefreshPlotDeviceInfo pslayout)
  (vlax-for x (vla-get-Plotconfigurations curdwg)
    (vla-delete x)
  ) ;_ end of vlax-for
)               ; End Plot_config_list



PS this thread doesn't belong in this forum.
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.

M-dub

  • Guest
pagesetup lisp
« Reply #11 on: November 04, 2004, 02:51:03 PM »
>PS this thread doesn't belong in this forum.
*Oh yeah, forgot to mention that...*

I should also stop being lazy and paste the code in here instead of posting the link instead.  :roll:
Thanks CAB ;)

hyposmurf

  • Guest
pagesetup lisp
« Reply #12 on: March 28, 2005, 12:24:23 PM »
Im trying to sort my page setups out.I have the following macro asociated with a menu button.

^C^CDel_Pagesetups;^C^C.-PSETUPIN "A0PSETUP.dwg" "A0"

This imports the A0 page setup but it wont set it as current.Is there a way to do this?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
pagesetup lisp
« Reply #13 on: March 28, 2005, 12:32:50 PM »
Code: [Select]
; 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))
  )
 )
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.

daron

  • Guest
pagesetup lisp
« Reply #14 on: March 28, 2005, 12:40:25 PM »
Quote from: CAB
...
PS this thread doesn't belong in this forum.


I was thinking the same thing.