Author Topic: New Program  (Read 3800 times)

0 Members and 1 Guest are viewing this topic.

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
New Program
« 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
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
New Program
« Reply #1 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)
    )
TheSwamp.org  (serving the CAD community since 2003)

daron

  • Guest
New Program
« Reply #2 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.

CADaver

  • Guest
New Program
« Reply #3 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!!!!!!!!!!

:)

daron

  • Guest
New Program
« Reply #4 on: January 20, 2004, 05:40:15 PM »
Well, once again, here is ToggleLock.lsp