- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Please correct me if I'm wrong, but after some investigation I think I've found that:
1. All graphical vla-objects have a 'Visible property (0 = off, -1 = on)
2. Entity data has a DXF 60 code only if an entity is invisible.
What this is about is that we did an updated topographic survey of two adjacent lots belonging to the same owner when we were to have updated only one of the lots (the improved one, the other one is vacant).
Rather than erasing the not-to-be-published-yet shots and features of the vacant lot, we wanted to "hide" them away since we know that one day the owner will want a survey of the vacant lot, and we will be able to use what we have instead of sending the crew out again and redrafting it all. I considered using lots of wipeouts, but the visibility approach requires much less effort, so I came up with this...
(defun C:Visible ( / *error* vars vals ss E Obj i N)
;; v1.0 (8-31-21) John F. Uhden
;; Program makes each entity in a selection set invisible, or
;; Makes all invisible objects visible, and
;; Has a Report option to inform of the number of invisible objects.
(gc)
(prompt "\nVisible v1.0 (c)2021, John F. Uhden\n")
(defun *error* (Error)
(mapcar 'setvar vars vals)
(vla-endundomark *doc*)
(cond
((not Error))
((wcmatch (strcase Error) "*QUIT*,*CANCEL*")
(vl-exit-with-error "\r ")
)
((wcmatch (strcase Error) "*CANCEL*,*QUIT*")
(vl-exit-with-error (strcat "\r*ERROR*: " Error))
)
)
(princ)
)
(or *acad* (setq *acad* (vlax-get-acad-object)))
(or *doc* (setq *doc* (vla-get-ActiveDocument *acad*)))
(vla-endundomark *doc*)
(vla-startundomark *doc*)
(setq vars '("cmdecho"))
(setq vals (mapcar 'getvar vars))
(mapcar 'setvar vars '(0))
(command "_.expert" (getvar "expert")) ;; dummy command
(initget 1 "INvisible iNvisible Report Visible")
(setq ans (getkword "\nMake selected objects iNvisible/Visible/Report: "))
(cond
((= ans "Report")
(setq ss (ssget "x" '((60 . 1))))
(setq N (sslength ss))
(princ (strcat "\nFound " (itoa N) " invisible entities."))
(sssetfirst nil ss)
)
((= ans "Visible")
(princ "\nAll invisible objects will be made visible.")
(getstring "\nHit any key to continue, or Esc to stop.")
(setq ss (ssget "x" '((60 . 1))))
(repeat (setq i (sslength ss))
(setq e (ssname ss (setq i (1- i)))
obj (vlax-ename->vla-object e)
)
(vlax-put obj 'Visible -1)
)
(princ (strcat "\n Made " (itoa (sslength ss)) " objects visible."))
)
(1
(princ "\nSelect objects to make invisible.")
(setq ss (ssget))
(repeat (setq i (sslength ss))
(setq e (ssname ss (setq i (1- i)))
obj (vlax-ename->vla-object e)
)
(vlax-put obj 'Visible 0)
)
(princ (strcat "\n Made " (itoa (sslength ss)) " objects invisible."))
)
)
(*error* nil)
)
(defun c:VIS ()(c:Visible))
John F. Uhden
Solved! Go to Solution.