;;-------------------------------------------------------------------------- ;; BFE - 12.10.2015 ;-------------------------------------------------------------------------- (in-package :BFE_TOOLS) (use-package '(:OLI )) (sd-defdialog 'bfe-Plot :dialog-title '(sd-multi-lang-string "PDF" :german "PDF erstellen") :after-initialization '(Kasten-definieren) :variables '( (file :value-type :directory :Prompt-text "Ordner zum Speichern angeben" :title "Ordner" :initial-value (sd-get-current-working-directory) :after-input (sd-set-current-working-directory file) ;(Format nil "d:\\~a\\desktop\\" (sd-sys-getenv "USERNAME")) ) (blatt :value-type :string :prompt-text "Blattformat auswählen" :title "Blattformat" :proposals ("Automatisch" "A0" "A1" "A2" "A3" "A4") :auto-add-proposal nil :persistent-proposals t :initial-value "Automatisch" ) (ausr :value-type :string :title (sd-multi-lang-string "orientation" :german "Ausrichtung") :prompt-text (sd-multi-lang-string "Ausrichtung" :german "Blattausrichtung definieren") :proposals ("Standard" "Hoch" "Quer") :initial-value "Standard" ) (einpassen :value-type :boolean :toggle-type :right-toggle :title (sd-multi-lang-string "fit" :german "Einpassen") :prompt-text (sd-multi-lang-string "Einpassen" :german "Zeichnung automatisch einpassen") :initial-value nil ) (anzeigen :value-type :boolean :toggle-type :right-toggle :title (sd-multi-lang-string "view PDF" :german "PDF anzeigen") :prompt-text (sd-multi-lang-string "PDF anzeigen" :german "Zeichnung anzeigen") :initial-value nil ) ) ;; end variables :local-functions '( (rahmen-identifizieren () (when (string= blatt "Automatisch") (defun get-frame-name () (let ((sht-struct (oli:sd-am-inq-sheet (oli:sd-am-inq-curr-sheet)))) (oli:sd-am-inq-name (sd-am-sheet-struct-frame sht-struct)))) (setf blatt (get-frame-name)) ;; (display blatt) ) ) (Kasten-definieren () (let (x-of-ll y-of-ll x-of-ur y-of-ur) (progn (setq part-id (sd-am-inq-unique-name (sd-am-sheet-struct-frame (sd-am-inq-sheet (sd-am-inq-curr-sheet))))) (setq x-of-ll (sd-read-from-string (car (getf (oli::sd-execute-annotator-function :fnc (format nil "Docu_get_part_box '~A'" part-id)) :LL)))) (setq y-of-ll (sd-read-from-string(cadr (getf (oli::sd-execute-annotator-function :fnc (format nil "Docu_get_part_box '~A'" part-id)) :LL)))) (setq x-of-ur (sd-read-from-string(car (getf (oli::sd-execute-annotator-function :fnc (format nil "Docu_get_part_box '~A'" part-id)) :ur)))) (setq y-of-ur (sd-read-from-string(cadr (getf (oli::sd-execute-annotator-function :fnc (format nil "Docu_get_part_box '~A'" part-id)) :ur)))) (setq xy-of-ll (make-gpnt2d :x x-of-ll :y y-of-ll)) (setq xy-of-ur (make-gpnt2d :x x-of-ur :y y-of-ur)) ) ) ) ) :ok-action '(let () (rahmen-identifizieren) (when (or(string= blatt "A0") (string= blatt "DINA0") (string= blatt ".sfeld_rahmen_A0")) (if (and (equal einpassen t) (string= ausr "Standard")) (progn (am_plot_ex :Plot_style :pdf_a0 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and (equal einpassen nil) (string= ausr "Standard")) (progn (am_plot_ex :Plot_style :pdf_a0 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and (equal einpassen t) (string= ausr "Quer")) (progn (am_plot_ex :Plot_style :pdf_a0 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and (equal einpassen t) (string= ausr "Hoch")) (progn (am_plot_ex :Plot_style :pdf_a0 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :portrait :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and(equal einpassen nil) (string= ausr "Quer")) (progn (am_plot_ex :Plot_style :pdf_a0 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :factor :value 1 :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and(equal einpassen nil) (string= ausr "Hoch")) (progn (am_plot_ex :Plot_style :pdf_a0 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :factor :value 1 :ORIENTATION :portrait :POSITION :CENTER :plot :yes ) ;end am_plot_ex ); end progn ) ;end if ) ;end if ) ;end if ) ;end if ) ;end if ) ;end if );end when A0 (when (or(string= blatt "A1") (string= blatt "DINA1") (string= blatt ".sfeld_rahmen_A1")) (if (and (equal einpassen t) (string= ausr "Standard")) (progn (am_plot_ex :Plot_style :pdf_a1 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and (equal einpassen nil) (string= ausr "Standard")) (progn (am_plot_ex :Plot_style :pdf_a1 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and (equal einpassen t) (string= ausr "Quer")) (progn (am_plot_ex :Plot_style :pdf_a1 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and (equal einpassen t) (string= ausr "Hoch")) (progn (am_plot_ex :Plot_style :pdf_a1 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :portrait :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and(equal einpassen nil) (string= ausr "Quer")) (progn (am_plot_ex :Plot_style :pdf_a1 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :factor :value 1 :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and(equal einpassen nil) (string= ausr "Hoch")) (progn (am_plot_ex :Plot_style :pdf_a1 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :factor :value 1 :ORIENTATION :portrait :POSITION :CENTER :plot :yes ) ;end am_plot_ex ); end progn ) ;end if ) ;end if ) ;end if ) ;end if ) ;end if ) ;end if );end when A1 (when (or(string= blatt "A2") (string= blatt "DINA2") (string= blatt ".sfeld_rahmen_A2")) (if (and (equal einpassen t) (string= ausr "Standard")) (progn (am_plot_ex :Plot_style :pdf_a2 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and (equal einpassen nil) (string= ausr "Standard")) (progn (am_plot_ex :Plot_style :pdf_a2 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and (equal einpassen t) (string= ausr "Quer")) (progn (am_plot_ex :Plot_style :pdf_a2 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and (equal einpassen t) (string= ausr "Hoch")) (progn (am_plot_ex :Plot_style :pdf_a2 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :portrait :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and(equal einpassen nil) (string= ausr "Quer")) (progn (am_plot_ex :Plot_style :pdf_a2 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :factor :value 1 :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and(equal einpassen nil) (string= ausr "Hoch")) (progn (am_plot_ex :Plot_style :pdf_a2 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :factor :value 1 :ORIENTATION :portrait :POSITION :CENTER :plot :yes ) ;end am_plot_ex ); end progn ) ;end if ) ;end if ) ;end if ) ;end if ) ;end if ) ;end if );end when A2 (when (or(string= blatt "A3") (string= blatt "DINA3") (string= blatt ".sfeld_rahmen_A3")) (if (and (equal einpassen t) (string= ausr "Standard")) (progn (am_plot_ex :Plot_style :pdf_a3 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and (equal einpassen nil) (string= ausr "Standard")) (progn (am_plot_ex :Plot_style :pdf_a3 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and (equal einpassen t) (string= ausr "Quer")) (progn (am_plot_ex :Plot_style :pdf_a3 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ;end am_plot_ex );end progn (if (and (equal einpassen t) (string= ausr "Hoch")) (progn (am_plot_ex :Plot_style :pdf_a3 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :portrait :POSITION :CENTER :plot :yes ) ;end am_plot_ex );end progn (if (and(equal einpassen nil) (string= ausr "Quer")) (progn (am_plot_ex :Plot_style :pdf_a3 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :factor :value 1 :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and(equal einpassen nil) (string= ausr "Hoch")) (progn (am_plot_ex :Plot_style :pdf_a3 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :factor :value 1 :ORIENTATION :portrait :POSITION :CENTER :plot :yes ) ;end am_plot_ex ); end progn ) ;end if ) ;end if ) ;end if ) ;end if ) ;end if ) ;end if );end when A3 (when (or(string= blatt "A4") (string= blatt "DINA4") (string= blatt ".sfeld_rahmen_A4")) (if (and (equal einpassen t) (string= ausr "Standard")) (progn (am_plot_ex :Plot_style :pdf_a4 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :portrait :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and (equal einpassen nil) (string= ausr "Standard")) (progn (am_plot_ex :Plot_style :pdf_a4 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :portrait :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and (equal einpassen t) (string= ausr "Quer")) (progn (am_plot_ex :Plot_style :pdf_a4 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and (equal einpassen t) (string= ausr "Hoch")) (progn (am_plot_ex :Plot_style :pdf_a4 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :fit :ORIENTATION :portrait :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and(equal einpassen nil) (string= ausr "Quer")) (progn (am_plot_ex :Plot_style :pdf_a4 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :factor :value 1 :ORIENTATION :landscape :POSITION :CENTER :plot :yes ) ; end am_plot_ex ); end progn (if (and(equal einpassen nil) (string= ausr "Hoch")) (progn (am_plot_ex :Plot_style :pdf_a4 :output_drawing :destination (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no)) :scale :factor :value 1 :ORIENTATION :portrait :POSITION :CENTER :plot :yes ) ;end am_plot_ex ); end progn ) ;end if ) ;end if ) ;end if ) ;end if ) ;end if ) ;end if );end when A4 ;PDF anzeigen (if (equal anzeigen t) (progn (oli:sd-display-url (Format nil "~a\\~a.pdf" file (sd-am-inq-drawing-no))); open PDF ); end Progn ); end if (if (not(or(string= blatt "A4") (string= blatt "A3") (string= blatt "A2") (string= blatt "A1") (string= blatt "A0") (string= blatt "DINA4") (string= blatt "DINA3") (string= blatt "DINA2") (string= blatt "DINA1") (string= blatt "DINA0") (string= blatt ".sfeld_rahmen_A4") (string= blatt ".sfeld_rahmen_A3") (string= blatt ".sfeld_rahmen_A2") (string= blatt ".sfeld_rahmen_A1") (string= blatt ".sfeld_rahmen_A0") ); end or ); end not (display "Blattformat nicht gefunden, Bitte manuell auswÌhlen") ); end if ;end Fehlermeldung kein Blattformat );end ok action ) ;; end dialog