Hi all
I am looking for a lisp that will rename all the layouts automatically. I tried the Layoutlist function but the output is not in order. Is there anyway that i can get all the layouts in a drawing from left to right order. for eg. i have layouts from layout1, layout 2........layout10). The layoutlist returns as layout1,layout10 etc...instead of layout 1 layout 2.
Can somebody help
Thanks and regards
sujeev
As a own matter of the PC processor , the natural order is
1 10 11..............19 2 21 ......................29 3 and so on
If you have more than 10, up to 99 layouts you shall name 01 02 03 ...................09 10 11 .................19.20 .............................99
If it are more than 100 up to 999 layouts you shall name 001 002 003 .................009...... ........999
@Anonymous wrote:
I am looking for a lisp that will rename all the layouts automatically. I tried the Layoutlist function but the output is not in order. Is there anyway that i can get all the layouts in a drawing from left to right order....
@devitg wrote:... the natural order is
1 10 11..............19 2 21 ......................29 3 and so on
....
However, no matter how you number or name the Layouts, sorting them into some kind of order [numerically or otherwise] will not give you their left to right order in the tabs at the bottom of the drawing [unless, of course, that order coincidentally agrees with the sorted order]. The (layoutlist) function doesn't return them that order, but always sorted by name. I have a drawing in which I added a couple of new Layouts and let AutoCAD give them the default names, so that:
Command: (layoutlist)
returns
("Layout1" "Layout2" "Layout3")
Then I moved Layout1 to the end [far right tab], but (layoutlist) still returned the same thing, with "Layout1" listed first.
EDIT: Check this out:
A more extensive Search could well lead to more directly applicable threads.
@Anonymous wrote:Hi all
I am looking for a lisp that will rename all the layouts automatically. I tried the Layoutlist function but the output is not in order. Is there anyway that i can get all the layouts in a drawing from left to right order. for eg. i have layouts from layout1, layout 2........layout10). The layoutlist returns as layout1,layout10 etc...instead of layout 1 layout 2.
Can somebody help
Thanks and regards
sujeev
(defun Layorder (/ order)(vl-load-com) (vlax-for lay (vla-get-layouts (vla-get-ActiveDocument (vlax-get-acad-object))) (setq order (cons (list (vla-get-name lay) (vla-get-taborder lay)) order ) ) ) (mapcar 'car (Cdr (vl-sort order '(lambda (j k) (< (cadr j) (cadr k)) ) ) ) ) )
(layoutorder)
HTH
From
ø¤º°`°º¤ø TabSort.lsp ~ Copyright © by Lee McDonnell ø¤º°`°º¤ø
~¤~ ...Type "TabSort" to Invoke... ~¤~
I am looking to close make a quick command that closes the drawing I am in, but I want it to select the first layout tab that isn't model space. The problem I am running into is every drawing has a different name for that layout tab. Is there any way of doing this?
@irishrandy26 wrote:
I am looking to close make a quick command that closes the drawing I am in, but I want it to select the first layout tab that isn't model space. The problem I am running into is every drawing has a different name for that layout tab. Is there any way of doing this?
Before save and close, try
(vl-load-com) (vlax-for layt (vla-get-layouts (vla-get-ActiveDocument (vlax-get-acad-object))) (if (= (vla-get-TabOrder layt) 1) (setvar 'CTAB (vla-get-Name layt)) ) )
HTH
Henrique
Another
(setq ly (vla-get-layouts (vla-get-ActiveDocument (vlax-get-acad-object)))) (setvar 'CTAB (vl-some '(lambda (l) (if (= (vla-get-TabOrder (vla-item ly l)) 1 ) l ) ) (layoutlist) ) )
HTH
Slight mod on pb's...
((lambda (layouts) (vl-some (function (lambda (layout) (if (eq (vla-get-taborder (vla-item layouts layout)) 1) (setvar 'CTAB layout) ) ) ) (layoutlist) ) ) (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) )