Jump to content

LISP for hiding/showing objects...


lamensterms

Recommended Posts

Hey guys,

Been an AutoCAD user for a few years. I am a steel detailer and use add-on programs. Previously I had been using a program called EasySteel – and just recently switched to Prosteel.

Im trying to create a routine which resembles a utility which EasySteel had – but ProSteel is missing.

The idea is that I have a bunch of 3D objects within my model – and I like to hide and show each item as I wish. In EasySteel this procedure was executed using layers – but ProSteel requires a different method. ProSteel does have its own hide and show commands, but they aren’t as functional as EasySteel’s was.

What I would like to achieve is as follows:

1. - There are multiple objects within a model, and I hide some of them to be able to work with more clarity.

2. - Using ProSteel’s hide command – any number of obects can be hidden.

3. - Now… of the objects that are hidden – I would like to be able to select a specific few to show (I do not wish to show ALL hidden objects, but rather show any objects I select, leaving the already showing objects still visible).

So the procedure would be as follows.

- 1. Hide some objects.

- 2. Decide I wish to show SOME of the objects I have hidden.

- 3. Enable a temporary preview of ALL objects within model – allowing me to select which objects I want to show.

- 4. Once I have picked the objects to show – the temp preview of the full model is ended, all objects visible before the command are sill visible, as well as any objects I have selected during the temporary preview.

I have written a LISP routine for this (though it’s a little sloppy) – it does work most of the time.

Sometimes… the lisp routine does not work though – if I have some objects hidden… then I select objects I wish to show…. ALL objects become visible (not just the ones I select).

So, can someone please help me refine this routine – or offer me any advice on an alternate method for setting this up?

The two Prosteel commands used in this routine are:

- "Ps_Regen" – shows all objects in model (I use this for my temp preview to select which objects to show.

- "Ps_Hide_exclude” – hides all objects in model except any selected.

I have attached my routine - and my code is below.

Thanks for any help.

 

(defun c:ss (/ pt1 pt2 sset1 sset2)
(setq pt1 '( -500000000 -500000000 -500000000))
(setq pt2 '( 500000000 500000000 500000000))
(command "zoom" "all")
(setq sset1 (ssget "W" pt1 pt2))
(command "zoom" "P")
(command "Ps_Regen")
(setq sset2 (ssget))
(command "Ps_Hide_exclude" sset1 sset2 "")
(princ)
)

 

ShowSteel.LSP

Link to comment
Share on other sites

Just i don't know how you can select ss that hidden ??

You can use acet-ss-visible to show or hide a specify ss, don't sure that is what you need

Example :

(setq ss1 (ssget) ss2 (ssget))
 (acet-ss-visible ss1 1) ; hide ss1
 (acet-ss-visible ss2 1) ; hide ss2
 (acet-ss-visible ss1 0) ; un-hide ss1

So you can improve : unhide all, ssget with method "C","W","CP","WP".., then re-hide all except items you want to show

 

(Srr, my English not well)

Link to comment
Share on other sites

can you explain what an addon to AutoCAD is and how does this program organise the differnet objects but an object name or a difference in entity i.e. layers

 

or have i understood your question wrong do you want to click on things and then hide them or want to hide all of a paricutar type on many different dwgs

 

also i could write a lisp that would allow you select objects and place them on a hidden layer which you can turn on an off.

(defun nfl ()
 (command: "-layer" "new" "HIDDED" "freeze" "HIDDEN" " ")
 );defun nl
(defun c:ho ()
 (setq objects (ssget)) ;selects objects
 (nfl)(command: "change" objects "properties" "LAyer" "HIDDEN") ;places objects on a hidden layer

(see later post by other members for better techniques.)

this needs a way to unfreeze and place on original layer there is an easy way to do this but i have forgoten

Edited by SunnyTurtle
add,
Link to comment
Share on other sites

ketxu

 

The way i create a selection set from hidden objects - is that i temporarily show all objects, then select items i want shown, then the preview ends and i am left with objects i selected during the preview as well as the objects i had shown before i began the 'show' command - and the objects i didnt select are hidden.

 

can you please explain the 'acet-ss-visible' function?

 

 

SunnyTurtle

 

Im not exactly sure how prosteel hides and shows objects (ive heard its to do with the DXF display mode... but i really dont know) - it is not with layers though. I have written a routine that will do what i need (by moving objects to frozen/off layers) but i would rather not do it this way. The problem would be that i have lots of objects on many different layers. So in order to hide any object i would have to move it onto a frozen/off layer - but then i would like to restore it to its original layer (the layer it was on before it was hidden.

 

for example... if i have 2 objects in my model - 1 beam and 1 column... the beam is on a layer called "BEAM" and the column is on a layer called "COLUMN". I could hide these 2 objects by moving them both onto a layer called "HIDDEN" and having the "HIDDEN" layer turned off or frozen. But then when i wish to have these 2 objects un-hidden (shown)... how could i restore the beam to the "BEAM" layer and the column to the "COLUMN" layer.

 

 

thanks for your help guys.

Edited by lamensterms
Link to comment
Share on other sites

If I were to take a stab at this....

 

I'd first make selection set of the objects to hide, and store the vla-objects to a global variable as a list, then set the visible property to :vlax-false. To unhide only a selection within the original hidden group, I'd restore the visibility to :vlax-true, but modify their color so they stand out visually. Any objects selected would be stored to a list and if vl-position the item in the hidden list, unhide, and remove from the list.

 

Note - Good *error* handling, and a reactor are needed in order to prevent accidental saving etc. of the drawing with objects hidden. Also do not forget to account for UNDO. :wink:

Link to comment
Share on other sites

hey RenderMan,

 

thanks for the reply mate. Im afraid i am quite new and very inexperienced when it come to LISP. Many (if not all) of my routines are just compilations of other routines and i know very little about lists and such.

 

Having said that... my experience is limited to AutoLISP - and i know nothing about VLISP and the macros.

 

Error handling and reactors are also beyond me - my routine does fail miserably if i escape out of it or select no objects to show... but i can undo back though the command.

 

Ive still got a lot to learn.

 

Thanks again.

Link to comment
Share on other sites

I've posted but it doesn't display, so i re-post. If it duplicate, please del ^^

Use :

 (acet-ss-visible ss flag)
- ss :  Selection set
- flag : accept two value
        + 0 : visible SS
        + 1 : invisible SS

Remember that you've installed Express for using ACET-*** functions

- You can use acet-ss-redraw

(acet-ss-redraw ss flag)
- ss : Selection set
-  flag : 
 + 1 : show normal
 + 2 : invisible SS
 + 3 :  highlight SS
 + 4 : un-highlight

So you can start ur idea now, just working with SS ^^

Link to comment
Share on other sites

Here are 3 functions that should work:

 

 

[color=#8b4513];+++++++++++++ Hide Selected Entites +++++++++++++++++++++++++++++[/color]
[b][color=BLACK]([/color][/b]defun c:hse [b][color=FUCHSIA]([/color][/b]/ ss en ed[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]not [b][color=MAROON]([/color][/b]tblsearch [color=#2f4f4f]"APPID"[/color] [color=#2f4f4f]"HIDE"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]regapp [color=#2f4f4f]"HIDE"[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]if [b][color=NAVY]([/color][/b]not [b][color=MAROON]([/color][/b]tblsearch [color=#2f4f4f]"LAYER"[/color] [color=#2f4f4f]"HIDE"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
     [b][color=NAVY]([/color][/b]command [color=#2f4f4f]"_.LAYER"[/color] [color=#2f4f4f]"_New"[/color] [color=#2f4f4f]"HIDE"[/color] [color=#2f4f4f]"_F"[/color] [color=#2f4f4f]"HIDE"[/color] [color=#2f4f4f]""[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]if [b][color=NAVY]([/color][/b]/= [b][color=MAROON]([/color][/b]getvar [color=#2f4f4f]"CLAYER"[/color][b][color=MAROON])[/color][/b] [color=#2f4f4f]"HIDE"[/color][b][color=NAVY])[/color][/b]
     [b][color=NAVY]([/color][/b]command [color=#2f4f4f]"_.LAYER"[/color] [color=#2f4f4f]"_Freeze"[/color] [color=#2f4f4f]"HIDE"[/color] [color=#2f4f4f]""[/color][b][color=NAVY])[/color][/b]
     [b][color=NAVY]([/color][/b]command [color=#2f4f4f]"_.LAYER"[/color] [color=#2f4f4f]"_UnLock"[/color] [color=#2f4f4f]"0"[/color] [color=#2f4f4f]"_ON"[/color] [color=#2f4f4f]"0"[/color] [color=#2f4f4f]"_Thaw"[/color] [color=#2f4f4f]"0"[/color] [color=#2f4f4f]"_Set"[/color] [color=#2f4f4f]"0"[/color]
                        [color=#2f4f4f]"_Freeze"[/color] [color=#2f4f4f]"HIDE"[/color] [color=#2f4f4f]""[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]princ [color=#2f4f4f]"\nSelect Entities To Make InVisible"[/color][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]setq ss [b][color=MAROON]([/color][/b]ssget [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]cons 8 [color=#2f4f4f]"~HIDE"[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]while [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss 0[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]setq ed [b][color=GREEN]([/color][/b]entget en[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]add_xdata_str en [color=#2f4f4f]"HIDE"[/color] [b][color=GREEN]([/color][/b]cdr [b][color=BLUE]([/color][/b]assoc 8 ed[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]ssdel en ss[b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]command [color=#2f4f4f]"_.CHPROP"[/color] en [color=#2f4f4f]""[/color] [color=#2f4f4f]"_LAyer"[/color] [color=#2f4f4f]"HIDE"[/color] [color=#2f4f4f]""[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

[color=#8b4513];+++++++++++++ Restore ALL HIDE Layer Entities To Original Layer +++++[/color]
[b][color=BLACK]([/color][/b]defun c:rae [b][color=FUCHSIA]([/color][/b]/ ss en xl0 xl1 xl2 xl3[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]setq ss [b][color=MAROON]([/color][/b]ssget [color=#2f4f4f]"X"[/color] [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]cons 8 [color=#2f4f4f]"HIDE"[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]while [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss 0[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]setq xl0 [b][color=GREEN]([/color][/b]entget en '[b][color=BLUE]([/color][/b][color=#2f4f4f]"HIDE"[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                   xl1 [b][color=GREEN]([/color][/b]cdr [b][color=BLUE]([/color][/b]assoc -3 xl0[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                   xl2 [b][color=GREEN]([/color][/b]cdr [b][color=BLUE]([/color][/b]assoc [color=#2f4f4f]"HIDE"[/color] xl1[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                   xl3 [b][color=GREEN]([/color][/b]cdr [b][color=BLUE]([/color][/b]assoc 1000 xl2[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]command [color=#2f4f4f]"_.CHPROP"[/color] en [color=#2f4f4f]""[/color] [color=#2f4f4f]"_LA"[/color] xl3 [color=#2f4f4f]""[/color][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]ssdel en ss[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

[color=#8b4513];+++++++++++++ Restore Partial HIDE Layer Entities To Original Layer +++++[/color]
[b][color=BLACK]([/color][/b]defun c:rpe [b][color=FUCHSIA]([/color][/b]/ ss en xl0 xl1 xl2 xl3[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]if [b][color=NAVY]([/color][/b]not [b][color=MAROON]([/color][/b]tblsearch [color=#2f4f4f]"LAYER"[/color] [color=#2f4f4f]"HIDE"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
     [b][color=NAVY]([/color][/b]alert [color=#2f4f4f]"There are no hidden entities on layer HIDE"[/color][b][color=NAVY])[/color][/b]
     [b][color=NAVY]([/color][/b]progn
       [b][color=MAROON]([/color][/b]command [color=#2f4f4f]"_.LAYER"[/color] [color=#2f4f4f]"_T"[/color] [color=#2f4f4f]"HIDE"[/color] [color=#2f4f4f]""[/color][b][color=MAROON])[/color][/b]
       [b][color=MAROON]([/color][/b]princ [color=#2f4f4f]"\nSelect Hidden Entities To Make Visible"[/color][b][color=MAROON])[/color][/b]
       [b][color=MAROON]([/color][/b]and [b][color=GREEN]([/color][/b]setq ss [b][color=BLUE]([/color][/b]ssget [b][color=RED]([/color][/b]list [b][color=PURPLE]([/color][/b]cons 8 [color=#2f4f4f]"HIDE"[/color][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
            [b][color=GREEN]([/color][/b]while [b][color=BLUE]([/color][/b]setq en [b][color=RED]([/color][/b]ssname ss 0[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b]
                   [b][color=BLUE]([/color][/b]setq xl0 [b][color=RED]([/color][/b]entget en '[b][color=PURPLE]([/color][/b][color=#2f4f4f]"HIDE"[/color][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b]
                         xl1 [b][color=RED]([/color][/b]cdr [b][color=PURPLE]([/color][/b]assoc -3 xl0[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b]
                         xl2 [b][color=RED]([/color][/b]cdr [b][color=PURPLE]([/color][/b]assoc [color=#2f4f4f]"HIDE"[/color] xl1[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b]
                         xl3 [b][color=RED]([/color][/b]cdr [b][color=PURPLE]([/color][/b]assoc 1000 xl2[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b]
                   [b][color=BLUE]([/color][/b]command [color=#2f4f4f]"_.CHPROP"[/color] en [color=#2f4f4f]""[/color] [color=#2f4f4f]"_LA"[/color] xl3 [color=#2f4f4f]""[/color][b][color=BLUE])[/color][/b]
                   [b][color=BLUE]([/color][/b]ssdel en ss[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
       [b][color=MAROON]([/color][/b]command [color=#2f4f4f]"_.LAYER"[/color] [color=#2f4f4f]"_F"[/color] [color=#2f4f4f]"HIDE"[/color] [color=#2f4f4f]""[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

[color=#8b4513];++++++++++++ Add XDATA String To An Entity ++++++++++++++++++++++[/color]
[b][color=BLACK]([/color][/b]defun add_xdata_str [b][color=FUCHSIA]([/color][/b]e a v[b][color=FUCHSIA])[/color][/b][color=#8b4513];;;EName APPID String_value[/color]
 [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]= [b][color=MAROON]([/color][/b]type a[b][color=MAROON])[/color][/b] 'STR[b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]not [b][color=MAROON]([/color][/b]tblsearch [color=#2f4f4f]"APPID"[/color] a[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]regapp a[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]= [b][color=MAROON]([/color][/b]type e[b][color=MAROON])[/color][/b] 'ENAME[b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]= [b][color=MAROON]([/color][/b]type v[b][color=MAROON])[/color][/b] 'STR[b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]entmod
        [b][color=MAROON]([/color][/b]append [b][color=GREEN]([/color][/b]entget e[b][color=GREEN])[/color][/b]
          [b][color=GREEN]([/color][/b]list
           [b][color=BLUE]([/color][/b]cons -3
            [b][color=RED]([/color][/b]list
             [b][color=PURPLE]([/color][/b]cons a
              [b][color=TEAL]([/color][/b]list [b][color=OLIVE]([/color][/b]cons 1000 v[b][color=OLIVE])[/color][/b][b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

 

 

Be sure to load the entire code as add_xdata_str is a global function.

 

Hopefully, you are not using a layer named HIDE in other scenarios. This allows for the selections to carried from 1 acad session to another.

 

Adding an error trap and sysvar mode setting would be advisable for a robust routine. -David

Link to comment
Share on other sites

that's very clever David. i like it. :)

replace command with vla and will be perfect

 

Thanks. I don't have access to vl* calls in most of the versions I run so I get to stick with (command....

 

-David

Link to comment
Share on other sites

Thanks so much for all your replies guys.

 

David

 

That routine does work well on ordinary AutoCAD entitiest (lines, solids, etc)… but im afraid it wont run on ProSteel objects. Im thinking it must have something to do with assigning the XDATA.

 

ProSteel has a proprietary object type that is uses to contain all necessary data. These are 3D objects, but not ACIS solids.

 

Thanks for your efforts though.

 

 

Thanks a lot to everyone else for the pointers… looks like ill have to do some reading on VLA functions and VLISP.

 

I shall let you all know how I go.

Link to comment
Share on other sites

Hmmmmm That's strange. I've used this scenario for 10+ years and never ran across anything that it couldn't handle ( excluding VIEWPORT entities ). Can you post a sample dwg? -David

Link to comment
Share on other sites

Hi again David,

 

I have attached a .DWG (2000) containing some ProSteel objects. Though i have noticed that if the program ProSteel is not running - AutoCAD can only recognise these objects as "ACAD_PROXY_ENTITY" - rather than the true ProSteel shape.

 

Though it should still demonstrate how the routine wont run on these object types.

 

Thanks again mate.

 

Sample_ProSteel_Objects.dwg

 

ps:... i think i may have increased the reliability of my original routine... simply by making sure the UCS is not in 'world' while the routine is running. Still experimenting - its seems that ProSteels show/hide function is not completely stable - hence my routine also being unstable.

Link to comment
Share on other sites

How about ASMITOOLS?

;; ==================================================================== ;;

;; ;;

;; INVIS.LSP - Makes objects temporarily invisible and ;;

;; returns visibility. ;;

;; ;;

;; ==================================================================== ;;

;; ;;

;; Command(s) to call: INVIS ;;

;; ;;

;; ==================================================================== ;;

;; ;;

;; THIS PROGRAM AND PARTS OF IT MAY REPRODUCED BY ANY METHOD ON ANY ;;

;; MEDIUM FOR ANY REASON. YOU CAN USE OR MODIFY THIS PROGRAM OR ;;

;; PARTS OF IT ABSOLUTELY FREE. ;;

;; ;;

;; THIS PROGRAM PROVIDES 'AS IS' WITH ALL FAULTS AND SPECIFICALLY ;;

;; DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS ;;

;; FOR A PARTICULAR USE. ;;

;; ;;

;; ==================================================================== ;;

;; ;;

;; V1.1, 11th Apr 2005, Riga, Latvia ;;

;; © Aleksandr Smirnov (ASMI) ;;

;; For AutoCAD 2000 - 2008 (isn't tested in a next versions) ;;

;; ;;

;; http://www.asmitools.com ;;

;; ==================================================================== ;;

;

AsmiTools

Link to comment
Share on other sites

Hi VVA,

 

I have tried the INVIS LISP - im afraid it offers no greater functionality than ProSteel's existing hide/show command.

 

INVIS will let me select objects i wish to hide - but it will not let me select which objects to reveal - it will only reveal ALL hidden objects. So you can hide 50% of your model - but then you cannot reveal a small percent of that 50% which is hidden.

 

If you know what i mean.

 

Thanks anyway mate.

Link to comment
Share on other sites

a few more links

HideShow - hide selected objects from AutoCAD drawing (VLX for AutoCAD)

Easily hide and isolate objects in AutoCAD 2011

Freeze Object(s)

Quick and dirty

(defun c:invis (/ errCount wMode objSet showset actDoc *error*)
 ;; ==================================================================== ;;
 ;;                                                                      ;;
 ;;  INVIS.LSP - Makes objects temporarily invisible and                 ;;
 ;;              visible return of all or some                           ;;
 ;;                                                                      ;;
 ;; ==================================================================== ;;
 ;;                                                                      ;;
 ;;  Command(s) to call: INVIS                                           ;;
 ;;                                                                      ;;
 ;; ==================================================================== ;;
 ;;                                                                      ;;
 ;;  THIS PROGRAM AND PARTS OF IT MAY REPRODUCED BY ANY METHOD ON ANY    ;;
 ;;  MEDIUM FOR ANY REASON. YOU CAN USE OR MODIFY THIS PROGRAM OR        ;;
 ;;  PARTS OF IT ABSOLUTELY FREE.                                        ;;
 ;;                                                                      ;;
 ;;  THIS PROGRAM PROVIDES 'AS IS' WITH ALL FAULTS AND SPECIFICALLY      ;;
 ;;  DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS        ;;
 ;;  FOR A PARTICULAR USE.                                               ;;
 ;;                                                                      ;;
 ;; ==================================================================== ;;
 ;;                                                                      ;;
 ;;  V1.1, 11th Apr 2005, Riga, Latvia                                   ;;
 ;;  © Aleksandr Smirnov (ASMI)                                          ;;
 ;;  For AutoCAD 2000 - 2008 (isn't tested in a next versions)           ;;
 ;;                                                                      ;;
 ;;http://www.cadtutor.net/forum/showthread.php?43876-AsmiTools          ;;
 ;; ==================================================================== ;;
 ;;                                                                      ;;
 ;;  V1.2, 02 June 2011, Minsk, Belarus                                  ;;
 ;;  © Vladimir Azarko (VVA)                                             ;;
 ;;  For AutoCAD 2000 - 2011 (isn't tested in a next versions)           ;;
 ;; Add mode "Show some object"                                          ;;
 ;;  V1.3, 04 may 2013, Minsk, Belarus                                   ;;
 ;;  © Vladimir Azarko (VVA)                                             ;;
 ;;  For AutoCAD 2000 - 2011 (isn't tested in a next versions)           ;;
 ;; Add mode "Show selected Only"                                        ;;
 ;;                                                                      ;;
 ;;http://www.cadtutor.net/forum/showthread.php?59655                    ;;
 ;; ==================================================================== ;;
 ;;                                                                      ;;

 (vl-load-com)
 (defun put_Visible_Prop (Object Flag)
   (if
     (vl-catch-all-error-p
(vl-catch-all-apply
  'vla-put-visible
  (list Object Flag)
)
     )
      (setq errCount (1+ errCount))
   );_ end if
   (princ)
 );_ end of put_Visible_Prop
 (defun Set_to_List (SelSet)
   (mapcar 'vlax-ename->vla-object
    (vl-remove-if
      'listp
      (mapcar 'cadr (ssnamex SelSet))
    )
   )
 );_ end of Set_to_List
 (defun errMsg	()
   (if	(/= 0 errCount)
     (princ (strcat ", "
	     (itoa errCount)
	     " were on locked layer."
     )
     )
     "."
   );_ end if
 );_ end of errMsg
 (setq	actDoc	 (vla-get-ActiveDocument
	   (vlax-get-Acad-object)
	 )
errCount 0
 );_ end setq
 (vla-StartUndoMark actDoc)
 (initget "Visible Invisible Show Only" 1)
 (setq	wMode
 (getkword
   "\nMake objects [Visible all/Invisible/Show some invisible objects/show selected Only]: "
 )
 )
 (cond
   ((and
      (= wMode "Visible")
      (setq objSet (ssget "_X" '((60 . 1))))
    );_ end and
    (setq objSet (Set_to_List objSet))
    (mapcar
      '(lambda (x) (put_Visible_Prop x :vlax-true))
      objSet
    )
    (princ
      (strcat "\n<< "
       (itoa (- (length objSet) errCount))
       " now visible"
       (errMsg)
       " >>"
      )
    )
   ) ;_ # condition
   ((and
      (= wMode "Show")
      (setq objSet (ssget "_X" '((60 . 1))))
    );_ end and
    (setq objSet (Set_to_List objSet))
    (mapcar
      '(lambda (x) (put_Visible_Prop x :vlax-true))
      objSet
    )
    (princ
      (strcat "\n<< "
       (itoa (- (length objSet) errCount))
       " now visible"
       (errMsg)
       " >>"
      )
    )
    (princ "\nSelect objects to show")
    (if (setq showset (ssget "_:L"))
      (progn
 (setq showset (Set_to_List showset))
 (foreach item showset
   (setq objSet (vl-remove item objSet))
 )
 (mapcar
   '(lambda (x) (put_Visible_Prop x :vlax-false))
   objSet
 )
      )
    )
   ) ;_ # condition
   ((= wMode "Only")
    (if (not (setq objSet (ssget "_I")))
      (setq objSet (ssget))
    ) ;_ end if
    (if (and objset (setq objSet (Set_to_List objSet)))
      (progn
 (setq showset (ssget "_X" (list (cons 410 (getvar 'Ctab))))
       showset (Set_to_List showset)
 )
 (foreach item objSet
   (setq showset (vl-remove item showset))
 )
 (mapcar
   '(lambda (x) (put_Visible_Prop x :vlax-false))
   showset
 )
 (princ
   (strcat "\n<< "
	   (itoa (- (length showset) errCount))
	   " now invisible"
	   (errMsg)
	   " >>"
   )
 )
      )
    )
   ) ;_ # condition
   (t
    (if (not (setq objSet (ssget "_I")))
      (setq objSet (ssget))
    );_ end if
    (if objSet
      (progn
 (setq objSet (Set_to_List objSet))
 (mapcar
   '(lambda (x) (put_Visible_Prop x :vlax-false))
   objSet
 )
 (princ
   (strcat "\n<< "
	   (itoa (- (length objSet) errCount))
	   " now invisible"
	   (errMsg)
	   " >>"
   )
 )
      );_ end progn
    );_ end if
   )
 );_ end cond
 (vla-EndUndoMark actDoc)
 (princ)
);_ end of c:invis
(mapcar 'princ
(list
 "\n[info] http://www.cadtutor.net/forum/showthread.php?59655 [info]"
 "\nType INVIS to make objects invisible or visible."
)
)	
(princ)

Edited by VVA
add option "Show selected only" see #18
  • Like 1
Link to comment
Share on other sites

  • 1 year later...

This is the thing I was looking for. Perfect. Thank you.

Only one question: Is possible to extend it to another option as "Show selected only"

Similar to AutoCAD's "Isolate Object".

I know it is older post but will waiting for answer.

Thank you again.

Link to comment
Share on other sites

Guest kruuger
This is the thing I was looking for. Perfect. Thank you.

Only one question: Is possible to extend it to another option as "Show selected only"

Similar to AutoCAD's "Isolate Object".

I know it is older post but will waiting for answer.

Thank you again.

try this. CadPack required

http://forum.cad.pl/cadpl-pack-v1-lsp-t78161.html

kruuger

FadeUnhideFast.lsp

Link to comment
Share on other sites

Great tool as well. Added to toolbar, but I need extension to VVA program, something works exactly like "Isolate Objects" in AutoCAD, but only extension to VVA program.

Let say I need to isolate two items from entire dwg, I select them and only this item stay visible and rest of them disappear.

Maybe header "Show selected only" is misleading. It s/b "Isolate selected only from entire dwg"

Sorry for confusion.

Edited by mdbdesign
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...