Search the Community
Showing results for tags 'locked objects'.
-
Change colors viewport automatically after using lisp
Sandervp posted a topic in AutoLISP, Visual LISP & DCL
Hello everybody! I have a lisp file which creates 2 new commands. If I use tne first command, all the viewports in my drawing are locked. If I use the other command, they are all unlocked again. If I use these commands, also the colors of these viewports are changing. If I lock them, they become green. If I unlock the viewports, they become red. The colors are only changing after I use these created commands. If I want to change something and I need to unlock a (locked=green colored) viewport manually at the properties. The color of this viewport doesn't change into red. Is there a way to change this lisp, so the color of a viewport is also changing after I lock or unlock him manually? This is the lisp: (vl-load-com) (defun dxf (n ed) (cdr (assoc n ed))) (defun c:vpl (/ AD COUNT ENT I PL SS TABNAME VP VPNO) (setq ad (vla-get-activedocument (vlax-get-acad-object))) (vlax-for lay (vla-get-layouts ad) (if (/= (setq TabName (strcase (vla-get-name lay))) "MODEL") ;_ end of /= (progn (if (setq ss (ssget "X" (list (cons 0 "viewport") ) ;_ end of list ) ;_ end of ssget ) ;_ end of setq (progn (setq count (sslength ss)) (setq i 0) (if (> count 0) (progn (while (< i count) (setq ent (ssname ss i ) ;_ end of ssname ) ;_ end of setq (setq vpNo (dxf 69 (entget ent ) ;_ end of entget ) ;_ end of dxf ) ;_ end of setq (if (> vpNo 1) (progn (setq vp (vlax-ename->vla-object ent ) ;_ end of vlax-ename->vla-object ) ;_ end of setq (if (= (vla-get-clipped vp ) ;_ end of vla-get-clipped :vlax-false ) ;_ end of = (progn (vla-put-color vp 3 ) ;_ end of vla-put-color (vla-put-layer vp "defpoints" ) ;_ end of vla-put-layer ) ;_ end of progn (progn (setq pl (entget (dxf 340 (entget ent ) ;_ end of entget ) ;_ end of dxf ) ;_ end of entget ) ;_ end of setq ;get clip entity (setq pl (vlax-ename->vla-object (dxf -1 pl ) ;_ end of dxf ) ;_ end of vlax-ename->vla-object ) ;_ end of setq (vla-put-color pl 3 ) ;_ end of vla-put-color (vla-put-layer pl "defpoints" ) ;_ end of vla-put-layer (vla-put-color vp 3 ) ;_ end of vla-put-color (vla-put-layer vp "defpoints" ) ;_ end of vla-put-layer ) ;_ end of progn ) ;_ end of if (vla-put-displaylocked vp :vlax-true ) ;_ end of vla-put-displaylocked (vla-update vp) ) ;_ end of progn ) ;_ end of if (setq i (1+ i)) ) ;_ end of while ) ;_ end of progn ) ;_ end of if ) ;_ end of progn ) ;_ end of if ) ;_ end of progn ) ;_ end of if ) ;_ end of vlax-for ) ;_ end of defun (defun c:vpu (/ AD COUNT ENT I PL SS TABNAME VP VPNO) (setq ad (vla-get-activedocument (vlax-get-acad-object))) (vlax-for lay (vla-get-layouts ad) (if (/= (setq TabName (strcase (vla-get-name lay))) "MODEL") ;_ end of /= (progn (if (setq ss (ssget "X" (list (cons 0 "viewport") ) ;_ end of list ) ;_ end of ssget ) ;_ end of setq (progn (setq count (sslength ss)) (setq i 0) (if (> count 0) (progn (while (< i count) (setq ent (ssname ss i ) ;_ end of ssname ) ;_ end of setq (setq vpNo (dxf 69 (entget ent ) ;_ end of entget ) ;_ end of dxf ) ;_ end of setq (if (> vpNo 1) (progn (setq vp (vlax-ename->vla-object ent ) ;_ end of vlax-ename->vla-object ) ;_ end of setq (if (= (vla-get-clipped vp ) ;_ end of vla-get-clipped :vlax-false ) ;_ end of = (progn (vla-put-color vp 1 ) ;_ end of vla-put-color ; 3 green (vla-put-layer vp "defpoints" ) ;_ end of vla-put-layer ) ;_ end of progn (progn (setq pl (entget (dxf 340 (entget ent ) ;_ end of entget ) ;_ end of dxf ) ;_ end of entget ) ;_ end of setq ;get clip entity (setq pl (vlax-ename->vla-object (dxf -1 pl ) ;_ end of dxf ) ;_ end of vlax-ename->vla-object ) ;_ end of setq (vla-put-color pl 1 ) ;_ end of vla-put-color (vla-put-layer pl "defpoints" ) ;_ end of vla-put-layer (vla-put-color vp 1 ) ;_ end of vla-put-color ; 3 green (vla-put-layer vp "defpoints" ) ;_ end of vla-put-layer ) ;_ end of progn ) ;_ end of if (vla-put-displaylocked vp :vlax-false ) ;_ end of vla-put-displaylocked (vla-update vp) ) ;_ end of progn ) ;_ end of if (setq i (1+ i)) ) ;_ end of while ) ;_ end of progn ) ;_ end of if ) ;_ end of progn ) ;_ end of if ) ;_ end of progn ) ;_ end of if ) ;_ end of vlax-for ) Is it also possible, after I opened a drawing, every viewport is locked (and green) already? In other words, the command "VPL" is already used before I can change the drawing? Thank you all for your replies! Greetings Sander- 4 replies
-
- viewport layout
- unlocked
-
(and 2 more)
Tagged with:
-
Can't edit, delete, or move objects in a drawing
awhood posted a topic in AutoCAD 2D Drafting, Object Properties & Interface
Hello, I am new to AutoCAD this year, just started an internship for the summer that uses it heavily. I am using AutoCAD P&ID 2015 while the drawings I am receiving are from a user who has 2007 or 2010 classic (NOT P&ID). The problem I am having is almost exactly the same as this post: http://www.cadtutor.net/forum/archive/index.php/t-2531.html However my drawing does not contain a layer with xref in the name. I am trying to select some line segments and either move or delete them but it will not let me. Most of the lines in the drawing can be selected, moved, deleted, but some cannot. When I click the lines that can't move it does not display the grips but it does become a dashed line, like its partially selected or something. idk if the history of this drawing matters but it was orginally created on a P&ID version of AutoCAD and exported so it could be opened and edited by others with an AutoCAD classic version. After all of this it was sent back to me, which I am editing this drawing now with the workspace set to Drafting & Annotation. Let me know if I have not provided sufficient information needed to solve this problem. I would really appreciate any inputs or suggestions you may have.- 6 replies
-
- can't edit
- can't delete
-
(and 2 more)
Tagged with: