TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: rugaroo on January 20, 2004, 03:48:23 PM

Title: New Program
Post by: rugaroo on January 20, 2004, 03:48:23 PM
Hey guys...I have the following code, but each time I try to check it in model space, it shows my message allong with something like: #<SUBR @0253730c PRINC>

Here is my code.

Code: [Select]
;;;VPL.LSP - Viewport Locker
;;;
;;;Copyright 2004 - Civil Drafting Services
;;;Code given is given out on an 'as-is' basis
;;;please contact our DevTeam if you have any
;;;questions. devteam@civildraftingservices.com
;;;
;;;Version - VPLV1.0A
;;;
;;;Bugs - If in model space, error shows: #<SUBR @0253730c PRINC>
;;;
;;;Web - http://civildraftingservices.com

(DEFUN c:vpl (/)
  (COND
    ((= (GETVAR "tilemode") 1)
     (PRINC "\nMust be in paper space to use.")
     (PRINC "")
    )
  )
  (COND
    ((= (GETVAR "tilemode") 0)
     (INITGET 1 "u l")
     (SETQ ans (GETKWORD "\n[U]nlock or [L]ock?"))
     (COND ((= ans "l")
   (SETQ ss (ENTSEL "\nSelect viewports to lock: "))
   (COMMAND "mview" "lock" "on" ss)
   (SETQ ss nil)
   (PRINC)
  )
     )
     (COND ((= ans "u")
   (SETQ ss (ENTSEL "\nSelect viewports to unlock: "))
   (COMMAND "mview" "lock" "off" ss)
   (SETQ ss nil)
   (PRINC)
  )
     )
    )
    (PRINC)
  )
)


Thx - Rug
Title: New Program
Post by: Mark on January 20, 2004, 03:58:32 PM
Study this one Rug
Code: [Select]

(DEFUN c:vpl ()
    (COND ((= (GETVAR "tilemode") 1)
  (PRINC "\nMust be in paper space to use.")
  )
 ((= (GETVAR "tilemode") 0)
  (INITGET 1 "Unlock Lock")
  (SETQ ans (GETKWORD "\n[U]nlock or [L]ock? "))
  (COND ((= ans "Lock")
 (SETQ ss (ENTSEL "\nSelect viewports to lock: "))
 (COMMAND "mview" "lock" "on" ss)
 (SETQ ss nil)
 (PRINC)
 )
)
  (COND ((= ans "Unlock")
 (SETQ ss (ENTSEL "\nSelect viewports to unlock: "))
 (COMMAND "mview" "lock" "off" ss)
 (SETQ ss nil)
 (PRINC)
 )
)
  )
 )
    (PRINC)
    )
Title: New Program
Post by: daron on January 20, 2004, 04:02:24 PM
Roland, here are some comments:
Code: [Select]
(DEFUN c:vpl (/ ss);this is where you set ss to nil
  (COND
    ((= (GETVAR "tilemode") 1)
     (PRINC "\nMust be in paper space to use.")
     (PRINC "")
    )
    ((= (GETVAR "tilemode") 0)
     (INITGET 1 "Unlock Lock")
     (SETQ ans (GETKWORD "\n[Unlock/Lock]?"))
     (COND ((= ans "Lock")
       (SETQ ss (ENTSEL "\nSelect viewports to lock: "))
       (COMMAND "mview" "lock" "on" ss)
       (SETQ ss nil);why?
      )
     )
     (COND ((= ans "Unlock")
       (SETQ ss (ENTSEL "\nSelect viewports to unlock: "))
       (COMMAND "mview" "lock" "off" ss)
       (SETQ ss nil);why?
      )
     )
    )
    (PRINC)
  )
)

That'll work as long as you're in paperspace and don't have any viewports activated as mspace. Now, if you would like a really slick vport lock command, I've got one that Se7en taught me vlisp with. Beautiful program.
Title: New Program
Post by: CADaver on January 20, 2004, 04:56:23 PM
Quote from: Daron
Now, if you would like a really slick vport lock command, I've got one that Se7en taught me vlisp with. Beautiful program.

Well post it already!!!!!!!!!!

:)
Title: New Program
Post by: daron on January 20, 2004, 05:40:15 PM
Well, once again, here is ToggleLock.lsp (http://theswamp.org/swamp.files/Daron/togglevpl.lsp)