TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Coder on February 09, 2018, 02:02:24 PM

Title: Draw order arrangements
Post by: Coder on February 09, 2018, 02:02:24 PM
Hello everyone.

I am lost with this draw order process when I had more objects on different layers.

The process should arrange the objects from High / Above to Below as per their layer names.

Layer name:     Object type:
layer-A             Line,Circle
layer-B             *Text
layer-C            Polyline,Block Reference
layer-D           *Text

is this possible?

Thank you.
Title: Re: Draw order arrangements
Post by: ronjonp on February 09, 2018, 02:14:16 PM
Quick one using command call:
Code - Auto/Visual Lisp: [Select]
  1. (foreach x (list '("layer-A" . "Line,Circle")
  2.                  '("layer-B" . "*Text")
  3.                  '("layer-C" . "Polyline,Block Reference")
  4.                  '("layer-D" . "*Text")
  5.            )
  6.   (if (setq s (ssget "_x" (list (cons 0 (cdr x)) (cons 8 (car x)))))
  7.     (command "_.draworder" s "" "back")
  8.   )
  9.   (princ)
  10. )
Title: Re: Draw order arrangements
Post by: Coder on February 09, 2018, 02:31:51 PM
Wow that was fast. ;)

Thank you, I need to test that on Monday as soon as I arrive to the office and will let you know.

Have a good day.
Title: Re: Draw order arrangements
Post by: Grrr1337 on February 09, 2018, 03:29:19 PM
Nice one Ron!
Heres another variation of your suggestion:
Code - Auto/Visual Lisp: [Select]
  1.   '(("LINE,CIRCLE" "layer-A")
  2.     ("*TEXT" "layer-B")
  3.     ("POLYLINE,INSERT" "layer-C")
  4.     ("*TEXT" "layer-D")
  5.   )
  6.   (and
  7.     (setq x (ssget "_X" (mapcar 'cons '(0 8) x)))
  8.     (command "_.draworder" x "" "back")
  9.   )
  10. )
Title: Re: Draw order arrangements
Post by: Lee Mac on February 09, 2018, 07:23:19 PM
Here's an old one: Layer Draw Order (http://lee-mac.com/layerdraworder.html)
Title: Re: Draw order arrangements
Post by: ronjonp on February 09, 2018, 07:29:14 PM
Nice one Ron!
Heres another variation of your suggestion:
Code - Auto/Visual Lisp: [Select]
  1.   '(("LINE,CIRCLE" "layer-A")
  2.     ("*TEXT" "layer-B")
  3.     ("POLYLINE,INSERT" "layer-C")
  4.     ("*TEXT" "layer-D")
  5.   )
  6.   (and
  7.     (setq x (ssget "_X" (mapcar 'cons '(0 x)))
  8.     (command "_.draworder" x "" "back")
  9.   )
  10. )
Nice .. I like the
Code: [Select]
(mapcar 'cons '(0 8) x) 😎
Title: Re: Draw order arrangements
Post by: Coder on February 13, 2018, 11:56:43 PM
Hello everyone.

This morning I had the chance to test the programs and all work as needed.

Many many thanks guys.