;; -*-Lisp-*- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Description: Wrapper to run Frank Buss' functional geometry code ;; in CoCreate Modeling ;; Author: Claus Brod ;; Language: Lisp ;; ;; (C) Copyright 2008 Claus Brod, all rights reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (in-package :clausbrod.de) (use-package :oli) (export '(plot-escher)) ;; Allow using lambda without quoting it via #' first ;; (No longer required in CoCreate Modeling 2008 and later.) (defmacro lambda (&rest body) `(function (lambda ,@body))) (defparameter *our-loadpath* *load-truename*) (load (format nil "~A/functional.lsp" (directory-namestring *our-loadpath*))) ;; Modeling-specific plotter function (defun plot-annotation (p) (let ((tempfile (format nil "~A/test.mac" (oli:sd-inq-temp-dir))) (scale 500.0)) (startup::activate-annotation) (with-open-file (s tempfile :direction :output :if-exists :supersede) (format s "line~%") (dolist (line (funcall p '(0 0) '(1 0) '(0 1))) (destructuring-bind ((x0 y0) (x1 y1)) line (format s " ~D,~D ~D,~D~%" (* scale (float x0)) (* scale (float y0)) (* scale (float x1)) (* scale (float y1))))) (format s "end")) (oli:sd-execute-annotator-command :cmd (format nil "input '~A'" tempfile)) (docu::docu_vp :fit_vp) (delete-file tempfile))) ;; Shortcut for the Escher fish drawing (defun plot-escher() (plot-annotation *fishes*))