CAD Forum - Database of tips, tricks and utilities for AutoCAD, Inventor and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 5528
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

 

HelpCAD discussion

 
CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.

How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedShow/hide object in current viewport

 Post Reply Post Reply
Author
suribalu View Drop Down
Newbie
Newbie


Joined: 03.May.2011
Location: Australia
Using: autocad 2009
Status: Offline
Points: 3
Direct Link To This Post Topic: Show/hide object in current viewport
    Posted: 03.May.2011 at 06:38

It would be a great help if there is a way to show or hide a object only in the current viewport without affecting its visibility in model space or other viewports.

I came across a .vlx file from www.cadstudio.cz/dl./hideshow.vlx that does the job of showing or hiding in model space( and hence in all viewports).
 
If someone got a lisp routine for object display just affecting the current viewport, it'll be real help.
 
Thanks,
Suribalu
Back to Top
John Connor View Drop Down
Senior Member
Senior Member


Joined: 01.Feb.2011
Location: United States
Using: AutoCAD 2018
Status: Offline
Points: 7175
Direct Link To This Post Posted: 03.May.2011 at 12:14
Put the object on its own layer and use the viewport freeze option available in the Layer Properties Manager.
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>

Back to Top
alanjt View Drop Down
Groupie
Groupie


Joined: 08.Apr.2009
Location: United States
Using: Civil 3D 2009/2011
Status: Offline
Points: 30
Direct Link To This Post Posted: 03.May.2011 at 14:50
You can also accomplish this with commands: LayFrz and VPLayer.
Back to Top
suribalu View Drop Down
Newbie
Newbie


Joined: 03.May.2011
Location: Australia
Using: autocad 2009
Status: Offline
Points: 3
Direct Link To This Post Posted: 04.May.2011 at 01:19
Thanks for the replies. By doing VP freeze or LAYFRZ I would be applying to the entire layer(which turns off all the objects in that layer). I just want a specified object in a layer to be turned off in a specified viewport(not affecting its visibility in model space or any other viewport).
Please find below couple of LISP files I came across few websites that posted LISP files which can turn on/off a object (not layer) in model space. If some pros at autolisp could look at it and modify it to the way I need it will save my day(s).  Thanks in advance,
Suribalu
;Tip1504: ELEMS.LSP Freeze Elements (c)1999, Pawel Lewicki
(defun c:ELEMS (/ odp count ss s1 dxf old-name xd appl)
(setvar "cmdecho" 0)
(setq appl "ELEMS")
(if (not (tblsearch "appid" appl)) (regapp appl) )
(initget "? ON OFF Freeze Thaw Lock Unlock")
(setq odp (getkword "\n?, ON, OFF, Freeze, Thaw, Lock, Unlock : "))
(cond ( (= odp "ON") (RESTORE-LAYR "ELEMS-OFF") )
( (= odp "Thaw") (RESTORE-LAYR "ELEMS-Freeze") )
( (= odp "Unlock") (RESTORE-LAYR "ELEMS-Lock") )
( (= odp "OFF") (CHANGE-LAYR "ELEMS-OFF") )
( (= odp "Freeze") (CHANGE-LAYR "ELEMS-Freeze") )
( (= odp "Lock") (CHANGE-LAYR "ELEMS-Lock") )
( (= odp "?") (ELEMS-INFO) )
)
(princ)
);defun
(defun ELEMS-INFO ()
(foreach layr-name '("ELEMS-OFF" "ELEMS-Freeze" "ELEMS-Lock")
(setq ss (ssget "_X" (list (cons 8 layr-name)) ))
(if ss (princ (sslength ss)) (princ "0") )
(princ (strcat " elements on layer " layr-name "\n") )
)
)
(defun CHANGE-LAYR (layr-name)
(setq ss (ssget))
(if ss (progn
(command "_layer" "_n" layr-name (strcat "_" odp) layr-name "")
(setq count 0)
(while (setq s1 (ssname ss count))
(setq dxf (entget s1))
(setq old-name (cdr (assoc 8 dxf)))
(setq xd (list (LIST -3 (LIST appl
(cons 1002 "{")
(cons 1003 old-name)
(cons 1002 "}")
))))
(setq dxf (subst (cons 8 layr-name) (assoc 8 dxf) dxf))
(setq dxf (append dxf xd))
(entmod dxf)
(setq count (+ 1 count))
)
));if
);defun
(defun RESTORE-LAYR (layr-name)
(setq ss (ssget "_x" (list (cons 8 layr-name)) ))
(if ss (progn
(setq count 0)
(if (= layr-name "ELEMS-Lock") (command "_layer" "_Unlock" layr-name "") )
(while (setq s1 (ssname ss count))
(setq dxf (entget s1 (list appl)))
(setq xd (car (cdr (assoc -3 dxf))))
(setq old-name (cdr (nth 2 xd)))
(setq dxf (subst (cons 8 old-name) (assoc 8 dxf) dxf))
(setq dxf (reverse (cdr (reverse dxf))))
(entmod dxf)
(setq count (+ 1 count))
)
(if (= layr-name "ELEMS-Lock") (command "_layer" "_Lock" layr-name "") )
))
(princ count) (princ " elements") (princ)
);defun
http://www.cadtutor.net/forum/archive/index.php/t-31330.html
 
;; Turn off visibility for selected objects
(defun c:OFF (/ ss)
  (vl-load-com)
  (prompt "\n Select objects to hide: ")
  (if (setq ss (ssget))
    ((lambda (i / e)
       (while (setq e (ssname ss (setq i (1+ i))))
         (vla-put-visible
           (vlax-ename->vla-object e)
           :vlax-false)))
      -1))
  (princ))
 
;; Turn on visibility for all objects
(defun c:ON (/ ss)
  (vl-load-com)
  (prompt "\n Turning on visibility for all objects... ")
  (if (setq ss (ssget "_x"))
    ((lambda (i / e)
       (while (setq e (ssname ss (setq i (1+ i))))
         (vla-put-visible
           (vlax-ename->vla-object e)
           :vlax-true)))
      -1))
  (princ))


Edited by suribalu - 04.May.2011 at 01:21
Back to Top
John Connor View Drop Down
Senior Member
Senior Member


Joined: 01.Feb.2011
Location: United States
Using: AutoCAD 2018
Status: Offline
Points: 7175
Direct Link To This Post Posted: 04.May.2011 at 11:54
There is a lisp routine I've seen that will make individual objects "invisible".  Would that be what you are looking for?
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>

Back to Top
suribalu View Drop Down
Newbie
Newbie


Joined: 03.May.2011
Location: Australia
Using: autocad 2009
Status: Offline
Points: 3
Direct Link To This Post Posted: 04.May.2011 at 12:46
Thanks mate for the reply. If the lisp routine you mentioned can make objects invisible just from a specific viewport while leaving the visibility in model space then that's what I'd be looking for.
Regards,
Suribalu
Back to Top
John Connor View Drop Down
Senior Member
Senior Member


Joined: 01.Feb.2011
Location: United States
Using: AutoCAD 2018
Status: Offline
Points: 7175
Direct Link To This Post Posted: 04.May.2011 at 18:18
Nope.  You would be better off putting the object on its own layer and using viewport freeze.
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>

Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,500 seconds.