|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
#1
|
||||
|
||||
Redirect the output of the (display ...) command
Is there any way to redirect the output of the (display) command to a file?
|
#2
|
||||
|
||||
Re: Redirect the output of the (display ...) command
Why don't you just write to a file directly? For example:
Code:
(defun to-display() (display "foo") (display "bar")) (defun to-file() (with-open-file (out "logfile.txt" :direction :output) (print "foo" out) (print "bar" out)))
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/ |
#3
|
||||
|
||||
Re: Redirect the output of the (display ...) command
That is because the command sd-dump-control-tree seems to be very proud about itself and thinks it has to display the output path in the output window.
I would be happy if I could convince the function to do the task quiet. But I'am afraid there is no way to do this, so I have to redirect the output. |
#4
|
||||
|
||||
Re: Redirect the output of the (display ...) command
For inspiration only, code completely untested:
Code:
(defun my-display(msg &rest r) (format t "my-display: ~S ~S" msg r)) (let ((original-display (symbol-function 'display))) (setf (symbol-function 'display) (symbol-function 'my-display)) (display "in block after redirecting") ;; or try to call sd-dump-control-tree here (setf (symbol-function 'display) original-display) (display "in block after restoring"))
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/ Last edited by clausb; 05-27-2011 at 11:10 PM. |
#5
|
||||
|
||||
Re: Redirect the output of the (display ...) command
Try this:
Code:
(let ((original-display (symbol-function 'display-value))) (setf (symbol-function 'display-value) (lambda(&rest r))) (oli:sd-dump-control-tree :filename "c:/temp/tree") (setf (symbol-function 'display-value) original-display)
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/ Last edited by clausb; 05-27-2011 at 11:07 PM. |
#6
|
||||
|
||||
Re: Redirect the output of the (display ...) command
Hello,
that works great, thank you very much. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|