Here is an example of setting layouts with a
dialog box and Active X.
Peter Jamtgaard
First the DCL Coding :
ddlayout : dialog {
label="**Layouts**";
:list_box { key = "layouts";
height = 30;
width = 25;
allow_accept = true;
}
ok_only;
}
Save this as "Set_Layout.dcl".
And now the AutoLisp coding :
;CODING STARTS HERE
; Set_layout will display a dialog box with all available layouts
; and allow the user to select the layout to switch to.
(defun C:SET_LAYOUT (/ CLOSE1 LAYOUTS FULL)
(vlax-for LOUTOBJ
(vla-get-layouts
(setq CDWGOBJ (vla-get-activedocument
(vlax-get-acad-object)
)
)
)
(setq LAYOUTS (cons (cons (vla-get-name LOUTOBJ) LOUTOBJ) LAYOUTS))
)
(setq LAYOUTS (reverse LAYOUTS))
(vla-put-activelayout CDWGOBJ (cdr (nth (ddset_layout LAYOUTS) LAYOUTS)))
)
(defun DDSET_LAYOUT (LISTIN )
(setq id (load_dialog "set_layout.dcl"))
(new_dialog "ddlayout" id)
(start_list "layouts")
(mapcar 'add_list (mapcar 'car LISTIN))
(end_list)
(action_tile "layouts" "(progn (setq LAYN (atoi $value)) (princ
LAYN))")
(setq start (start_dialog))
LAYN
)
;CODING ENDS HERE
Save this as "Set_Layout.lsp".
|