freeze objects

freeze objects

michaelZCXYL
Enthusiast Enthusiast
1,798 Views
33 Replies
Message 1 of 34

freeze objects

michaelZCXYL
Enthusiast
Enthusiast

Hello,

 

I am wondering if it is possible to freeze/off objects instead off freeze/off layers? thank you  very much in advance.

0 Likes
1,799 Views
33 Replies
Replies (33)
Message 2 of 34

cadffm
Consultant
Consultant
0 Likes
Message 3 of 34

Kent1Cooper
Consultant
Consultant

As suggested, HIDEOBJECTS makes things disappear, but only in a temporary way.  It does not survive closing the drawing -- when you open it again, the object(s) will be visible again.  If you are looking for something that hides them permanently until you choose to see them again, I don't know of anything other than the Layer-based approach.

Kent Cooper, AIA
0 Likes
Message 4 of 34

michaelZCXYL
Enthusiast
Enthusiast

I am looking for something that hides them permanently, "hide" command just temporarily do it, many thanks.

0 Likes
Message 5 of 34

cadffm
Consultant
Consultant

ISOLATE can hide object longer,but it is a setup question (and I prefer to set it to REFERESH by  every open)

OBJECTISOLATIONMODE

 

That's all in plain AutoCAD/LT

Sebastian

Message 6 of 34

pendean
Community Legend
Community Legend

@michaelZCXYL wrote:

I am looking for something that hides them permanently


That would be ERASE command then.

 

Otherwise... How would you know a day/two/month/year later that those are still in the file when you need them back?

 

 

0 Likes
Message 7 of 34

Kent1Cooper
Consultant
Consultant

@cadffm wrote:

ISOLATE can hide object longer,but it is a setup question (and I prefer to set it to REFERESH by  every open)

OBJECTISOLATIONMODE ....


I wasn't aware of that one [a new possibility in more recent versions, I assume].  @pendean, with it set to 1, UNISOLATEOBJECTS would still bring everything back to viewable, but I assume you wouldn't know in a later session whether there were things to reveal without using that to find out.  BUT there's the complication that it's Saved in User Settings, not in each drawing -- @michaelZCXYL, does that mean it wouldn't serve your purpose?

Kent Cooper, AIA
0 Likes
Message 8 of 34

john.uhden
Mentor
Mentor

@michaelZCXYL 

I once recently ran into a similar problem.

I could have changed the selection to a "HIDDEN" layer, but that would have changed their inherited "bylayer" properties.  So I decided to make them invisible with the option to make them all visible again or just report and show the grips of the invisible ones.  It includes Undo control... 

(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

0 Likes
Message 9 of 34

michaelZCXYL
Enthusiast
Enthusiast

Thank you  very much all of you. I want to freeze or off object like freeze/off layer, I can bring them when need. If using isolating object, they can be hide longer. But when using this command later, ending isolation session, they will come back if I do not want see them, thanks again. 🙂

0 Likes
Message 10 of 34

cadffm
Consultant
Consultant

You need a Tool to do that, 

based on the technic of Johns code.

There are many available, just test and find your favorite.

Nothing ootb in vanilla AutoCAD.

Sebastian

0 Likes
Message 11 of 34

michaelZCXYL
Enthusiast
Enthusiast

Could you please advise me where I can find them? Also, I need another tool, to move revision clouds to new layers, thank you very much. 🙂

0 Likes
Message 12 of 34

michaelZCXYL
Enthusiast
Enthusiast

For many drawings

0 Likes
Message 13 of 34

pendean
Community Legend
Community Legend

@michaelZCXYL wrote:

For many drawings


See your other post, no need to ask for the same thing in different posts all over these forums

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/run-lisp-script-or-macros-to-select-...

0 Likes
Message 14 of 34

michaelZCXYL
Enthusiast
Enthusiast

noted and thanks

0 Likes
Message 15 of 34

ronjonp
Mentor
Mentor

@michaelZCXYL 

Try this ... regen to make visible again.

(defun c:foo (/ s)
  (if (setq s (ssget))
    (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (redraw e 2))
  )
  (princ)
)
0 Likes
Message 16 of 34

Kent1Cooper
Consultant
Consultant

@ronjonp wrote:

Try this ... regen to make visible again. ....


That has the same problem as doing it with the HIDEOBJECTS command -- it's only temporary, and doesn't accomplish what's described in Messages 4 & 9.

Kent Cooper, AIA
0 Likes
Message 17 of 34

ronjonp
Mentor
Mentor

@Kent1Cooper wrote:

@ronjonp wrote:

Try this ... regen to make visible again. ....


That has the same problem as doing it with the HIDEOBJECTS command -- it's only temporary, and doesn't accomplish what's described in Messages 4 & 9.


Sorry .. did not read this entire thread.

0 Likes
Message 18 of 34

CADaSchtroumpf
Advisor
Advisor

I'm using the old method (since R12 at least) which is persistent when saving the file.
E_off to inactivate the entity(ies)

E_on to reactivate them as desired.

 

File: E_off-E_on.lsp

(defun c:e_off ( / js_off n ent dxf_ent )
  (princ "\nChoix des entités à inactiver: ")
  (setq js_off (ssget) n 0)
  (cond
    (js_off
      (repeat (sslength js_off)
        (setq
          ent (ssname js_off n)
          dxf_ent (entget ent)
        )
        (if (not (member '(60 . 0) dxf_ent))
          (entmod (append dxf_ent '((60 . 1))))
          (entmod (subst '(60 . 1) '(60 . 0) dxf_ent))
        )
        (setq n (1+ n))
      )
    )
    (T
      (princ "\nSélection vide.")
    )
  )
  (princ)
)
(defun c:e_on ( / js_off n js_swap n_swap ent ent_dxf js_on nb)
  (setq js_off (ssget "_X" '((60 . 1))) n 0)
  (cond
    (js_off
      (setq js_swap (ssget "_X"  '((-4 . "<NOT") (60 . 1) (-4 . "NOT>"))) n_swap 0)
      (cond
        (js_swap
          (repeat (sslength js_swap)
            (setq ent (ssname js_swap n_swap))
            (redraw ent 2)
            (setq n_swap (1+ n_swap))
          )
        )
      )
      (repeat (sslength js_off)
        (setq ent (ssname js_off n))
        (setq dxf_ent (entget ent))
        (entmod (subst '(60 . 0) '(60 . 1) dxf_ent))
        (entupd ent)
        (setq n (1+ n))
      )
      (princ "\nChoix des entités à réactiver: ")
      (setq js_on (ssget) n 0)
      (cond
        (js_on
          (repeat (sslength js_on)
            (if (ssmemb (ssname js_on n) js_off)
              (setq js_off (ssdel (ssname js_on n) js_off))
            )
            (setq n (1+ n))
          )
          (cond
            (js_off
              (setq nb 0)
              (repeat (sslength js_off)
                (setq ent (ssname js_off nb))
                (setq dxf_ent (entget ent))
                (if (not (member '(60 . 0) dxf_ent))
                  (entmod (append dxf_ent '((60 . 1))))
                  (entmod (subst '(60 . 1) '(60 . 0) dxf_ent))
                )
                (entupd ent)
                (setq nb (1+ nb))
              )
              (cond
                (js_swap
                  (setq n_swap 0)
                  (repeat (sslength js_swap)
                    (setq ent (ssname js_swap n_swap))
                    (redraw ent 1)
                    (setq n_swap (1+ n_swap))
                  )
                )
              )
            )
            (T
              (princ "\nAucune entité à réactivée!")
            )
          )
        )
        (T
          (princ "\nSélection vide.")
        )
      )
    )
    (T
      (princ "\nAucune entité à réactivée!")
    )
  )
  (princ)
)

I created two buttons with the following instructions:

^C^C(if (not c:e_off) (load "E_off-E_on.lsp")) e_off 
^C^C^C^C(if (not c:e_on) (load "E_off-E_on.lsp")) e_on 

 

0 Likes
Message 19 of 34

john.uhden
Mentor
Mentor

@CADaSchtroumpf 

Are you sure R12 provided a visibility property (dxf 60)?

John F. Uhden

0 Likes
Message 20 of 34

CADaSchtroumpf
Advisor
Advisor

Even R10 !

 


he specific assignment of group codes depends upon the item being
described in the file.  However, the type of the value this group supplies
is derived from the group code in the following way:

                    Group code range   Following value
                          0 - 9       String
                         10 - 59      Floating-point
                         60 - 79      Integer
                        210 - 239     Floating-point
                           999        Comment (string)




See dxf10 

0 Likes