Author Topic: Check layer if "off / frozen" with dbx  (Read 2578 times)

0 Members and 1 Guest are viewing this topic.

Peter2

  • Swamp Rat
  • Posts: 653
Check layer if "off / frozen" with dbx
« on: November 25, 2015, 06:17:13 AM »
After a long pause I have to fight against DBX again  :whistling:

I want to check all layers, which are used by objects in an objectlist, if they are "off" or "frozen". In Lisp I check if
- DXF-GC 70 contains "1" (frozen)
- DXF GC 62 is negative (off)

Code: [Select]
(foreach bild ObjLst
        (setq bildlayer (cdr (assoc 8 (entget bild))))
        ; DXF-Code: 70 enthält 1 -> gefroren; 62 (Farbe) ist negativ -> ausgeschaltet
        (setq bildlayer_dxf (tblsearch "layer" bildlayer))
        (if (or
                (= (logand 1 (cdr (assoc 70 bildlayer_dxf))) 1); wenn der GC 70 den Bitcode 1 = gefroren
                (< (cdr (assoc 62 bildlayer_dxf)) 0)           ; negativ -> ausgeschaltet
            )
            (setq layerflag 1)
        )
    )

Please help me to make it with DBX.

Thanks and regards
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Check layer if "off / frozen" with dbx
« Reply #1 on: November 25, 2015, 06:22:36 AM »
Peter;

Quote
I have to fight against DBX again
You may need to explain this so it's understandable in the context of the code you posted.
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.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Check layer if "off / frozen" with dbx
« Reply #2 on: November 25, 2015, 06:31:33 AM »
(tblsearch) searches tables in the current document and can therefore not be use in an (O)DBX context.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Check layer if "off / frozen" with dbx
« Reply #3 on: November 25, 2015, 06:34:29 AM »
Thanks Roy ... I'm blind as well as silly.
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.

kpblc

  • Bull Frog
  • Posts: 396
Re: Check layer if "off / frozen" with dbx
« Reply #4 on: November 25, 2015, 07:41:11 AM »
(setq item (vla-item (vla-get-layers doc) "LayerName"))
(equal (vla-get-freeze item) :vlax-true) ; returns t if layer is frozen
(equal (vla-get-layeron item) :vlax-true) ; returns t if layer is on
Sorry for my English.

Peter2

  • Swamp Rat
  • Posts: 653
Re: Check layer if "off / frozen" with dbx
« Reply #5 on: November 25, 2015, 10:17:45 AM »
You may need to explain this so it's understandable in the context of the code you posted.
Sorry, Kerry. When I'm under pressure and I have the feeling that a "common dbx two-liner" will do the job but I don't have any clue - then my postings are not as precise as they should be  :embarrassed:

(setq item (vla-item (vla-get-layers doc) "LayerName"))
(equal (vla-get-freeze item) :vlax-true) ; returns t if layer is frozen
(equal (vla-get-layeron item) :vlax-true) ; returns t if layer is on
Thanks - exactly the two-liner I hoped for.  :yay!:
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23