Hello,
I am working on a Autolisp routine that can setup layout page settings and create viewport and place the drawing in given scale.
attached lisp is a Single sample from a long sequence of pagesizes. (viewport_setup.lsp)
What I want:
1. If Pdf-Xchange 4.0 is not available a dialog box will open. (design of dialog box attached)
2. Even if Pdf-Xchange 4.0 is available still user can open that dialog box by enter "S" (Settings) with in running command and set the parameters in the dialog box and then continue with the lisp flow (entering scale, then orientation).
3. Rename Layout if provided in the dialog box other wise rename as per page size(Default).
4. Delete other Layouts will be default, user can change it.
FWIW here are a few comments to the code you posted.
(setq layc (getvar 'clayer)) (command "-layer" "make" "Defpoints" "color" "white" "" "") (setvar 'clayer layc) (defun c:3042 (/ ad cmd lay ornt sc tb) ; RJP localized all variables (command "undo" "begin") ;; RJP Changed initget from 1 to 7 ( number greater than 0 required ) (initget 7) (setq sc (getreal "Enter Drawing Scale:")) (setq sc (* 10000 sc)) ;for fractionsl scales (initget "Portrait Landscape") (setq ornt (cond ((getkword "\nEnter Drawing Orientation[Portrait/Landscape]<Landscape>:")) ("Landscape") ) ) (setq cmd (getvar 'cmdecho)) (setvar 'cmdecho 0) (command "-layer" "ON" "Defpoints" "T" "Defpoints" "") ;; Faster :) (vlax-for tab (vla-get-layouts (setq ad (vla-get-activedocument (vlax-get-acad-object)))) (and (> (vla-get-taborder tab) 0) (vla-delete tab)) ) ;; (foreach ly (layoutlist) (command "-Layout" "Delete" "")) (setvar 'ctab "Model") ;;; (if (= ornt "Portrait") ;;; (command "-plot" "Yes" "Layout1" "PDF-XCHANGE 4.0" "30x42" "Inches" ;;; "P" "NO" "Extents" "1:1" "C" "Yes" ;;; "monochrome.ctb" "Yes" "NO" "NO" "No" "N" ;;; "Y" "N" ;;; ) ;;; ) ;; RJP - only need to change 'L' or 'P' (command "-plot" "Yes" "Layout1" "PDF-XCHANGE 4.0" "30x42" "Inches" (if (= ornt "Landscape") "L" "P" ) "NO" "Extents" "1:1" "C" "Yes" "monochrome.ctb" "Yes" "NO" "NO" "No" "N" "Y" "N" ) (setq lay (getvar 'clayer)) (setvar 'clayer "Defpoints") ;; Set first ( and only ) tab current (setvar 'ctab (car (layoutlist))) (command "._erase" (ssget "_X" '((0 . "VIEWPORT"))) "") ;; Removed command (vlax-for tab (vla-get-layouts ad) (and (> (vla-get-taborder tab) 0) (vla-put-name tab "30x42"))) ;; (command "-layout" "rename" "layout1" "30x42") (command "Mview" "Fit") (command "Mspace") (command "zoom" "Extents") (command "zoom" (strcat "10000/" (rtos sc 2 0) "XP") "") (setvar 'psltscale 0) (command "Regen") (command "pspace") (command "Zoom" "Extents") (setvar 'clayer lay) (command "mview" "lock" "on" (ssget "_X" '((0 . "VIEWPORT") (-4 . "!=") (69 . 1))) "") (command "ctab" "Model") (command "zoom" "Extents") (command "_qsave") (setvar 'ctab (car (layoutlist))) (setvar "cmdecho" cmd) (command "undo" "e") (princ "\nViewport Created") (princ) ) ;End
@Anonymous wrote:@ronjonp thank you for you comment and corrections... I have updated that lisp as per your suggestion.
But the pdf with size is not what I am looking for. Some how I need to develop that dialog box with that lisp. Can help me in that issue?
Sorry .. creating dialog boxes is not my strong suit.
@Anonymous wrote:
But the pdf with size is not what I am looking for. Some how I need to develop that dialog box with that lisp. Can help me in that issue?
What are the pdf sizes then? HaVe a look at sea.havens post about dcl library ----> Multiple toggles.lsp
Tweak it a little so instead of toggle, use it as radio_button
HTH
Page sizes:
30x42
24x36
18x24
8.5x11
8.5x14
11x17
17x22
22x34
34x44
we generally use pdf xchange 4.0 as default. but if someone doesn't have that then the dialog box should open and ask to choose other pdf driver from available list and page size too.
otherwise user can choose the "Setting" keyword to open the dialog box (see the attached image for the dcl reference).
(exmpl: like in "HATCH" command "seTting" keyword to open the dialog box with in the running command)
Go to cadtutor Downloads there are 4 "MULTI" lisp library dcls "Multi Radio buttons" is one of them, thanks for recommendation.
(setq ans (ah:butts but "V" '("Choose Page size " "30x42" "24x36" "18x24" "8.5x11" "8.5x14" "11x17" "17x22" "22x34" "34x44")) )
I have updated the lisp as attached will update Cadtutor also changed a couple of items to make better.
Its a library function just makes a temporary dcl runs it then deletes it can have any amount of buttons subject to screen size I posted example code. There are more examples in the lisp code.
Can't find what you're looking for? Ask the community or share your knowledge.