rookie37 Posted August 21, 2008 Posted August 21, 2008 I'm trying to lock all viewports. However, my macro don't work. Can someone help me? (DEFUN C:LV () (COMMAND "MV" "" "L" "" "ALL" "")(princ)) Quote
alanjt Posted August 21, 2008 Posted August 21, 2008 try this, not my creation: ;;;CADALYST 07/06 Tip2129: LV.lsp Viewport Lock and Unlock (c) Theodorus Winata ;;; Function: Lock/Unlock Viewports ;;; Command Line: LV ;;; Description: By locking the Display you ensure your ;;; model view will not accidentally shift ;;; if you activate the viewport ;;; ;;; Developed by Theodorus Winata ;;; April 2006 ;;; (defun get-objects () (setq DPL (vlax-ename->vla-object (ssname SSG CNT)) CNT (1+ CNT) );;setq );;get-objects ;;;********** Error Handler ********** (defun ERR (msg) (princ) );;ERR ;;;********** Main Program ********** (defun C:LV (/ CME CNT DPL *ERROR* OP SSG) (vl-load-com) (setq *ERROR* ERR CME (getvar "CMDECHO") );;setq (setvar "CMDECHO" 0) (if (= (getvar "TILEMODE") 1) (setvar "TILEMODE" 0)) (command "pspace") (setq SSG (ssget "X" (list (cons 0 "VIEWPORT"))) CNT 0 );;setq (initget "Yes No") (setq OP (getkword "Display locked [Yes/No] <Y>: ")) (cond ((or (= OP nil) (= OP "Yes")) (repeat (sslength SSG) (get-objects) (vla-put-DisplayLocked DPL :vlax-true) );;repeat (prompt "\n\tAll Viewports Locked...!") );;"Yes" ((= OP "No") (repeat (sslength SSG) (get-objects) (vla-put-DisplayLocked DPL :vlax-false) );;repeat (prompt "\n\tAll Viewports Unlocked...!") );;"No" );;cond (setvar "CMDECHO" CME) (princ) );;C:LV (princ ; (strcat ; " LV.LSP v1.0 (Copyright 2006 by " ; "\"Theo Winata and You\") loaded...!" ; ) ) (princ) Quote
rookie37 Posted August 21, 2008 Author Posted August 21, 2008 Thank you However, because I put at my lisp programs into one, I try to conserve memory as it takes so long to load Can anyone help me with the following? (DEFUN C:LV () (COMMAND "MV" "" "L" "" "ALL" "")(princ)) Quote
neekcotrack Posted August 21, 2008 Posted August 21, 2008 Try this: (DEFUN C:LV () (COMMAND "_.VPORTS" "L" "ON" "ALL" "")(princ)) Quote
asos2000 Posted August 24, 2008 Posted August 24, 2008 is this macro for could be used for a new button? if not how can create a macro for a button doing that function? (display look on and off) Quote
Footpeg Posted August 24, 2008 Posted August 24, 2008 Can anyone help me with the following? (DEFUN C:LV () (COMMAND "MV" "" "L" "" "ALL" "")(princ)) (DEFUN C:LV () (COMMAND "MView" "L" "ON" "ALL" "")(princ)) Footpeg Quote
Footpeg Posted August 26, 2008 Posted August 26, 2008 Thank you Footpeg! You're welcome! Footpeg Quote
alanjt Posted August 26, 2008 Posted August 26, 2008 However, because I put at my lisp programs into one, I try to conserve memory as it takes so long to load i'm sure, just as i did, that you will realize that combining them is not the best policy. i thought it was, now i have 1 startup lsp routine that either autoloads or loads all my lsps. the startup also has all of my setvars and any other customization settings i want. that way, when i sit down at a new version of autocad. i add my lsp folder to the support paths, add my one startup lsp file to the startup in appload and i'm good to go. when i restart cad, all my autocad settings are in place. the biggest reason i went this route was it was just easier to make updates to my routines. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.