Jump to content

Recommended Posts

Posted

Hi to all.

 

I need two subroutines to make visible and invisible objects stored in the variable "SS" of the code below:

(setq SS (ssget "_C" '(0 0)' (0 0)))

 

I would like to be implemented like this:

(VIS "SS") and (INVIS "SS")

 

Can anyone help me?

Thanks in advance.

  • Replies 30
  • Created
  • Last Reply

Top Posters In This Topic

  • antistar

    10

  • BlackBox

    9

  • Lee Mac

    7

  • rkmcswain

    2

Top Posters In This Topic

Posted

You could do something like this also... (change false to true to restore visibility)

 


(setq i 0)
(repeat (sslength ss)
 (setq obj (vlax-ename->vla-object (ssname ss i)))
 (vlax-put-property obj 'Visible :vlax-false)
 (setq i (1+ i))
)

Posted

Is not working...:cry:

 

(vl-load-com)
(setq ss (ssget "_C" '(0 0) '(0 0)))
(if ss (command "_.erase" ss ""))
(setq f (open "c:\\LIST.txt" "r"))
(setq txt (read-line f))
(while (/= nil txt)
 (command "-text" "J" "BL" "0,0" 1 0 txt)
    (setq txt (read-line f))
)
(setq in 0)
(repeat (sslength ss)
 (setq obj (vlax-ename->vla-object (ssname ss in)))
 (vlax-put-property obj 'Visible :vlax-false)
 (setq in (1+ in))
)

Posted

I wrote these a while back, they may assist you:

 

(defun c:AllVis ( / tmp )
 ;; Lee Mac  ~  27.04.10
 
 (if (setq tmp (ssget "_X"))
   
   ( (lambda ( i / e )
       (while (setq e (ssname tmp (setq i (1+ i))))
         (Update
           (PutDXF 60 0 (entget e))
         )
       )
     )
     -1
   )
 )

 (princ)
)

(defun c:Invis ( / tmp )
 ;; Lee Mac  ~  27.04.10

 (if (setq tmp (ssget "_:L"))

   ( (lambda ( i / e )
       (while (setq e (ssname tmp (setq i (1+ i))))
         (Update
           (PutDXF 60 1 (entget e))
         )
       )
     )
     -1
   )
 )

 (princ)
)

(defun PutDXF ( code value elist )
 (entmod
   (if (assoc code elist)
     (subst (cons code value) (assoc code elist) elist)
     (append elist (list (cons code value)))
   )
 )
)

(defun Update ( elist )
 (entupd (cdr (assoc -1 elist)))
)

Posted

Lee,

 

ALLVIS returns error message in CAD2002:

 

Command: allvis
; error: bad argument type: lentityp nil
Coommand

Posted

There are several problems with this, but to identify a few:

 

Is not working...:cry:

 

(vl-load-com)
(setq ss (ssget "_C" '([color=red]0 0[/color]) '([color=red]0 0[/color]))) [color=seagreen]; <- Nothing is selected (nil)[/color]
(if ss (command "_.erase" ss "")) [color=seagreen]; <- So there's nothing to erase (also nil)[/color]
(setq f (open "c:\\LIST.txt" "r"))
(setq txt (read-line f))
(while (/= nil txt)
(command "-text" "J" "BL" "0,0" 1 0 txt)
(setq txt (read-line f))
)
(setq in 0)
(repeat (sslength ss) 
[color=#2e8b57];; You already erased ss entities above[/color]
(setq obj (vlax-ename->vla-object (ssname ss in))) 
[color=seagreen][color=seagreen];; Which throws an error because there's nothing in ss[/color][/color]
[color=seagreen][color=seagreen];; ; error:[/color] bad argument type: VLA-OBJECT nil[/color]
(vlax-put-property obj 'Visible :vlax-false) 
(setq in (1+ in))
)

Posted

RenderMan, thanks for your explanations.

So I'll change my question:

How do I become invisible every object text that is in point 0.0?

Posted
How do I become invisible every object text that is in point 0.0?

 

You're welcome.:)

 

It appears that you are deleting an old text label, and replacing it with a new, and then you want to make that new label invisible... am I correct?

Posted
Lee,

 

ALLVIS returns error message in CAD2002:

 

Command: allvis
; error: bad argument type: lentityp nil
Coommand

 

All seems fine to me - there isn't too much that can go wrong.

Posted
You're welcome.:)

 

It appears that you are deleting an old text label, and replacing it with a new, and then you want to make that new label invisible... am I correct?

 

Exactly, this is it.

Posted
All seems fine to me - there isn't too much that can go wrong.

 

Lee,

 

The function ALLVISs would be very important to me so I make visible all objects in the drawing. But it does not work for me.

Posted
Lee,

 

The function ALLVISs would be very important to me so I make visible all objects in the drawing. But it does not work for me.

 

Have you tried opening a new doc and trying it, or perhaps restart ACAD and try? I can't immediately see anything wrong with my code - unless anyone else can?

Posted
RenderMan, thanks for your explanations.

So I'll change my question:

How do I become invisible every object text that is in point 0.0?

 

Have you tried opening a new doc and trying it, or perhaps restart ACAD and try? I can't immediately see anything wrong with my code - unless anyone else can?

 

Lee, there's a problem in the lambda function that returns this error:

; error: bad argument type: lentityp nil

Posted
Have you tried opening a new doc and trying it, or perhaps restart ACAD and try? I can't immediately see anything wrong with my code - unless anyone else can?

 

Lee,

Restarted AutoCAD and worked perfectly.

Thanks for your help.

Posted
Lee, there's a problem in the lambda function that returns this error:

; error: bad argument type: lentityp nil

 

I wish I could reproduce it... I can't even see the error in the code unless its a typo that I'm overlooking... :?

Posted
I wish I could reproduce it... I can't even see the error in the code unless its a typo that I'm overlooking... :?

 

I'm not sure what it is...??? :?

 

I just did a restart of LDC, Map, and VLIDE... and still the error persits in a new drawing.

Posted

c:Invis works just fine... it is only the c:Allvis that returns an error.

Posted
c:Invis works just fine... it is only the c:Allvis that returns an error.

 

As I say, I cannot see any mistake in my coding.

Posted
As I say, I cannot see any mistake in my coding.

 

Nor can I, Lee... it must be with my machine.

Posted

Lee,

You know how to apply the INVIS function to make invisible all the objects inserted in point 0.0?

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...