Andrew McDonald
Usenet Archive
- Joined
- Jul 9, 2003
- Messages
- 27
- Reaction score
- 0
I have the routine below which enables me to do One-click plotting. I need to retrieve the available paper sizes from the device \\GCSERVER\Cadjet 2 which I can do by using :
(DEFUN getlocalemedianames (adoc / la cmn lmn)
(SETQ la (VLA-ITEM (VLA-GET-LAYOUTS adoc) "Model"))
(FOREACH cmn (getcanonicalmedianames adoc)
(SETQ lmn (CONS (VLA-GETLOCALEMEDIANAME la cmn) lmn))
)
(REVERSE lmn)
)
(getlocalemedianames (vla-get-activedocument (vlax-get-acad-object)))
I then copy the required media name "ISO A1 594 x 840 mm." into the code below but it refuses to recognize this value. I've tried eliminating spaces, taking out the period etc. I'm going freaking mad. What am I doing & why can't I pass this name into the script ?
Regards
Andrew McDonald
;; Routine for '1 click' plotting of titleblock sheets. ;; The routine asks the user to pick a titleblock or crop mark ;; of the titlesheet. The routine retrieves certain values to establish ;; the sheet size and then process that information in the background ;; and sends the plot to the specified device.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; VARIABLES DEFINITIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; blk = block (title block or border) to plot from ;; bn = block name ;; bxs = blocks x scale factor (discontinued) ;; bip = block insertion point
;; This routine has now taken away the option of having a titleblock inserted at a scale other than 1, ;; (previously used when titleblocks were inserted in model space and scaled) ;; the bxs variable will now be set at 1.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ERROR HANDLING ROUTINE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun myerror (s) ; If an error (such as CTRL-C) occurs while this command is active... (if (/= s "Function cancelled") (princ (strcat "\nError: " s)) ) (setvar "filedia" 1) (setvar "cmdecho" 1) (setq *error* olderr) ; Restore old *error* handler (princ)
)
;;************************************************************************** ;; ;; Routine to plot to full size.
(defun c:autoplotfull (/ ifd icm icd blk bn bip)
(setq olderr *error* *error* myerror)
(setq ifd (getvar "filedia"))
(setvar "filedia" 0)(princ)
(setq icm (getvar "cmdecho"))
(setvar "cmdecho" 0)(princ)
(setq ilu (getvar "luprec"))
(setvar "luprec" 0)(princ)
(prompt "\nAutoPLOT routine for TVS Partnership ... loaded ")(princ) (prompt "\nSelect TITLE BLOCK or CROP MARK of what you wish to plot ")(princ) (setq blk (entget (car (entsel)))) ;retrieve block definition (setq bn (cdr (assoc 2 blk))) ;retrieve blocks name (setq bip (cdr (assoc 10 blk))) ;retrieve blocks insertion point (if bn (cond ((= bn "a1 portrait") (PLOT_A1)) ;if A1 PORTRAIT then do PLOT_A1 ((= bn "a1 landscape") (PLOT_A1)) ;if A1 LANDSCAPE then do PLOT_A1 (setq bn nil) ) ) )
(princ)
;;;;;;;;;;;;;;;;;;;; ROUTINE TO SAVE VIEW "A1" & PLOT THE SELECTED TITLE BLOCK/BORDER ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun PLOT_A1 (/ PS)
(if (tblsearch "view" "a1") (command "view" "d" "a1"))
(command "view" "w" "a1" bip (list 810.0 565.5)) ;creates a new view "A1" to plot (command "view" "r" "a1")
? ?
(command "-PLOT" "y" "" "\\\\GCSERVER\\Cadjet 2" "ISO A1 594 x 840 mm." "m" "l" "n" "v" "a1" "1=1" "c" "y" "tvs.ctb" "y" "n" "n" "n" "n" "y" "y")
; Detailed plot configuration? [Yes/No] <No>: y
; Enter a layout name or [?] <Floor Plan Layout>:
; Enter an output device name or [?] <\\GCSERVER\Cadjet 2>:
; Enter paper size or [?] <ISO A1 594 X 840 MM>: - Actually called "User265" by system ; Enter paper units [Inches/Millimeters] <Millimeters>:
; Enter drawing orientation [Portrait/Landscape] <Landscape>:
; Plot upside down? [Yes/No] <No>:
; Enter plot area [Display/Extents/Limits/View/Window] <Extents>: v ; Enter view name : a1 ; Enter plot scale (Plotted Millimeters=Drawing Units) or [Fit] <1:1>: 1:1 ; Enter plot offset (x,y) or
(DEFUN getlocalemedianames (adoc / la cmn lmn)
(SETQ la (VLA-ITEM (VLA-GET-LAYOUTS adoc) "Model"))
(FOREACH cmn (getcanonicalmedianames adoc)
(SETQ lmn (CONS (VLA-GETLOCALEMEDIANAME la cmn) lmn))
)
(REVERSE lmn)
)
(getlocalemedianames (vla-get-activedocument (vlax-get-acad-object)))
I then copy the required media name "ISO A1 594 x 840 mm." into the code below but it refuses to recognize this value. I've tried eliminating spaces, taking out the period etc. I'm going freaking mad. What am I doing & why can't I pass this name into the script ?
Regards
Andrew McDonald
;; Routine for '1 click' plotting of titleblock sheets. ;; The routine asks the user to pick a titleblock or crop mark ;; of the titlesheet. The routine retrieves certain values to establish ;; the sheet size and then process that information in the background ;; and sends the plot to the specified device.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; VARIABLES DEFINITIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; blk = block (title block or border) to plot from ;; bn = block name ;; bxs = blocks x scale factor (discontinued) ;; bip = block insertion point
;; This routine has now taken away the option of having a titleblock inserted at a scale other than 1, ;; (previously used when titleblocks were inserted in model space and scaled) ;; the bxs variable will now be set at 1.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ERROR HANDLING ROUTINE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun myerror (s) ; If an error (such as CTRL-C) occurs while this command is active... (if (/= s "Function cancelled") (princ (strcat "\nError: " s)) ) (setvar "filedia" 1) (setvar "cmdecho" 1) (setq *error* olderr) ; Restore old *error* handler (princ)
)
;;************************************************************************** ;; ;; Routine to plot to full size.
(defun c:autoplotfull (/ ifd icm icd blk bn bip)
(setq olderr *error* *error* myerror)
(setq ifd (getvar "filedia"))
(setvar "filedia" 0)(princ)
(setq icm (getvar "cmdecho"))
(setvar "cmdecho" 0)(princ)
(setq ilu (getvar "luprec"))
(setvar "luprec" 0)(princ)
(prompt "\nAutoPLOT routine for TVS Partnership ... loaded ")(princ) (prompt "\nSelect TITLE BLOCK or CROP MARK of what you wish to plot ")(princ) (setq blk (entget (car (entsel)))) ;retrieve block definition (setq bn (cdr (assoc 2 blk))) ;retrieve blocks name (setq bip (cdr (assoc 10 blk))) ;retrieve blocks insertion point (if bn (cond ((= bn "a1 portrait") (PLOT_A1)) ;if A1 PORTRAIT then do PLOT_A1 ((= bn "a1 landscape") (PLOT_A1)) ;if A1 LANDSCAPE then do PLOT_A1 (setq bn nil) ) ) )
(princ)
;;;;;;;;;;;;;;;;;;;; ROUTINE TO SAVE VIEW "A1" & PLOT THE SELECTED TITLE BLOCK/BORDER ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun PLOT_A1 (/ PS)
(if (tblsearch "view" "a1") (command "view" "d" "a1"))
(command "view" "w" "a1" bip (list 810.0 565.5)) ;creates a new view "A1" to plot (command "view" "r" "a1")
? ?
(command "-PLOT" "y" "" "\\\\GCSERVER\\Cadjet 2" "ISO A1 594 x 840 mm." "m" "l" "n" "v" "a1" "1=1" "c" "y" "tvs.ctb" "y" "n" "n" "n" "n" "y" "y")
; Detailed plot configuration? [Yes/No] <No>: y
; Enter a layout name or [?] <Floor Plan Layout>:
; Enter an output device name or [?] <\\GCSERVER\Cadjet 2>:
; Enter paper size or [?] <ISO A1 594 X 840 MM>: - Actually called "User265" by system ; Enter paper units [Inches/Millimeters] <Millimeters>:
; Enter drawing orientation [Portrait/Landscape] <Landscape>:
; Plot upside down? [Yes/No] <No>:
; Enter plot area [Display/Extents/Limits/View/Window] <Extents>: v ; Enter view name : a1 ; Enter plot scale (Plotted Millimeters=Drawing Units) or [Fit] <1:1>: 1:1 ; Enter plot offset (x,y) or
<Center>:
; Plot with plot styles? [Yes/No] <Yes>:
; Enter plot style table name or [?] (enter . for none) <tvs.ctb>:
; Plot with lineweights? [Yes/No] <Yes>:
; Scale lineweights with plot scale? [Yes/No] <No>:
; Plot paper space first? [Yes/No] <No>:
; Hide paperspace objects? [Yes/No] <No>:
; Write the plot to a file [Yes/No] <N>:
; Save changes to page setup [Yes/No]? <Y>
; Proceed with plot [Yes/No] <Y>:
(setq blk nil)
(setq bn nil)
(setq bip nil)
(setvar "filedia" ifd)(princ)
(setvar "cmdecho" icm)(princ)
(setvar "luprec" ilu)(princ)
)
(princ)
; Plot with plot styles? [Yes/No] <Yes>:
; Enter plot style table name or [?] (enter . for none) <tvs.ctb>:
; Plot with lineweights? [Yes/No] <Yes>:
; Scale lineweights with plot scale? [Yes/No] <No>:
; Plot paper space first? [Yes/No] <No>:
; Hide paperspace objects? [Yes/No] <No>:
; Write the plot to a file [Yes/No] <N>:
; Save changes to page setup [Yes/No]? <Y>
; Proceed with plot [Yes/No] <Y>:
(setq blk nil)
(setq bn nil)
(setq bip nil)
(setvar "filedia" ifd)(princ)
(setvar "cmdecho" icm)(princ)
(setvar "luprec" ilu)(princ)
)
(princ)