0 Members and 1 Guest are viewing this topic.
Sub test()Dim Vyoo As AcadViewDim Vyues As AcadViewsSet Vyues = ThisDrawing.ViewsFor Each Vyoo In Vyues ThisDrawing.SendCommand "-PLOT" & vbCr & "y" & vbCr & "Model" & vbCr & _ "PLOTTER NAME HERE" & vbCr & "PAPER SIZE HERE" & vbCr & "I" & vbCr & "L" & vbCr & "N" _ & vbCr & "v" & vbCr & Vyoo.Name & vbCr & "f" & vbCr & "C" & vbCr & "Y" & _ vbCr & "SOME CTB FILE NAME WITHOUT EXTENSION HERE" & vbCr & "Y" & vbCr & "n" & vbCr & vbCr & "n" & vbCr & "y" & vbCrNext VyooEnd Sub
;Routine om een gekozen aantal views af te drukken. 17-08-2004. ;(c) 2004 Siem Weel ;;; Use this for a list of the views: ;;; (GetNames "view") ;;; Use this for the number of views: ;;; (length (GetNames "view")) (defun getnames (tablename / data result) (while (setq data (tblnext tablename (null data))) (setq result (cons (list (cdr (assoc 2 data)) (cdr (assoc 40 data)) (cdr (assoc 41 data)) ) ;_ end of LIST result ) ;_ end of CONS ) ;_ end of SETQ ) ;_ end of WHILE ) ;_ end of DEFUN ;Start routine (defun c:printview (/ ocmd ocmddia oexpert oosmode viewlijst dianummer viewselect papierformaat teller item orientatie viewnaam hoogte breedte ) ;Save values of variables to change (setq ocmd (getvar "cmdecho") ocmddia (getvar "cmddia") oexpert (getvar "expert") oosmode (getvar "osmode") ) ;_ end of SETQ ;;;;; (command "cmdecho" 0 "cmddia" 1 "expert" 5 "osmode" 0) ;Change variables (setq viewlijst ;Get list of views and sort it (vl-sort (getnames "view") (function (lambda (a b) (< (nth 0 a) (nth 0 b)))) ) ;_ end of VL-SORT ) ;_ end of SETQ (setq dianummer (load_dialog "printview")) ;Start dialog to select views (new_dialog "printview" dianummer) (start_list "viewbox") (setq teller 0) (repeat (length viewlijst) (add_list (car (nth teller viewlijst))) (setq teller (+ 1 teller)) ) ;_ end of REPEAT (end_list) (action_tile "accept" "(setq viewselect (get_tile \"viewbox\"))(setq papierformaat (get_tile \"papierformaat\"))(done_dialog)" ) ;_ end of ACTION_TILE (action_tile "cancel" "(setq viewselect \"\")(done_dialog)") (start_dialog) (unload_dialog dianummer) ;If a view is selected, then print it (if (/= viewselect "") (progn (setq viewselect (read (strcat "(" viewselect ")"))) ;Convert string to list (setq teller 0) (repeat (length viewselect) ;Loop to process all selected views (setq item (nth teller viewselect) viewnaam (car (nth item viewlijst)) ; Name of view hoogte (cadr (nth item viewlijst)) ; Height of view breedte (car (cddr (nth item viewlijst))) ; Width of view ) ;_ end of SETQ (if (< breedte hoogte) ;Set paperorientation according to height/width (setq orientatie "Portrait") (setq orientatie "Landscape") ) ;_ end of IF ;;;For debug purpose ;;; (princ (strcat "\nViewnummer: " ;;; (itoa item) ;;; " Viewnaam: " ;;; viewnaam ;;; " Breedte: " ;;; (itoa (fix breedte)) ;;; " Hoogte: " ;;; (itoa (fix hoogte)) ;;; ) ;_ end of STRCAT ;;; ) ;_ end of PRINC ;;; (princ (strcat "\nPapierformaat: " ;;; papierformaat ;;; " Papier orientatie: " ;;; orientatie ;;; "\n" ;;; ) ;_ end of strcat ;;; ) ;_ end of PRINC (command "-plot" ; Print view "yes" ;Detailed plot configuration? [Yes/No] <No> "model" ;Enter a layout name or [?] <Model> "Laserjet A3.pc3" ;Enter an output device name papierformaat ;Enter paper size: "M" ;Inches/milimeters orientatie ;Enter drawing orientation: "n" ;Plot upside down: "view" ;Enter plot area: viewnaam ;Enter view name: (strcat "1=" (itoa sch)) ;Enter plot scale "Center" ;Enter plot offset "y" ;Plot with plot styles: "-2 Plotter Normaal.ctb" ;Enter plot style table name "y" ;Plot with lineweights: "n" ;Remove hidden lines "n" ;Write the plot to a file [Yes/No] <N>: "n" ;Save changes to model tab [Yes/No]? <N> "y" ;Proceed with plot [Yes/No] <Y>: ) ;_ end of COMMAND (setq teller (+ 1 teller)) ) ;_ end of REPEAT ) ;_ end of PROGN (princ "\nGeen views gekozen") ; Display text if no view or cancel is selected ) ;_ end of IF (command "cmddia" ocmddia "expert" oexpert "osmode" oosmode "cmdecho" ; Reset variables ocmd) ;_ end of command (princ) ) ;_ end of DEFUN ;|«Visual LISP© Format Options» (72 2 1 2 T "end of " 60 9 1 1 0 T nil T T) ;*** DO NOT add text below the comment! ***|; ;;;; end routine;;;;;;;;
printview : dialog {label = "Views afdrukken"; : row { : boxed_column { label = "Selecteer views:"; : list_box { // fixed_width_font = true; key = "viewbox"; width = 25; height = 25; multiple_select = true; } } // End column : spacer_1 {} : column { fixed_height = true; alignment = top; : boxed_row { label = "Papier formaat:"; : radio_column { key = "papierformaat"; : radio_button { label = "A4"; key = "A4"; } : radio_button { label = "ISO A3 (297.00 x 420.00 MM)"; key = "ISO A3 (297.00 x 420.00 MM)"; value = "1"; } } // End radiocolumn } // End row } // End column } // End row : spacer_1 {} ok_cancel; } // End dialog
(defun getnames (tablename / data result) (while (setq data (tblnext tablename (null data))) (setq result (cons (list (cdr (assoc 2 data)) (cdr (assoc 40 data)) (cdr (assoc 41 data)) ) ;_ end of LIST result ) ;_ end of CONS ) ;_ end of SETQ ) ;_ end of WHILE ) ;_ end of DEFUN ;Start routine (defun c:printview (/ ocmd ocmddia oexpert oosmode viewlijst dianummer viewselect papierformaat teller item orientatie viewnaam hoogte breedte ) ;Save values of variables to change (setq ocmd (getvar "cmdecho") ocmddia (getvar "cmddia") oexpert (getvar "expert") oosmode (getvar "osmode") ) ;_ end of SETQ (command "cmdecho" 0 "cmddia" 1 "expert" 5 "osmode" 0) ;Change variables (setq viewlijst ;Get list of views and sort it (vl-sort (getnames "view") (function (lambda (a b) (< (nth 0 a) (nth 0 b)))) ) ;_ end of VL-SORT ) ;_ end of SETQ (setq dianummer (load_dialog "printview")) ;Start dialog to select views (new_dialog "printview" dianummer) (start_list "viewbox") (setq teller 0) (repeat (length viewlijst) (add_list (car (nth teller viewlijst))) (setq teller (+ 1 teller)) ) ;_ end of REPEAT (end_list) (action_tile "accept" "(setq viewselect (get_tile \"viewbox\"))(setq papierformaat (get_tile \"papierformaat\"))(done_dialog)" ) ;_ end of ACTION_TILE (action_tile "cancel" "(setq viewselect \"\")(done_dialog)") (start_dialog) (unload_dialog dianummer) ;If a view is selected, then print it (if (/= viewselect "") (progn (setq viewselect (read (strcat "(" viewselect ")"))) ;Convert string to list (setq teller 0) (repeat (length viewselect) ;Loop to process all selected views (setq item (nth teller viewselect) viewnaam (car (nth item viewlijst)) ; Name of view hoogte (cadr (nth item viewlijst)) ; Height of view breedte (car (cddr (nth item viewlijst))) ; Width of view ) ;_ end of SETQ (if (< breedte hoogte) ;Set paperorientation according to height/width (setq orientatie "Portrait") (setq orientatie "Landscape") ) ;_ end of IF ;;;For debug purpose ;;; (princ (strcat "\nViewnummer: " ;;; (itoa item) ;;; " Viewnaam: " ;;; viewnaam ;;; " Breedte: " ;;; (itoa (fix breedte)) ;;; " Hoogte: " ;;; (itoa (fix hoogte)) ;;; ) ;_ end of STRCAT ;;; ) ;_ end of PRINC ;;; (princ (strcat "\nPapierformaat: " ;;; papierformaat ;;; " Papier orientatie: " ;;; orientatie ;;; "\n" ;;; ) ;_ end of strcat ;;; ) ;_ end of PRINC (command "-plot" ; Print view "yes" ;Detailed plot configuration? [Yes/No] <No> "model" ;Enter a layout name or [?] <Model> "Laserjet A3.pc3" ;Enter an output device name papierformaat ;Enter paper size: "M" ;Inches/milimeters orientatie ;Enter drawing orientation: "n" ;Plot upside down: "view" ;Enter plot area: viewnaam ;Enter view name: ;;(strcat "1=" (itoa schl)) ;Enter plot scale "1=5" "Center" ;Enter plot offset "y" ;Plot with plot styles: "Plotter Normaal.ctb" ;Enter plot style table name "y" ;Plot with lineweights: "n" ;Remove hidden lines "n" ;Write the plot to a file [Yes/No] <N>: "n" ;Save changes to model tab [Yes/No]? <N> "y" ;Proceed with plot [Yes/No] <Y>: ) ;_ end of COMMAND (setq teller (+ 1 teller)) ) ;_ end of REPEAT ) ;_ end of PROGN (princ "\nGeen views gekozen.....!!!!!!!!!!!") ; Display text if no view or cancel is selected ) ;_ end of IF (command "cmddia" ocmddia "expert" oexpert "osmode" oosmode "cmdecho" ; Reset variables ocmd) ;_ end of command (princ) ) ;_ end of DEFUN ;|«Visual LISP© Format Options» (72 2 1 2 T "end of " 60 9 1 1 0 T nil T T) ;*** DO NOT add text below the comment! ***|; ;;;; end routine;;;;;;;;
printview : dialog {label = "Print Views 2006"; : row { : boxed_column { label = "Selecteer Views:"; : list_box { // fixed_width_font = true; key = "viewbox"; width = 25; height = 20; multiple_select = true; } } // End column : spacer_1 {} : column { fixed_height = true; alignment = top; : boxed_row { label = "Papier Formaat:"; : radio_column { key = "papierformaat"; : radio_button { label = "A4 210x297 mm"; key = "ISO A4 (210.00 x 297.00 MM)"; } : radio_button { label = "A3 297x420 mm"; key = "ISO A3 (297.00 x 420.00 MM)"; value = "1"; } } // End radiocolumn } // End row } // End column } // End row : spacer_1 {} ok_cancel; } // End dialog