Author Topic: Colour ByLayer  (Read 3413 times)

0 Members and 1 Guest are viewing this topic.

paulmcz

  • Bull Frog
  • Posts: 202
Colour ByLayer
« on: February 16, 2005, 08:57:23 AM »
When I select a circle, I can extract its center point, radius and layer from dxf code. Where and how can I extract the colour (in plain LISP - for R14), if it is a "ByLayer"?
(cdr (assoc 62 ent)) gives me 'nil'.

Could anyone tell me, please? Thanks.

Paul

Big G

  • Bull Frog
  • Posts: 415
Colour ByLayer
« Reply #1 on: February 16, 2005, 09:17:32 AM »
Is bylayer not 256 and byblock 257? dont quote me on that one though
I thought i seen the light at the end of the tunnel. But it was just someone with a torch bringing me more work.
"You have to accept that somedays youre the pigeon and  somedays youre the statue"

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Colour ByLayer
« Reply #2 on: February 16, 2005, 09:39:41 AM »
Quote
DXF Code 62    
 Color number (present if not BYLAYER); zero indicates the BYBLOCK
 (floating) color; 256 indicates BYLAYER; a negative value indicates that the
 layer is turned off (optional).


Code: [Select]
0       ByBlock
1       Red
2       Yellow
3       Green
4       Cyan
5       Blue
6       Magenta
7       Black/White
8       Dark Grey
9       Grey

256     ByLayer (or missing)
0       ByBlock
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.

paulmcz

  • Bull Frog
  • Posts: 202
Colour ByLayer
« Reply #3 on: February 16, 2005, 09:58:02 AM »
Quote from: CAB
Quote
DXF Code 62    
 Color number (present if not BYLAYER); zero indicates the BYBLOCK
 (floating) color; 256 indicates BYLAYER; a negative value indicates that the
 layer is turned off (optional).


Code: [Select]
0       ByBlock
1       Red
2       Yellow
3       Green
4       Cyan
5       Blue
6       Magenta
7       Black/White
8       Dark Grey
9       Grey

256     ByLayer (or missing)
0       ByBlock


If it is missing, should I just assume that it is a bylayer or a byblock?
I need to erase the circle and replace with another circle of the same colour and same layer.. How should I go about it?

SMadsen

  • Guest
Colour ByLayer
« Reply #4 on: February 16, 2005, 10:08:03 AM »
If missing, it's assumed to be Bylayer.

For your 2nd question it depends on how you create the new entity.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Colour ByLayer
« Reply #5 on: February 16, 2005, 10:12:10 AM »
You can try this if you want to entmake the new object.
Code: [Select]
;;  function to strip unwanted dxf codes for a new entity
;;  retuens a ent list ready for entmake
(defun strip (entl)
  ;;  ent expected to be an entity name or entlist or ename w/ point list
  (cond
    ((= (type entl) "ENAME")
     (setq entl (entget entl))
    )
    ((= (length entl) 2)
     (setq entl (car entl))
    )
  )
  (foreach n '(-2 -1 5 102 300 330 331 350 360)
    (while (assoc n entl)
      (setq entl (vl-remove (assoc n entl) entl))
    )
  )
  entl
)

(defun c:test()
  (while (not (setq ent (entsel))))
  (setq elst (strip ent))
 
  ;; make changes to elst
 
  (entmake elst) ; make a new entity
)
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.

SMadsen

  • Guest
Colour ByLayer
« Reply #6 on: February 16, 2005, 01:01:47 PM »
What's an ENANE?  Heehee j/k

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Colour ByLayer
« Reply #7 on: February 16, 2005, 01:22:27 PM »
Old Eagle Eye! :shock:

Thanks for the catch Stig. :)
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.

paulmcz

  • Bull Frog
  • Posts: 202
Colour ByLayer
« Reply #8 on: February 16, 2005, 03:12:16 PM »
Excellent! It works now.

Big G - "256" it is.
Cab - I can't use "vla-remove" with R14.
SMadsen - "It's assumed" - that made the trick.

Thank you all,
Paul.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Colour ByLayer
« Reply #9 on: February 16, 2005, 03:26:01 PM »
Code: [Select]
;*** REMOVE.lsp  by c.bethea
;This function removes an element from a list and return the list without
;the element
;
(defun REMOVE_ELEM (what from)
  (append
    (reverse
       (cdr (member what (reverse from)))
    )
    (cdr (member what from))
  )
)
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.

SMadsen

  • Guest
Colour ByLayer
« Reply #10 on: February 16, 2005, 06:01:05 PM »
paulmcz, notice that even tho (62 . 256) is omitted from entity lists, it can still be used in SSGET filters. Just a side note in case anyone ever wonders how QSELECT etc. can filter with Bylayer.

paulmcz

  • Bull Frog
  • Posts: 202
Colour ByLayer
« Reply #11 on: February 16, 2005, 11:13:34 PM »
Thanks again guys.
You have no idea how much I learn here.

Paul.