Is there a way to do a new pagesetup from lisp? Any help will be appreciated.
Are you familiar with ActiveX methods? Start by looking at the following: vla-add vla-get-plotconfigurations vla-get-activedocument vlax-get-acad-object You can find them in the AutoLISP reference and the ActiveX and VBA reference.
From another thread: ;;; AddPstyletoDict.lsp ;;; ;;; Joe Funk, Sept.29/01; last revised Nov.01-02. ;;; ;;; Force an entry into the plotStyleName dictionary using ENTMAKEX ;;; and ENTMOD. Eg. create an entry for a non-existent plotstyle, or for ;;; a plotstyle not yet applied to an object in the dwg. ;;; Suggested in the following posting by Art Cooney: ;;;< ;;;From: "Art Cooney" <> ;;;Subject: PS ;;;Date: Monday, April 17, 2000 11:43 PM ;;; ;;; AcDbPlaceHolder is a "dataless" object type that's simply meant to ;;;be used in the plotStyleName dictionary in order to have an object ;;;(and therefore an objectId) to associate with a plotStyleName. ;;; ;;; You should be to use (entmakex) to create one and then use (entmod) ;;;on the dictionary you want to add it to in order to let the dictionary ;;;know that it's the new owner. ;;;> ;;; ;;;================================================ ====================== ;;; ;;; Function: addpstyletodict ;;; ;;; Add an entry for a plotstyle to the ACAD_PLOTSTYLENAME dictionary. ;;; ;;;------------------------------------------------------ ---------------- ;;; (defun addpstyletodict ( PSTYLENAME / PSTYDICT-INFO PSTYDICT-ENAME PS-ENAME XLIST NEW-PLACEHOLDER TMP-DATLST 340PAIR 100PAIR NEW-PSTYDICT ) (setq PSTYDICT-INFO (dictsearch (namedobjdict) "ACAD_PLOTSTYLENAME") PSTYDICT-ENAME (cdr (assoc -1 PSTYDICT-INFO)) ;; Make an entity definition data list suitable for ENTMAKEX. ;; Start by getting any plotstyle ename from the existing ;; dictionary ... first one found will do: PS-ENAME (cdr (assoc 350 PSTYDICT-INFO)) ;; get the 'template' for a pstyle definition: XLIST (cdr (entget PS-ENAME)) ;; create placeholder (returns ename for new pstyle): NEW-PLACEHOLDER (entmakex XLIST) ;; Revise the ACAD_PLOTSTYLENAME dictionary definition: insert ;;new (3 . <PSTYLENAME>) and (350 . <NEW-PLACEHOLDER>) ;;before final (100 . <>) and (340 . <>) TMP-DATLST (cddr (reverse PSTYDICT-INFO)) 340PAIR (last PSTYDICT-INFO) 100PAIR (nth (- (length PSTYDICT-INFO) 2) PSTYDICT-INFO) NEW-PSTYDICT (cons (cons 3 PSTYLENAME) TMP-DATLST) NEW-PSTYDICT (cons (cons 350 NEW-PLACEHOLDER) NEW-PSTYDICT) NEW-PSTYDICT (cons 100PAIR NEW-PSTYDICT) NEW-PSTYDICT (cons 340PAIR NEW-PSTYDICT) NEW-PSTYDICT (reverse NEW-PSTYDICT) ) ;; Art: "let the dictionary know that it's the new owner.": (entmod NEW-PSTYDICT) ) ;;; Tests: ;;;(addpstyletodict "Yahoo") ;;;(addpstyletodict "Houynhym") ;;;(princ (dictsearch (namedobjdict) "ACAD_PLOTSTYLENAME"))