BlackBox Posted August 24, 2010 Posted August 24, 2010 Change this line, perhaps? (defun c:Invis ( / tmp ) ;; Lee Mac ~ 27.04.10 [color=seagreen];; (if (setq tmp (ssget "_:L"))[/color] [color=red](if (setq tmp (ssget "_x" '((10 0 0 0))))[/color] ( (lambda ( i / e ) (while (setq e (ssname tmp (setq i (1+ i)))) (Update (PutDXF 60 1 (entget e)) ) ) ) -1 ) ) (princ) ) Quote
alanjt Posted August 24, 2010 Posted August 24, 2010 Earlier (apparently even as new as 2009) versions don't like the 60 code (60 . 0) of visibility being appended to a visible object. Just have it check if the code exists and then update, otherwise, just ignore. eg. (if (assoc 60 .... Quote
Lee Mac Posted August 24, 2010 Posted August 24, 2010 Earlier (apparently even as new as 2009) versions don't like the 60 code (60 . 0) of visibility being appended to a visible object. Just have it check if the code exists and then update, otherwise, just ignore. eg. (if (assoc 60 .... Oo! Didn't know that - thanks Alan Quote
antistar Posted August 24, 2010 Author Posted August 24, 2010 Change this line, perhaps? (defun c:Invis ( / tmp ) ;; Lee Mac ~ 27.04.10 [color=seagreen];; (if (setq tmp (ssget "_:L"))[/color] [color=red](if (setq tmp (ssget "_x" '((10 0 0 0))))[/color] ( (lambda ( i / e ) (while (setq e (ssname tmp (setq i (1+ i)))) (Update (PutDXF 60 1 (entget e)) ) ) ) -1 ) ) (princ) ) Is not working... Quote
Lee Mac Posted August 24, 2010 Posted August 24, 2010 Updated for completeness: (defun c:AllVis ( / tmp ) ;; © Lee Mac 2010 (if (setq tmp (ssget "_X")) ( (lambda ( i / e l ) (while (setq e (ssname tmp (setq i (1+ i)))) (if (assoc 60 (setq l (entget e))) (entupd (cdr (assoc -1 (entmod (subst (cons 60 0) (assoc 60 l) l) ) ) ) ) ) ) ) -1 ) ) (princ) ) (defun c:Invis ( / tmp ) ;; © Lee Mac 2010 (if (setq tmp (ssget "_:L")) ( (lambda ( i / e l ) (while (setq e (ssname tmp (setq i (1+ i)))) (entupd (cdr (assoc -1 (entmod (if (assoc 60 (setq l (entget e))) (subst (cons 60 1) (assoc 60 l) l) (append l (list (cons 60 1))) ) ) ) ) ) ) ) -1 ) ) (princ) ) Quote
BlackBox Posted August 24, 2010 Posted August 24, 2010 Updated for completeness: ....What happens if the user were to define/undefine subsequent selection sets between the Invis, and AllVis commands? [edit] This would not pose a problem, as AllVis steps through all items in the drawing's database, correct? [/edit] Quote
alanjt Posted August 25, 2010 Posted August 25, 2010 Oo! Didn't know that - thanks Alan You're welcome. ....What happens if the user were to define/undefine subsequent selection sets between the Invis, and AllVis commands? [edit] This would not pose a problem, as AllVis steps through all items in the drawing's database, correct? [/edit] Correct. Quote
rkmcswain Posted August 25, 2010 Posted August 25, 2010 There are several problems with this, but to identify a few: (setq ss (ssget "_C" '(0 0) '(0 0))) ; <- Nothing is selected (nil) Not necessarily true. Anything that lies on 0,0 will be selected with this (ssget) statement. For example, a line from -1,-1 to 1,1, or a point at 0,0, etc. Quote
antistar Posted August 25, 2010 Author Posted August 25, 2010 Lee, McSwain, Alan and RenderMan, His tips were very helpful. Thank you very much. Quote
BlackBox Posted August 25, 2010 Posted August 25, 2010 Not necessarily true. Anything that lies on 0,0 will be selected with this (ssget) statement.For example, a line from -1,-1 to 1,1, or a point at 0,0, etc. RK, you're absolutley right ... Thanks for the clarification. Quote
ksperopoulos Posted July 20, 2016 Posted July 20, 2016 Lee, Nice piece of code as always! I am trying to figure out if I can slightly modify this though to suit my needs. I need to select objects within an xref instead of the main model. Whenever I have tried writing my own version of this in the past, the visibility setting of each object was actually being save inside the xref file. The only way I could make the objects visible again was to open the xref file and run the second part of my code. Is there a way to control the visibility of xref objects within the file that has the attached xref instead of within the xref file itself? I tried changing your (ssget "_X") to (ssget "_:N") but that did not work. Quote
Recommended Posts
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.