Author Topic: Visibility = false  (Read 2387 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7529
Visibility = false
« on: September 14, 2005, 01:02:18 PM »
How would one go about showing all objects in a drawing who's visibilty is set to false via lisp?

Thanks,

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Visibility = false
« Reply #1 on: September 14, 2005, 01:07:03 PM »
Define show, do you mean temporarilly display or to force visibility on?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Visibility = false
« Reply #2 on: September 14, 2005, 01:10:17 PM »
Sorry,

Force to visibility on.

Thanks

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Visibility = false
« Reply #3 on: September 14, 2005, 01:26:36 PM »
This works:

Code: [Select]
(defun c:so (/ s1 index ent obj)
 (command ".undo" "begin")
  (if (setq sl (ssget "x"))
    (progn
      (setq index -1)
      (while (< (setq index (1+ index)) (sslength sl))
        (setq ent (ssname sl index))
        (setq obj (vlax-ename->vla-object ent))
        (vlax-put-property obj 'Visible :vlax-true)
      )
    )
  )
 (command ".undo" "end")
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Visibility = false
« Reply #4 on: September 14, 2005, 02:22:09 PM »
That should do it.

For fun I did this one, which will also ensure attributes / vertices are visible ---

Code: [Select]
(defun c:AllVisible ( / StartUndo Children ForceVisibility Main )
   
    (defun StartUndo ( document / enabled )
        (cond
            (   (setq enabled (< 0 (getvar "undoctl")))
                (while (eq 8 (logand 8 (getvar "undoctl")))
                    (vla-endundomark document)
                )
                (vla-startundomark document)
            )   
        )
        enabled
    )
   
    (defun Children ( ename / result )
        (if (assoc 66 (entget ename))
            (reverse
                (while
                    (/= "SEQEND"
                        (cdr
                            (assoc 0
                                (entget
                                    (setq ename
                                        (entnext ename)
                                    )
                                )
                            )
                        )
                    )
                    (setq result (cons ename result))
                )
            )
        )
    )   
   
    (defun ForceVisibility ( ename )
        (vl-catch-all-apply
            ;;  trap any errors, like
            ;;  object's layer locked
           '(lambda ()
                (vla-put-visible
                    (vlax-ename->vla-object object)
                    :vlax-true
                )
            )
        )
        ;;  recursive call for child entities,
        ;;  like vertices and attributes       
        (foreach child (Children ename)
            (ForceVisibility child)
        )
    )
   
    (defun Main ( document / ss i undoflag )   
        (cond
            (   (setq ss (ssget "x"))
                (setq undoflag (StartUndo document))       
                (repeat (setq i (sslength ss))
                    (ForceVisibility
                        (ssname ss 
                            (setq i (1- i))
                        )
                    )   
                )
                (if undoflag (vla-endundomark document))
            )   
        )
        (princ)
    )
   
    (Main
        (vla-get-activedocument
            (vlax-get-acad-object)
        )
    )

)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Visibility = false
« Reply #5 on: September 14, 2005, 04:05:56 PM »
Thanks Michael.  :-)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Visibility = false
« Reply #6 on: September 14, 2005, 04:08:09 PM »
My pleasure.

:kewl:
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst