Author Topic: Draw order arrangements  (Read 1597 times)

0 Members and 1 Guest are viewing this topic.

Coder

  • Swamp Rat
  • Posts: 827
Draw order arrangements
« 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.

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Draw order arrangements
« Reply #1 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. )

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Coder

  • Swamp Rat
  • Posts: 827
Re: Draw order arrangements
« Reply #2 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.

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: Draw order arrangements
« Reply #3 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. )
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Draw order arrangements
« Reply #4 on: February 09, 2018, 07:23:19 PM »
Here's an old one: Layer Draw Order

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Draw order arrangements
« Reply #5 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) 😎

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Coder

  • Swamp Rat
  • Posts: 827
Re: Draw order arrangements
« Reply #6 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.