I have written a program to read a list of sheets, build layout tabs, insert title blocks with attributes and then setup the plotter.
Until today, all my title blocks where landscape and the title blocks where always the same size in 1 drawing.
Now I need to be able to have multiple title block sizes (A, B, C, etc.) and with portrait or landscape rotations and set plot type to extents.
I wrote a quick change the values and show settings -
(defun C:TEST ()
(foreach Layout (layoutlist)
(setvar "CTAB" Layout)
(command "ZOOM" "E")
(setq P1 (getvar "EXTMIN"))
(setq P2 (getvar "EXTMAX"))
(setq AlayObj (vla-get-ActiveLayout (vla-get-ActiveDocument (vlax-get-Acad-Object))))
(setq Rotation (vla-get-PlotRotation AlayObj))
(if (< (abs (- (car P2) (car P1))) (abs (- (cadr P2) (cadr P1))))
(progn
(vla-put-PlotRotation AlayObj ac90degrees)
(setq Orientation "Portrait")
)
(progn
(vla-put-PlotRotation AlayObj ac0degrees)
(setq Orientation "Landscape")
)
)
(progn (princ "\nLayout=")(princ Layout)(princ "=Rotation=")(princ Rotation)(princ "=Orientation=")(princ Orientation)(princ "="))
(if (and AlayObj (not (vlax-object-released-p AlayObj))) (vlax-release-object AlayObj))
)
)
Here are the results printed to the screen -
Layout=AL0.00=Orientation=Landscape=Rotation Before=1=Rotation After=0=
Layout=AL0.01=Orientation=Landscape=Rotation Before=1=Rotation After=0=
Layout=AL1.00=Orientation=Landscape=Rotation Before=0=Rotation After=0=
Layout=AL2.00=Orientation=Portrait=Rotation Before=1=Rotation After=1=
Layout=AL3.00=Orientation=Landscape=Rotation Before=0=Rotation After=0=
Layout=AL4.00=Orientation=Landscape=Rotation Before=1=Rotation After=0=
Layout=AL5.00=Orientation=Portrait=Rotation Before=1=Rotation After=1=
Layout=AL6.00=Orientation=Landscape=Rotation Before=0=Rotation After=0=
For some reason Layouts AL1.00 & AL6.00 are portrait instead of landscape, even though the values princ seem correct.