Author Topic: Layout change lisp  (Read 2034 times)

0 Members and 1 Guest are viewing this topic.

Fish

  • Guest
Layout change lisp
« on: May 03, 2005, 12:05:31 PM »
I'm familiar with lisp and actually have a few routines I use daily but as far as writing one I'm clueless.  :?  I have wrote a few marcros but that's it.

I'm looking for a lisp that will change my variables, such as dimstyle, text ht, ltscale etc..... when I'm in paperspace switching layouts.

I have one but it doesn't seem to work that great.  If you know of any It would be appreciated.

CADaver

  • Guest
Layout change lisp
« Reply #1 on: May 03, 2005, 12:19:11 PM »
What you need is a reactor, start looking at this bit o code that "reacts" when changing layouts.

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Layout change lisp
« Reply #2 on: May 04, 2005, 05:32:57 AM »
Hi

You may use this sample:

Code: [Select]
; = AcadDoc.lsp ===============================================================
;
; - Initialize ActiveX support
(vl-load-com)
;
; - Reactors ------------------------------------------------------------------
;
; - If not set, initialize DocManager-Reactor
(or Me:ReaDma
 (setq Me:ReaDma (VLR-DocManager-Reactor
                  nil
                 '(
                   (:VLR-documentToBeDestroyed . MeDocToBeDestroyedCallbacks)
                  )
                 )
 )
)
; - If not set, initialize Command-Reactor
(or Me:ReaCom
 (setq Me:ReaCom (VLR-Command-Reactor
                  nil
                 '(
                   (:VLR-commandEnded . MeCommandEndedCallbacks)
                  )
                 )
 )
)
;
; - Notifications -------------------------------------------------------------
;
; - CommandEnded notifications
(defun MeCommandEndedCallbacks (Rea Arg)
 (MeDoCmdEndedStuff Arg)
 (princ)
)
; - DocToBeDestroyed notifications
(defun MeDocToBeDestroyedCallbacks (Rea Arg)
 (MeDoCloseStuff)
 (princ)
)
;
; - Subs ----------------------------------------------------------------------
;
; - Command ended function
(defun MeDoCmdEndedStuff (Arg / CurCmd)
 (setq CurCmd (strcase (car Arg)))
 (cond
  ((wcmatch CurCmd "LAYOUT_CONTROL,MSPACE,PSPACE,VPMAX")
   (princ "\nReactor callback fired...")
  )
  ;;; other command ended dependent functions
 )
 (princ)
)
; - Reactor cleanup function
(defun MeDoCloseStuff ( / VarLst)
 (setq VarLst (MeGetReaVars))
 (mapcar 'VLR-remove (mapcar 'eval VarLst))
 (mapcar '(lambda (l) (set l nil)) VarLst)
 (princ)
)
; - Collect global reactor variables
(defun MeGetReaVars ( / RetVal)
 (foreach memb (atoms-family 1)
  (if (wcmatch (strcase memb) "ME:REA*")
   (setq RetVal (cons memb RetVal))
  )
 )
 (mapcar 'read RetVal)
)

(princ)


Cheers
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Layout change lisp
« Reply #3 on: May 04, 2005, 08:44:14 AM »
Two important things:

(1) Welcome aboard Mr. Menzi, very pleased to to see you found the swamp. I look forward to your participation here and hope you enjoy one of the finest places on the net.

(2) Go here and share something about yourself.

Michael Puckett

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst