TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Amsterdammed on February 07, 2006, 11:06:28 AM
-
Hello everybody,
Is there a way to set a layer on no plot with entmod?
Thanks in advance,
Bernd
-
Yes....here is a small lisp function I posted to the Adesk newsgroup a few weeks ago to toggle the noplot status of the given layer:
;;usage (noplotlay "0")
(defun noplotlay (layname / lay entlist assoc290)
(if (setq lay (tblobjname "LAYER" layname))
(progn
(setq entlist (entget lay)
assoc290 (assoc 290 entlist)
)
(entmod (subst (cons 290 (- 1 (cdr assoc290))) assoc290 entlist))
)
)
(princ)
)
-
Jeff,
Not only that you solved my problem, I also learned a lot about the whole table thing. I was looking with tblsearch and did not find anything. Now I see… :roll:
Thanks a lot
Bernd
-
to set /unset Bits it's better to use the boole / logand / logior functions. Only -1 can produce an error when GC 290 = 0 ..
(defun DT:LAYER-PUT-PLOTTABLE-GC (LAYER PLOTABLE? / DATA)
(if (not LAYER) (setq LAYER (getvar "CLAYER")))
(and(setq DATA (tblobjname "LAYER" LAYER))
(setq DATA (entget DATA))
(if(not(member PLOTABLE? '(nil 0 "no")))
(entmod(subst(cons 290 (boole 7(cdr(assoc 290 DATA))1))(assoc 290 DATA)DATA))
(entmod(subst(cons 290 (boole 2(cdr(assoc 290 DATA))1))(assoc 290 DATA)DATA))
)
)
)
usage:
(DT:LAYER-PUT-PLOTTABLE-GC "0" nil)
-
CADmium,
Personal preference < and probably also more conventional > :
PLOTABLE? would be T or nil
and the test would become
(if PLOTABLE?
(bla lba ..
;else
(bla bla
)
-
CADmium,
Personal preference < and probably also more conventional > :
PLOTABLE? would be T or nil
and the test would become
(if PLOTABLE?
(bla lba ..
;else
(bla bla
)
(http://www.cadwiesel.de/T2/www/images/ka.gif) .. how you like it .. i think , this changes are not a problem .. maybe , the member-function is confusing
-
>>> .. maybe , the member-function is confusing
hehehehe
nope, not at all :-)
-
to set /unset Bits it's better to use the boole / logand / logior functions. Only -1 can produce an error when GC 290 = 0 ..
I don't follow.....if I want a pure toggle, turn on/off plotting no matter what it is currently set to I see no need for using boole.
(- 1 0) = 1
(- 1 1) = 0
Very simple so that those trying to learn can understand it. And although I recall having used boole in the past, relooking at the help for it I found myself confused in it's use until I sat down and toyed with it.
-
@Jeff_M :sorry i read it as (- (cdr assoc290) -1) <dream> , but boole is the better way ... universally .. for instance when you also want to manipulate the Freeze-Bit or the Locked Bit of a layer ( both GC 70)
for toogle a bool - 0 or 1 - ... I also use (- 1 Bool)
-
to set /unset Bits it's better to use the boole / logand / logior functions. Only -1 can produce an error when GC 290 = 0 ..
(defun DT:LAYER-PUT-PLOTTABLE-GC (LAYER PLOTABLE? / DATA)
(if (not LAYER) (setq LAYER (getvar "CLAYER")))
(and(setq DATA (tblobjname "LAYER" LAYER))
(setq DATA (entget DATA))
(if(not(member PLOTABLE? '(nil 0 "no")))
(entmod(subst(cons 290 (boole 7(cdr(assoc 290 DATA))1))(assoc 290 DATA)DATA))
(entmod(subst(cons 290 (boole 2(cdr(assoc 290 DATA))1))(assoc 290 DATA)DATA))
)
)
)
usage:
(DT:LAYER-PUT-PLOTTABLE-GC "0" nil)
Another way to phrase it.
(defun dt:layer-put-plottable-gc (layer plotable? / data n)
(or layer (setq layer (getvar "CLAYER")))
(setq n (if (or plotable? (member plotable? '(1 "yes" "YES")) 7 2)))
(and (setq data (tblobjname "LAYER" layer))
(setq data (entget data))
(entmod (subst (cons 290 (boole n (cdr (assoc 290 data)) 1)) (assoc 290 data) data))
)
)
-
This
'(1 "yes" "YES")
should be expanded to this
'(1 "yes" "YES" "Y" "Yes" "OK" Yep" "Youbetcha" "Alrightythen" "UhHuh")
which brings me to my point.....if you are going to do something like this, then I agree with Kerry PLOTABLE? would be T or nil
Alan, this makes no sense to me:(or plotable? (member plotable? '(1 "yes" "YES")))
if plotable is nil it will fail the first test which means it will also fail the second test, if it's not nil then it will never make it to the second test (and you have a misplaced ")")
-
OK, I screwed that up.:)
Let me try again with a simpler version.
I did test this one. :oops:
;; layer must be string layer name or nil for current
;; plotable? must be nil or not nil
(defun dt:layer-put-plottable-gc (layer plotable? / data)
(or layer (setq layer (getvar "CLAYER")))
(and (setq data (tblobjname "LAYER" layer))
(setq data (entget data))
(entmod (subst (cons 290 (if plotable? 1 0)) (assoc 290 data) data))
)
)
-
I think he meant to do this:
(and plotable? (member plotable? '(T 1 "yes" "YES")))
but I agree with CAB:
(cons 290 (if plotable? 1 0))
who cares what the original value was. We are setting it explicitly anyway.
-
Gentlemen,
I asked a simple Question......
-
.......and got 3,427,633 simple solutions.............LOL
The neat part?? MOST of them even work!! What a place!
-
Hello everybody,
Is there a way to set a layer on no plot with entmod?
Thanks in advance,
Bernd
yes
-
Bernd
Is that simple answer you were looking for? :lmao: