ChrisCMU 发表于 2022-7-6 14:41:24

Re-ordering layout tabs?

Does anybody know of a custom or built in way to re-order the layout tabs?I have a drawing with about 200 tabs in there (different site locations).I like to keep them alphabetical so I can find then when needed.Right now I have to drag the tab into it's proper place (which can be time consuming).I'd like to be able to automatically alphabetize them.
 
In a somewhat related question, does anybody know how I could export all layout tabs (based on their current page setup) at once?I would prefer if it dropped the suffix and prefix (BTW, can you change these?) from the file name.The prefix is the drawing name and the suffix is the "(1)" it puts on there.I'd love to not have to delete that every time I export it.

CmdrDuh 发表于 2022-7-6 14:47:21

I think it can be done, I seem to remember doing that a long time ago.Let me look through my code archive

Lee Mac 发表于 2022-7-6 14:50:47

Couldn't resist:
 

(defun c:sortlay(/ lst) (vlax-for lay   (vla-get-layouts   (vla-get-ActiveDocument       (vlax-get-acad-object)))   (setq lst (cons lay lst))) (setq lst (vl-remove-if             (function               (lambda (y)               (eq "Model" (vla-get-Name y)))) lst)) (mapcar   (function   (lambda (x)       (vla-put-TabOrder x         (1+         (vl-position             (vla-get-Name x)               (acad_strlsort               (mapcar 'vla-get-Name lst))))))) lst) (princ))

ChrisCMU 发表于 2022-7-6 14:53:03

I get an error when running that:
 

lpseifert 发表于 2022-7-6 14:58:50

add this near the top (or add it to your acaddoc.lsp file)

(vl-load-com)

ChrisCMU 发表于 2022-7-6 15:01:45

thanks, that works great!Have any of you ever seen a way to do the export question I had?

Lee Mac 发表于 2022-7-6 15:03:54

Sorry about that error Chris, I have (vl-load-com) in my ACADDOC.lsp, so I don't notice any problems if I have left it out - my apologies.
 
When you say "export" layout tabs, what exactly do you mean? I can easily modify the Layout tab names, but I am not sure exactly what you want done with them

ChrisCMU 发表于 2022-7-6 15:07:19

 
Well, I have hundreds of layouts in my drawing.each one is named for the site they represent (these are well sites in a large field of hundreds of wells).An example of the layout name might be:
 
"Echo_Springs_Federal_2_26"
 
I want to be able to export all the layout tabs in the drawing with only using the layout name to a defined workspace.Currently when I export them to PDFs the default is:
 
drawingname layoutname "(1)"
 
I don't want the drawing name or the "(1)" appended to it.I've been trying to find a setting to fix that but I can't.
 
any ideas?
 
I thought of writing a script to strip the drawing name and the "(1)" off there, but it won't work because Autocad puts those spaces in there.And besides, I don't have the other part figured out either (to export them all at once).

Lee Mac 发表于 2022-7-6 15:12:03

Ok, I understand about the layout names, but how do you export them?
 
Excuse my AutoCAD ignorance, I am really only into the programming side and haven't actually used AutoCAD that much.
 
Lee

ChrisCMU 发表于 2022-7-6 15:16:40

I use the plot button/command and the name of the plotter is "Adobe PDF"
 
In case it matters, the properties on all layouts are the same (size, orientation, etc).All those setting are saved within the layout though, so I doubt any of that would need to be included in any LISP.
页: [1] 2
查看完整版本: Re-ordering layout tabs?