Author Topic: set layer to no plot  (Read 5806 times)

0 Members and 1 Guest are viewing this topic.

Amsterdammed

  • Guest
set layer to no plot
« 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

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: set layer to no plot
« Reply #1 on: February 07, 2006, 11:34:19 AM »
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:
Code: [Select]
;;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)
  )

Amsterdammed

  • Guest
Re: set layer to no plot
« Reply #2 on: February 07, 2006, 12:15:11 PM »
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

CADmium

  • Newt
  • Posts: 33
Re: set layer to no plot
« Reply #3 on: February 08, 2006, 01:42:16 AM »
to set /unset Bits it's better to use the boole / logand / logior functions. Only -1 can produce an error when GC 290 = 0 ..

Code: [Select]
(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)
"Bei 99% aller Probleme ist die umfassende Beschreibung des Problems bereits mehr als die Hälfte der Lösung desselben."

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: set layer to no plot
« Reply #4 on: February 08, 2006, 02:08:19 AM »
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
)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

CADmium

  • Newt
  • Posts: 33
Re: set layer to no plot
« Reply #5 on: February 08, 2006, 04:22:30 AM »
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
)

.. how you like it .. i think , this changes are not a problem .. maybe , the member-function is confusing
"Bei 99% aller Probleme ist die umfassende Beschreibung des Problems bereits mehr als die Hälfte der Lösung desselben."

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: set layer to no plot
« Reply #6 on: February 08, 2006, 04:24:21 AM »
>>> .. maybe , the member-function is confusing

hehehehe

nope, not at all :-)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: set layer to no plot
« Reply #7 on: February 08, 2006, 09:39:11 AM »
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.

CADmium

  • Newt
  • Posts: 33
Re: set layer to no plot
« Reply #8 on: February 08, 2006, 10:43:05 AM »
@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)
"Bei 99% aller Probleme ist die umfassende Beschreibung des Problems bereits mehr als die Hälfte der Lösung desselben."

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: set layer to no plot
« Reply #9 on: February 08, 2006, 11:53:09 AM »
to set /unset Bits it's better to use the boole / logand / logior functions. Only -1 can produce an error when GC 290 = 0 ..

Code: [Select]
(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.
Code: [Select]
(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))
  )
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: set layer to no plot
« Reply #10 on: February 08, 2006, 12:08:16 PM »
This
Code: [Select]
'(1 "yes" "YES") should be expanded to this
Code: [Select]
'(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
Quote from: Kerry Brown
PLOTABLE? would be T or nil

Alan, this makes no sense to me:
Code: [Select]
(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 ")")

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: set layer to no plot
« Reply #11 on: February 08, 2006, 12:33:31 PM »
OK, I screwed that up.:)
Let me try again with a simpler version.
I did test this one. :oops:
Code: [Select]
;;  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've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

zoltan

  • Guest
Re: set layer to no plot
« Reply #12 on: February 15, 2006, 10:15:49 AM »
I think he meant to do this:
Code: [Select]
(and plotable? (member plotable? '(T 1 "yes" "YES")))

but I agree with CAB:
Code: [Select]
(cons 290 (if plotable? 1 0))

who cares what the original value was.  We are setting it explicitly anyway.

Amsterdammed

  • Guest
Re: set layer to no plot
« Reply #13 on: February 16, 2006, 08:45:45 AM »
Gentlemen,
I asked a simple Question......

t-bear

  • Guest
Re: set layer to no plot
« Reply #14 on: February 16, 2006, 01:25:56 PM »
.......and got 3,427,633 simple solutions.............LOL
The neat part??  MOST of them even work!!  What a place!