PDA

View Full Version : Inquiring paper size for printing (Annotation)


jkramer
09-03-2004, 02:21 AM
Hi,

I am looking for a way to determine the paper size of an Annotation Sheet, so that the engineer can just push one button to automatically print the sheet on his screen in a proper way.
If I click Text > Text Reference > Assign, I get a nice screen that shows me all available text references, and one of them is "FORMAT". So, Annotation knows (via design management) what size the sheet is (well, that's obvious, I should think)!
Now, is there a way to inquire the paper size with a Lisp command??? Be it be by inquiring the text references or by any other method...

Anyone have a clue??
Thanks,
Jaap

John van Doorn
09-18-2004, 04:33 PM
Hi Jaap,

Please review the following lisp functions:


(defun return-curr-sheet-ll-ur-vec()
(let
(
(me10-function)
(me10-command)
(curr_part)
(ll)
(ur)
(source-size)
(curr-sheet (return-curr-sheet-name))
)

(setq me10-function (format nil "~A ~A ~A ~A ~A ~A"
"inq_env 7"
"let curr_part (STR (inq 301))"
"let curr_part_s (DOCU_CSTRING_TO_LSTRING curr_part)"
"let isopen (DOCU_OPEN_CONNECTION_TO_SD)"
"let done (DOCU_ADD_LINE_TO_SD curr_part_s)"
"let isclosed (DOCU_CLOSE_CONNECTION_TO_SD)"
)
)
(setq curr_part (sd-execute-annotator-function :fnc me10-function))

(setq me10-command (format nil "~A ~A" "current_part" curr-sheet))
(sd-execute-annotator-command :cmd me10-command)

(setq me10-function (format nil "~A ~A ~A ~A ~A ~A"
"inq_env 7"
"let ll (STR (inq 103))"
"let ll_s (DOCU_CSTRING_TO_LSTRING ll)"
"let isopen (DOCU_OPEN_CONNECTION_TO_SD)"
"let done (DOCU_ADD_LINE_TO_SD ll)"
"let isclosed (DOCU_CLOSE_CONNECTION_TO_SD)"
)
)
(setq ll (sd-execute-annotator-function :fnc me10-function))

(setq me10-function (format nil "~A ~A ~A ~A ~A ~A"
"inq_env 7"
"let ur (STR (inq 104))"
"let ur_s (DOCU_CSTRING_TO_LSTRING ur)"
"let isopen (DOCU_OPEN_CONNECTION_TO_SD)"
"let done (DOCU_ADD_LINE_TO_SD ur)"
"let isclosed (DOCU_CLOSE_CONNECTION_TO_SD)"
)
)
(setq ur (sd-execute-annotator-function :fnc me10-function))

(setf source-size (sd-vec-subtract ur ll))


(values source-size ll ur)
); end let
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; return-curr-sheet-format()
;;
;; Work out the size of the current drawing sheet.
;; Returns "A4", "A3", "A2", "A1", "A0".
;; For unknown sheet sizes, returns "A0".
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun return-curr-sheet-format()
(let
(
(source-size)
(vec-length)
)

; Get vector for top right of current sheet.
; This should tell us the x and y lengths.
(setf source-size (return-curr-sheet-ll-ur-vec))
; Get distance between 0,0 to upper right of drawing.
(setf vec-length (read-from-string (format nil "~,6F" (sd-vec-length source-size))))
; Check length from 0,0 to upper right of drawing with length from 0,0 to upper right of known page sizes.
; Return "A4", A3", "A2", "A1", "A0" depending upon distances compared to known distances.
(values
(cond
((<= vec-length (sd-vec-length (make-gpnt2d :x 297 :y 210))) "A4")
((<= vec-length (sd-vec-length (make-gpnt2d :x 420 :y 297))) "A3")
((<= vec-length (sd-vec-length (make-gpnt2d :x 594 :y 420))) "A2")
((<= vec-length (sd-vec-length (make-gpnt2d :x 845 :y 594))) "A1")
((<= vec-length (sd-vec-length (make-gpnt2d :x 1189 :y 841))) "A0")
(t "A0")
)
)
)
)

Michael Kahle
09-22-2004, 04:41 AM
(oli::sd-am-inq-sheet sheet) does return the sheet corners, so forget about macro coding :)

(display (oli::sd-am-sheet-struct-corners (oli::sd-am-inq-sheet (oli::sd-am-inq-curr-sheet))))

--> (-710.08672652854,-364.216296171252
478.91327347146,476.783703828748)

jkramer
09-22-2004, 05:04 AM
Hi,

This functions works in OSD 12 (which I have on my local computer), but not on OSD 11, which is what we use at the moment.....
But it's nice to know that the new function is there :-)

Thanks,
Jaap