Author Topic: Move new construction to record issue layer  (Read 1465 times)

0 Members and 1 Guest are viewing this topic.

jlogan02

  • Bull Frog
  • Posts: 327
Move new construction to record issue layer
« on: January 12, 2019, 03:30:58 PM »
I have a group of layers where there are two layers for each object type...

S-BF is the record issue layer with color bylayer
S-BF-N is the new construction layer, whose color is RED.

So block "X" will always land on the same layer and always first land on the S-BF-N layer. When construction is complete it will move to the layer of the same name without the "-N" suffix.

I was hoping to simply use the cold below to grab all red layers ending in "*N" and push them back to record issue. Clearly that's not going to work.

Code - Auto/Visual Lisp: [Select]
  1. (if (setq col1 (ssget "x" '((8 . "*-N") (62 . 1))))
  2.            (foreach x (mapcar 'cadr (ssnamex col1))
  3.              (entmod (append (entget x) '((8 . "record issue layer"))))

Clearly I could just ssget for each new red construction layer individually and then move it to it's record issue layer.

Code - Auto/Visual Lisp: [Select]
  1. (defun c:test44 ( / col2 col3)
  2. (if (setq col2 (ssget "X" '((8 . "S-BF-N"))))
  3. (foreach x (mapcar 'cadr (ssnamex col2))
  4.              (entmod (append (entget x) '((8 . "S-BN")))))
  5.   )
  6. (if (setq col3 (ssget "X" '((8 . "S-CONDUCTOR-N"))))
  7.  (foreach x (mapcar 'cadr (ssnamex col3))
  8.              (entmod (append (entget x) '((8 . "S-CONDUCTOR")))))
  9.    )
  10.   (princ)
  11. )

Seems to me if the name is only different in that one has the "-N", I should be able to move all RED objects with the "-N" to the layer of the same name without the "-N".
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Move new construction to record issue layer
« Reply #1 on: January 12, 2019, 06:24:56 PM »
Consider the following code:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:ril ( / i l s x )
  2.     (if (setq s (ssget "_X" '((8 . "*?`-N") (62 . 1))))
  3.         (repeat (setq i (sslength s))
  4.             (setq i (1- i)
  5.                   x (entget (ssname s i))
  6.                   l (assoc 8 x)
  7.             )
  8.             (entmod
  9.                 (subst
  10.                     (cons 8 (substr (cdr l) 1 (- (strlen (cdr l)) 2))) l
  11.                     (subst '(62 . 256) '(62 . 1) x)
  12.                 )
  13.             )
  14.         )
  15.     )
  16.     (princ)
  17. )

jlogan02

  • Bull Frog
  • Posts: 327
Re: Move new construction to record issue layer
« Reply #2 on: January 16, 2019, 11:51:33 AM »
Thanks Lee. Once again.
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Move new construction to record issue layer
« Reply #3 on: January 16, 2019, 01:23:20 PM »
You're most welcome.  :-)