MacLee Layout field script - display previous and next layout numbers of current layout.

MacLee Layout field script - display previous and next layout numbers of current layout.

Anonymous
Not applicable
423 Views
2 Replies
Message 1 of 3

MacLee Layout field script - display previous and next layout numbers of current layout.

Anonymous
Not applicable

Im trying to display the next and previous layout number using Lee Mac's layout field code linked below. Currently, the "lfnumber" command displays the current "sheet number" and was wondering if anyone knows how to take that number and add a 1 or subtract a 1 from it.

 

For instance, we are on sheet 5 but using, let's say, command "lfnumbernext", it would display "Sheet 6".

The same would go with using, let's say, command "lfnumberprev", it would display "Sheet 4".

 

This is the link to the full script:

http://www.lee-mac.com/lisp/html/LayoutFieldV1-0.html

 

This is the command for current layout number:

(defun c:lfnumber ( )
    (layoutfield
       '(lambda ( obj )
            (vla-put-textstring obj
                (strcat
                    "Sheet "
                    "%<\\AcObjProp Object(%<\\_ObjId "
                    (LM:objectid (layoutfield:layout obj))
                    ">%).TabOrder>%"
                )
            )
        )
    )
)

 

0 Likes
424 Views
2 Replies
Replies (2)
Message 2 of 3

vince_aman
Participant
Participant

Lee Mac could probably give you a quick answer... He is awesome and always willing to help!

 

In the meantime, I can get you a little closer... This will put the names of the tabs into a list, based on the order in the Dwg. You could create the tablist as an association list, then knowing the position of the current tab, get the other values, etc...

 

;; Get Current Tab List...

(vlax-map-collection (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) '(lambda (x)

   (setq tablist (cons x tablist)))

)
;; sort in tab order...

(setq tablist (vl-sort tablist '(lambda (x y)(< (vla-get-taborder x) (vla-get-taborder y)))))


;; make list of names into strings remove Model space

(setq tablist (vl-remove "Model" (mapcar '(lambda (x)(vla-get-name x)) tablist)))

(princ tablist)

 

0 Likes
Message 3 of 3

Sea-Haven
Mentor
Mentor

This may be useful its GOTO a layout so could find current layout and goto +- 1 layout, if only want to shift 1 then just Ctrl+pgn Ctrl+pgup no code required, can repeat as required.

0 Likes