Author Topic: pagesetup lisp  (Read 15007 times)

0 Members and 1 Guest are viewing this topic.

daron

  • Guest
pagesetup lisp
« Reply #15 on: March 28, 2005, 02:49:29 PM »
I moved it to the lisp forum, away from the show your stuff forum.

hyposmurf

  • Guest
pagesetup lisp
« Reply #16 on: March 28, 2005, 03:13:55 PM »
Quote from: CAB
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))
  )
 )



Thanks for that CAB Ive got the lisp apploaded and cant seem to get it to run.What do I need to initiate it?
psetup
putPagesetup
item-p
Probably none of these and I need to assign the name of my page setup in there somewhere. :?

daron

  • Guest
pagesetup lisp
« Reply #17 on: March 28, 2005, 03:28:14 PM »
putPagesetup requires two arguments: layout & setup. I would assume those to be your layout to set to and the setup name.

hyposmurf

  • Guest
pagesetup lisp
« Reply #18 on: March 28, 2005, 05:23:50 PM »
Im still scratching my head over where to put in my Layout 1 & A0 (which is my pagesetup name).

This next bit your going to find a bit of a mess but it works! :)

^C^CDel_Pagesetups;^C^C.-PSETUPIN "A0PSETUP.dwg" "A0" ^C^C.-INSERT "A0SML.dwg" 0,0 1 1 0 ;;;;;;;;;;;;;;;;;;

Thats the macro to insert a A0 pagesetup and my A0 titleblock.Im hoping to have this set for each titleblock and accompanying page setup.Everything is fine(well not the cleanest macro),but Im still miffed over that lisp for setting the current page setup.

daron

  • Guest
pagesetup lisp
« Reply #19 on: March 29, 2005, 07:45:18 AM »
(putPagesetup "Layout 1" "A0")

Try that.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
pagesetup lisp
« Reply #20 on: March 29, 2005, 08:44:51 AM »
To take it one step farther.
Code: [Select]
(defun c:DansHelper(/ lay)
  (foreach lay (layoutlist)
    (putPagesetup lay "A0")
  )
  (princ)
)


Dan,
Are you taking Stig's Lisp Course?
If so you will understand the 'foreach' function.
Look up the 'layoutlist' function.
I haven't been following the course but you probably have covered
passing variables between lisp routines. I am talking about
'lay' and '"A0"' here. Can you figure out what each of the four lines of
code is doing?
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.

hyposmurf

  • Guest
pagesetup lisp
« Reply #21 on: March 29, 2005, 01:02:03 PM »
Nice defun! :) As far as Stig,s lisp course has gone ...... :oops: .My workload has almost doubled at work now another employee has left and Im also trying to get myself prepared for a departure to, which leaves me hardly any spare time.I even stayed in the whole easter weekend :roll: .Sad git that I am :)  it will pay off eventually.Thanks for the lisp I'll go and have a go and come back with some feedback.The need for me to learn how to lisp is becoming more apparent everyday!

hyposmurf

  • Guest
pagesetup lisp
« Reply #22 on: August 24, 2005, 08:05:13 AM »
Quote from: CAB
To take it one step farther.
Code: [Select]
(defun c:DansHelper(/ lay)
  (foreach lay (layoutlist)
    (putPagesetup lay "A0")
  )
  (princ)
)


Dan,
Are you taking Stig's Lisp Course?


Just got back on this one and hoping to sort it before I start work tomorrow :shock: .I havent seen Stigs course since cant even find it on the swamp any more. Im going to take a guess at what each layer means.
(defun c:DansHelper(/ lay) Defines the function
  (foreach lay (layoutlist) Attains a list of layouts
    (putPagesetup lay "A0") Sets the current layout to A0
  )
  (princ)
)        Exits the lisp quietly


When I run the lisp I get:
Command: DansHelper
; error: no function definition: PUTPAGESETUP


So the last line of code needs to finished,a functioned defined?Is it not possible to add to the macro I already have to set it current that way the whole sequence of events can be set from one button?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
pagesetup lisp
« Reply #23 on: August 24, 2005, 08:17:48 AM »
Look here: http://www.theswamp.org/phpBB2/viewtopic.php?p=55224#55224

Load it with the other lisp or add it to it like
Code: [Select]
(defun c:DansHelper(/ lay)

<put it here>

  (foreach lay (layoutlist)
    (putPagesetup lay "A0")
  )
  (princ)
)
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.

hyposmurf

  • Guest
pagesetup lisp
« Reply #24 on: August 24, 2005, 09:07:31 AM »
Thanks.That is almost there it sets the pagesetup I want to be current,but I still have to reopen the page setup dialogue and hit enter before any changes to the setup in the drawing are set.