LAYERORDER then OKAY

LAYERORDER then OKAY

jmartt
Collaborator Collaborator
2,252 Views
14 Replies
Message 1 of 15

LAYERORDER then OKAY

jmartt
Collaborator
Collaborator

I'm aiming to make a button that pops my layers into the display order I want.

 

I want a macro or other sort of magic thing that calls the command LAYERORDER and (effectively) presses the OKAY button.

 

Thank you in advance, oh wisen'd few: I am not one that can summon up fire without flint or tinder.

0 Likes
Accepted solutions (1)
2,253 Views
14 Replies
Replies (14)
Message 2 of 15

Kent1Cooper
Consultant
Consultant

@jmartt wrote:

.... calls the command LAYERORDER and (effectively) presses the OKAY button.

....


That's not a native AutoCAD command.  Are you using an overlay program?  Do you have a custom command definition?

Kent Cooper, AIA
0 Likes
Message 3 of 15

jmartt
Collaborator
Collaborator

I'm using Civil 3D 2017, SP 1.1

And I have Sincpac installed, but that command isn't listed in the literature as being a Sincpac command.

 

In the C3D forums, someone noted that this command wasn't a C3D command, though, so I don't know how I have it, or how @bmapper has it. Well, actually, maybe that user name is a clue! Is it is a Map command?

 

Regardless, I just want a button that launches the command and presses the OKAY button. I tried adjusting ATTDIA and FILEDIA but this particular dialog box seems resistant to those spells. Is there just a catch-all LISP or macro way to "press OKAY button"?

0 Likes
Message 4 of 15

steve_carson
Enthusiast
Enthusiast

I can't answer your question about running this command without a dialog box, but I can confirm that I have this command in Civil3D 2016, but not in Map3D 2016. I tried "-Layerorder" with no luck. Also, it's not found in Help when I do a search for it.

 

Just FYI.

 

 

 

Steve

Message 5 of 15

Kent1Cooper
Consultant
Consultant

@jmartt wrote:

.... I don't know how I have it....


I expect it must have come from here, if that helps people know what to do with it.

Kent Cooper, AIA
0 Likes
Message 6 of 15

jmartt
Collaborator
Collaborator

I don't show any UDS app in my add-ins, and I don't remember downloading anything like that. I think @Anonymous found the command in Arch 2016.

 

Really, though, I just want to press that OKAY button via some LISP or other method. Maybe you'd need the code or whatever to do that, but I thought maybe there'd be a LISP routine or something for "press the OKAY button".

0 Likes
Message 7 of 15

steve_carson
Enthusiast
Enthusiast
Accepted solution

I'm no Lisp Guru, but this worked in my minimal testing. Modify the quoted layer names to be in the order you want them displayed. You type "LAYORDER" to run it. Let me know if it doesn't work (but like I said, I'm no guru).

 

;;Send to Front by Layer
;;
;;Inspired by this post:
;;http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layerorder-then-okay/td-p/6537304
;;
;;By Steve Carson
;;

(defun C:LAYORDER ( / layerlist SS)

(setq layerlist '(

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Create List of Layers in the order you want them displayed


"Layer1"
"Layer2"
"Layer3"
"Layer4"


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;End of Layer List Area
))

(foreach L (reverse Layerlist)

    (if (setq SS (ssget "_X" (list (cons 8 L) (cons 410 (getvar "CTAB")))))

        (command "DRAWORDER" SS "" "Front")

    )

);foreach

(princ)
);defun

 

 

 

Message 8 of 15

jmartt
Collaborator
Collaborator

"but like I said, I'm no guru"

 

I beg to differ. Thanks a lot!

0 Likes
Message 9 of 15

steve_carson
Enthusiast
Enthusiast

You're welcome, glad you like it!

0 Likes
Message 10 of 15

jmartt
Collaborator
Collaborator

My intent was to have some special layers that would jump up in display order and some others that would jump behind. I took your code and edited it so it'd do that. Seems to work thus far. Quite a nice button to have! Posting here in case someone wants the same.

 

0 Likes
Message 11 of 15

steve_carson
Enthusiast
Enthusiast

Nicely done Jeff!

 

 

 

Steve

0 Likes
Message 12 of 15

As-Built_Sigurd
Enthusiast
Enthusiast
Thanks for this
0 Likes
Message 13 of 15

nbawden
Advocate
Advocate

Any idea how do this lisp with layer wildcards?

 

We have various text layers that have a generic name type  "Text *" that we want to be set to the front of all other objects in other layers.

0 Likes
Message 14 of 15

Kent1Cooper
Consultant
Consultant

@nbawden wrote:

Any idea how do this lisp with layer wildcards?

 

We have various text layers that have a generic name type  "Text *" that we want to be set to the front of all other objects in other layers.


If you don't care in what order the things on those Layers go relative to each other, but only relative to things on other Layers, it should be pretty simple, since wildcards work in (ssget) filters:

 

(command "DRAWORDER" (ssget "_X" '((8 . "Text *"))) "" "Front")

Kent Cooper, AIA
Message 15 of 15

nbawden
Advocate
Advocate

Sweet - works nicely.

0 Likes